History

futex: Make futex_mm_init() void

Nothing fails there. Mop up the leftovers of the early version of this, which did an allocation. While at it clean up the stubs and the #ifdef comments to make the header file readable.

Thomas Gleixner committed 5 months ago

Commit d7b3f521 parent c1ffc9c3 files · +14 −25Browse files

Showing the changes to kernel (2 of 3 files). Show all

Unified · Split

2 files
  1. kernel/fork.c +2 −6
  2. kernel/futex/core.c +1 −2
kernel/fork.c+2−6
@@ -1101,6 +1101,7 @@ static struct mm_struct *mm_init(struct mm_struct *mm, struct task_struct *p, · 1100 unmodified lines
1101#endif1101#endif
1102 mm_init_uprobes_state(mm);1102 mm_init_uprobes_state(mm);
1103 hugetlb_count_init(mm);1103 hugetlb_count_init(mm);
1104 futex_mm_init(mm);
1104 1105
1105 mm_flags_clear_all(mm);1106 mm_flags_clear_all(mm);
1106 if (current->mm) {1107 if (current->mm) {
@@ -1113,11 +1114,8 @@ static struct mm_struct *mm_init(struct mm_struct *mm, struct task_struct *p, · 6 unmodified lines
1113 mm->def_flags = 0;1114 mm->def_flags = 0;
1114 }1115 }
1115 1116
1116 if (futex_mm_init(mm))
1117 goto fail_mm_init;
1118
1119 if (mm_alloc_pgd(mm))1117 if (mm_alloc_pgd(mm))
1120 goto fail_nopgd;1118 goto fail_mm_init;
1121 1119
1122 if (mm_alloc_id(mm))1120 if (mm_alloc_id(mm))
1123 goto fail_noid;1121 goto fail_noid;
@@ -1144,8 +1142,6 @@ fail_nocontext: · 20 unmodified lines
1144 mm_free_id(mm);1142 mm_free_id(mm);
1145fail_noid:1143fail_noid:
1146 mm_free_pgd(mm);1144 mm_free_pgd(mm);
1147fail_nopgd:
1148 futex_hash_free(mm);
1149fail_mm_init:1145fail_mm_init:
1150 free_mm(mm);1146 free_mm(mm);
1151 return NULL;1147 return NULL;
kernel/futex/core.c+1−2
@@ -1720,7 +1720,7 @@ static bool futex_ref_is_dead(struct futex_private_hash *fph) · 1719 unmodified lines
1720 return atomic_long_read(&mm->futex_atomic) == 0;1720 return atomic_long_read(&mm->futex_atomic) == 0;
1721}1721}
1722 1722
1723int futex_mm_init(struct mm_struct *mm)1723void futex_mm_init(struct mm_struct *mm)
1724{1724{
1725 mutex_init(&mm->futex_hash_lock);1725 mutex_init(&mm->futex_hash_lock);
1726 RCU_INIT_POINTER(mm->futex_phash, NULL);1726 RCU_INIT_POINTER(mm->futex_phash, NULL);
@@ -1729,7 +1729,6 @@ int futex_mm_init(struct mm_struct *mm) · 2 unmodified lines
1729 mm->futex_ref = NULL;1729 mm->futex_ref = NULL;
1730 atomic_long_set(&mm->futex_atomic, 0);1730 atomic_long_set(&mm->futex_atomic, 0);
1731 mm->futex_batches = get_state_synchronize_rcu();1731 mm->futex_batches = get_state_synchronize_rcu();
1732 return 0;
1733}1732}
1734 1733
1735void futex_hash_free(struct mm_struct *mm)1734void futex_hash_free(struct mm_struct *mm)