--- initial
+++ final
@@ -1,141 +1,141 @@
 void __init sched_init(void) {
   int i, j;
   unsigned long alloc_size = 0, ptr;
   sched_clock_init();
   for (i = 0; i < WAIT_TABLE_SIZE; i++)
     init_waitqueue_head(bit_wait_table + i);
 #ifdef CONFIG_FAIR_GROUP_SCHED
   alloc_size += 2 * nr_cpu_ids * sizeof(void **);
 #endif
 #ifdef CONFIG_RT_GROUP_SCHED
   alloc_size += 2 * nr_cpu_ids * sizeof(void **);
 #endif
   if (alloc_size) {
     ptr = (unsigned long)kzalloc(alloc_size, GFP_NOWAIT);
 #ifdef CONFIG_FAIR_GROUP_SCHED
     root_task_group.se = (struct sched_entity **)ptr;
     ptr += nr_cpu_ids * sizeof(void **);
     root_task_group.cfs_rq = (struct cfs_rq **)ptr;
     ptr += nr_cpu_ids * sizeof(void **);
 #endif /* CONFIG_FAIR_GROUP_SCHED */
 #ifdef CONFIG_RT_GROUP_SCHED
     root_task_group.rt_se = (struct sched_rt_entity **)ptr;
     ptr += nr_cpu_ids * sizeof(void **);
     root_task_group.rt_rq = (struct rt_rq **)ptr;
     ptr += nr_cpu_ids * sizeof(void **);
 #endif /* CONFIG_RT_GROUP_SCHED */
   }
 #ifdef CONFIG_CPUMASK_OFFSTACK
   for_each_possible_cpu(i) {
     per_cpu(load_balance_mask, i) = (cpumask_var_t)kzalloc_node(cpumask_size(), GFP_KERNEL, cpu_to_node(i));
     per_cpu(select_idle_mask, i) = (cpumask_var_t)kzalloc_node(cpumask_size(), GFP_KERNEL, cpu_to_node(i));
   }
 #endif /* CONFIG_CPUMASK_OFFSTACK */
   init_rt_bandwidth(&def_rt_bandwidth, global_rt_period(), global_rt_runtime());
   init_dl_bandwidth(&def_dl_bandwidth, global_rt_period(), global_rt_runtime());
 #ifdef CONFIG_SMP
   init_defrootdomain();
 #endif
 #ifdef CONFIG_RT_GROUP_SCHED
   init_rt_bandwidth(&root_task_group.rt_bandwidth, global_rt_period(), global_rt_runtime());
 #endif /* CONFIG_RT_GROUP_SCHED */
 #ifdef CONFIG_CGROUP_SCHED
   task_group_cache = KMEM_CACHE(task_group, 0);
   list_add(&root_task_group.list, &task_groups);
   INIT_LIST_HEAD(&root_task_group.children);
   INIT_LIST_HEAD(&root_task_group.siblings);
   autogroup_init(&init_task);
 #endif /* CONFIG_CGROUP_SCHED */
   for_each_possible_cpu(i) {
     struct rq *rq;
     rq = cpu_rq(i);
     raw_spin_lock_init(&rq->lock);
     rq->nr_running = 0;
     rq->calc_load_active = 0;
     rq->calc_load_update = jiffies + LOAD_FREQ;
     init_cfs_rq(&rq->cfs);
     init_rt_rq(&rq->rt);
     init_dl_rq(&rq->dl);
 #ifdef CONFIG_FAIR_GROUP_SCHED
     root_task_group.shares = ROOT_TASK_GROUP_LOAD;
     INIT_LIST_HEAD(&rq->leaf_cfs_rq_list);
     rq->tmp_alone_branch = &rq->leaf_cfs_rq_list;
     /*
      * How much CPU bandwidth does root_task_group get?
      *
      * In case of task-groups formed thr' the cgroup filesystem, it
      * gets 100% of the CPU resources in the system. This overall
      * system CPU resource is divided among the tasks of
      * root_task_group and its child task-groups in a fair manner,
      * based on each entity's (task or task-group's) weight
      * (se->load.weight).
      *
      * In other words, if root_task_group has 10 tasks of weight
      * 1024) and two child groups A0 and A1 (of weight 1024 each),
      * then A0's share of the CPU resource is:
      *
      *	A0's bandwidth = 1024 / (10*1024 + 1024 + 1024) = 8.33%
      *
      * We achieve this by letting root_task_group's tasks sit
      * directly in rq->cfs (i.e root_task_group->se[] = NULL).
      */
     init_cfs_bandwidth(&root_task_group.cfs_bandwidth);
     init_tg_cfs_entry(&root_task_group, &rq->cfs, NULL, i, NULL);
 #endif /* CONFIG_FAIR_GROUP_SCHED */
     rq->rt.rt_runtime = def_rt_bandwidth.rt_runtime;
 #ifdef CONFIG_RT_GROUP_SCHED
     init_tg_rt_entry(&root_task_group, &rq->rt, NULL, i, NULL);
 #endif
     for (j = 0; j < CPU_LOAD_IDX_MAX; j++)
       rq->cpu_load[j] = 0;
 #ifdef CONFIG_SMP
     rq->sd = NULL;
     rq->rd = NULL;
     rq->cpu_capacity = rq->cpu_capacity_orig = SCHED_CAPACITY_SCALE;
     rq->balance_callback = NULL;
     rq->active_balance = 0;
     rq->next_balance = jiffies;
     rq->push_cpu = 0;
     rq->cpu = i;
     rq->online = 0;
     rq->idle_stamp = 0;
     rq->avg_idle = 2 * sysctl_sched_migration_cost;
     rq->max_idle_balance_cost = sysctl_sched_migration_cost;
     INIT_LIST_HEAD(&rq->cfs_tasks);
     rq_attach_root(rq, &def_root_domain);
 #ifdef CONFIG_NO_HZ_COMMON
     rq->last_load_update_tick = jiffies;
     rq->nohz_flags = 0;
 #endif
 #ifdef CONFIG_NO_HZ_FULL
     rq->last_sched_tick = 0;
 #endif
 #endif /* CONFIG_SMP */
     init_rq_hrtick(rq);
     atomic_set(&rq->nr_iowait, 0);
   }
   set_load_weight(&init_task);
   /*
    * The boot idle thread does lazy MMU switching as well:
    */
-  atomic_inc(&init_mm.mm_count);
+  mmgrab(&init_mm);
   enter_lazy_tlb(&init_mm, current);
   /*
    * Make us the idle thread. Technically, schedule() should not be
    * called from this thread, however somewhere below it might be,
    * but because we are the idle thread, we just pick up running again
    * when this runqueue becomes "idle".
    */
   init_idle(current, smp_processor_id());
   calc_load_update = jiffies + LOAD_FREQ;
 #ifdef CONFIG_SMP
   zalloc_cpumask_var(&sched_domains_tmpmask, GFP_NOWAIT);
   /* May be allocated at isolcpus cmdline parse time */
   if (cpu_isolated_map == NULL) zalloc_cpumask_var(&cpu_isolated_map, GFP_NOWAIT);
   idle_thread_set_boot_cpu();
   set_cpu_rq_start_time(smp_processor_id());
 #endif
   init_sched_fair_class();
   init_schedstats();
   scheduler_running = 1;
 }<sep>@@
expression init_mm;
@@
-       atomic_inc(&init_mm.mm_count);
+       mmgrab(&init_mm);