mirror of
https://github.com/Dasharo/linux.git
synced 2026-03-06 15:25:10 -08:00
mm: add new mmgrab() helper
Apart from adding the helper function itself, the rest of the kernel is converted mechanically using: git grep -l 'atomic_inc.*mm_count' | xargs sed -i 's/atomic_inc(&\(.*\)->mm_count);/mmgrab\(\1\);/' git grep -l 'atomic_inc.*mm_count' | xargs sed -i 's/atomic_inc(&\(.*\)\.mm_count);/mmgrab\(\&\1\);/' This is needed for a later patch that hooks into the helper, but might be a worthwhile cleanup on its own. (Michal Hocko provided most of the kerneldoc comment.) Link: http://lkml.kernel.org/r/20161218123229.22952-1-vegard.nossum@oracle.com Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com> Acked-by: Michal Hocko <mhocko@suse.com> Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org> Acked-by: David Rientjes <rientjes@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
committed by
Linus Torvalds
parent
522b837c67
commit
f1f1007644
@@ -144,7 +144,7 @@ smp_callin(void)
|
||||
alpha_mv.smp_callin();
|
||||
|
||||
/* All kernel threads share the same mm context. */
|
||||
atomic_inc(&init_mm.mm_count);
|
||||
mmgrab(&init_mm);
|
||||
current->active_mm = &init_mm;
|
||||
|
||||
/* inform the notifiers about the new cpu */
|
||||
|
||||
@@ -140,7 +140,7 @@ void start_kernel_secondary(void)
|
||||
setup_processor();
|
||||
|
||||
atomic_inc(&mm->mm_users);
|
||||
atomic_inc(&mm->mm_count);
|
||||
mmgrab(mm);
|
||||
current->active_mm = mm;
|
||||
cpumask_set_cpu(cpu, mm_cpumask(mm));
|
||||
|
||||
|
||||
@@ -371,7 +371,7 @@ asmlinkage void secondary_start_kernel(void)
|
||||
* reference and switch to it.
|
||||
*/
|
||||
cpu = smp_processor_id();
|
||||
atomic_inc(&mm->mm_count);
|
||||
mmgrab(mm);
|
||||
current->active_mm = mm;
|
||||
cpumask_set_cpu(cpu, mm_cpumask(mm));
|
||||
|
||||
|
||||
@@ -222,7 +222,7 @@ asmlinkage void secondary_start_kernel(void)
|
||||
* All kernel threads share the same mm context; grab a
|
||||
* reference and switch to it.
|
||||
*/
|
||||
atomic_inc(&mm->mm_count);
|
||||
mmgrab(mm);
|
||||
current->active_mm = mm;
|
||||
|
||||
/*
|
||||
|
||||
@@ -308,7 +308,7 @@ void secondary_start_kernel(void)
|
||||
|
||||
/* Attach the new idle task to the global mm. */
|
||||
atomic_inc(&mm->mm_users);
|
||||
atomic_inc(&mm->mm_count);
|
||||
mmgrab(mm);
|
||||
current->active_mm = mm;
|
||||
|
||||
preempt_disable();
|
||||
|
||||
@@ -162,7 +162,7 @@ void start_secondary(void)
|
||||
);
|
||||
|
||||
/* Set the memory struct */
|
||||
atomic_inc(&init_mm.mm_count);
|
||||
mmgrab(&init_mm);
|
||||
current->active_mm = &init_mm;
|
||||
|
||||
cpu = smp_processor_id();
|
||||
|
||||
@@ -994,7 +994,7 @@ cpu_init (void)
|
||||
*/
|
||||
ia64_setreg(_IA64_REG_CR_DCR, ( IA64_DCR_DP | IA64_DCR_DK | IA64_DCR_DX | IA64_DCR_DR
|
||||
| IA64_DCR_DA | IA64_DCR_DD | IA64_DCR_LC));
|
||||
atomic_inc(&init_mm.mm_count);
|
||||
mmgrab(&init_mm);
|
||||
current->active_mm = &init_mm;
|
||||
BUG_ON(current->mm);
|
||||
|
||||
|
||||
@@ -403,7 +403,7 @@ void __init cpu_init (void)
|
||||
printk(KERN_INFO "Initializing CPU#%d\n", cpu_id);
|
||||
|
||||
/* Set up and load the per-CPU TSS and LDT */
|
||||
atomic_inc(&init_mm.mm_count);
|
||||
mmgrab(&init_mm);
|
||||
current->active_mm = &init_mm;
|
||||
if (current->mm)
|
||||
BUG();
|
||||
|
||||
@@ -345,7 +345,7 @@ asmlinkage void secondary_start_kernel(void)
|
||||
* reference and switch to it.
|
||||
*/
|
||||
atomic_inc(&mm->mm_users);
|
||||
atomic_inc(&mm->mm_count);
|
||||
mmgrab(mm);
|
||||
current->active_mm = mm;
|
||||
cpumask_set_cpu(cpu, mm_cpumask(mm));
|
||||
enter_lazy_tlb(mm, current);
|
||||
|
||||
@@ -2232,7 +2232,7 @@ void per_cpu_trap_init(bool is_boot_cpu)
|
||||
if (!cpu_data[cpu].asid_cache)
|
||||
cpu_data[cpu].asid_cache = asid_first_version(cpu);
|
||||
|
||||
atomic_inc(&init_mm.mm_count);
|
||||
mmgrab(&init_mm);
|
||||
current->active_mm = &init_mm;
|
||||
BUG_ON(current->mm);
|
||||
enter_lazy_tlb(&init_mm, current);
|
||||
|
||||
@@ -589,7 +589,7 @@ static void __init smp_cpu_init(void)
|
||||
}
|
||||
printk(KERN_INFO "Initializing CPU#%d\n", cpu_id);
|
||||
|
||||
atomic_inc(&init_mm.mm_count);
|
||||
mmgrab(&init_mm);
|
||||
current->active_mm = &init_mm;
|
||||
BUG_ON(current->mm);
|
||||
|
||||
|
||||
@@ -279,7 +279,7 @@ smp_cpu_init(int cpunum)
|
||||
set_cpu_online(cpunum, true);
|
||||
|
||||
/* Initialise the idle task for this CPU */
|
||||
atomic_inc(&init_mm.mm_count);
|
||||
mmgrab(&init_mm);
|
||||
current->active_mm = &init_mm;
|
||||
BUG_ON(current->mm);
|
||||
enter_lazy_tlb(&init_mm, current);
|
||||
|
||||
@@ -707,7 +707,7 @@ void start_secondary(void *unused)
|
||||
unsigned int cpu = smp_processor_id();
|
||||
int i, base;
|
||||
|
||||
atomic_inc(&init_mm.mm_count);
|
||||
mmgrab(&init_mm);
|
||||
current->active_mm = &init_mm;
|
||||
|
||||
smp_store_cpu_info(cpu);
|
||||
|
||||
@@ -73,7 +73,7 @@ void cpu_init(void)
|
||||
get_cpu_id(id);
|
||||
if (machine_has_cpu_mhz)
|
||||
update_cpu_mhz(NULL);
|
||||
atomic_inc(&init_mm.mm_count);
|
||||
mmgrab(&init_mm);
|
||||
current->active_mm = &init_mm;
|
||||
BUG_ON(current->mm);
|
||||
enter_lazy_tlb(&init_mm, current);
|
||||
|
||||
@@ -336,7 +336,7 @@ void __init trap_init(void)
|
||||
set_except_vector(18, handle_dbe);
|
||||
flush_icache_range(DEBUG_VECTOR_BASE_ADDR, IRQ_VECTOR_BASE_ADDR);
|
||||
|
||||
atomic_inc(&init_mm.mm_count);
|
||||
mmgrab(&init_mm);
|
||||
current->active_mm = &init_mm;
|
||||
cpu_cache_init();
|
||||
}
|
||||
|
||||
@@ -178,7 +178,7 @@ asmlinkage void start_secondary(void)
|
||||
struct mm_struct *mm = &init_mm;
|
||||
|
||||
enable_mmu();
|
||||
atomic_inc(&mm->mm_count);
|
||||
mmgrab(mm);
|
||||
atomic_inc(&mm->mm_users);
|
||||
current->active_mm = mm;
|
||||
#ifdef CONFIG_MMU
|
||||
|
||||
@@ -93,7 +93,7 @@ void leon_cpu_pre_online(void *arg)
|
||||
: "memory" /* paranoid */);
|
||||
|
||||
/* Attach to the address space of init_task. */
|
||||
atomic_inc(&init_mm.mm_count);
|
||||
mmgrab(&init_mm);
|
||||
current->active_mm = &init_mm;
|
||||
|
||||
while (!cpumask_test_cpu(cpuid, &smp_commenced_mask))
|
||||
|
||||
@@ -122,7 +122,7 @@ void smp_callin(void)
|
||||
current_thread_info()->new_child = 0;
|
||||
|
||||
/* Attach to the address space of init_task. */
|
||||
atomic_inc(&init_mm.mm_count);
|
||||
mmgrab(&init_mm);
|
||||
current->active_mm = &init_mm;
|
||||
|
||||
/* inform the notifiers about the new cpu */
|
||||
|
||||
@@ -93,7 +93,7 @@ void sun4d_cpu_pre_online(void *arg)
|
||||
show_leds(cpuid);
|
||||
|
||||
/* Attach to the address space of init_task. */
|
||||
atomic_inc(&init_mm.mm_count);
|
||||
mmgrab(&init_mm);
|
||||
current->active_mm = &init_mm;
|
||||
|
||||
local_ops->cache_all();
|
||||
|
||||
@@ -59,7 +59,7 @@ void sun4m_cpu_pre_online(void *arg)
|
||||
: "memory" /* paranoid */);
|
||||
|
||||
/* Attach to the address space of init_task. */
|
||||
atomic_inc(&init_mm.mm_count);
|
||||
mmgrab(&init_mm);
|
||||
current->active_mm = &init_mm;
|
||||
|
||||
while (!cpumask_test_cpu(cpuid, &smp_commenced_mask))
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user