Merge branch 'core-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
authorLinus Torvalds <torvalds@linux-foundation.org>
Fri, 7 May 2010 20:58:21 +0000 (13:58 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 7 May 2010 20:58:21 +0000 (13:58 -0700)
* 'core-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
  rcu: create rcu_my_thread_group_empty() wrapper
  memcg: css_id() must be called under rcu_read_lock()
  cgroup: Check task_lock in task_subsys_state()
  sched: Fix an RCU warning in print_task()
  cgroup: Fix an RCU warning in alloc_css_id()
  cgroup: Fix an RCU warning in cgroup_path()
  KEYS: Fix an RCU warning in the reading of user keys
  KEYS: Fix an RCU warning

1  2 
mm/memcontrol.c

diff --combined mm/memcontrol.c
@@@ -811,10 -811,12 +811,12 @@@ int task_in_mem_cgroup(struct task_stru
         * enabled in "curr" and "curr" is a child of "mem" in *cgroup*
         * hierarchy(even if use_hierarchy is disabled in "mem").
         */
+       rcu_read_lock();
        if (mem->use_hierarchy)
                ret = css_is_ancestor(&curr->css, &mem->css);
        else
                ret = (curr == mem);
+       rcu_read_unlock();
        css_put(&curr->css);
        return ret;
  }
@@@ -2312,7 -2314,9 +2314,9 @@@ mem_cgroup_uncharge_swapcache(struct pa
  
        /* record memcg information */
        if (do_swap_account && swapout && memcg) {
+               rcu_read_lock();
                swap_cgroup_record(ent, css_id(&memcg->css));
+               rcu_read_unlock();
                mem_cgroup_get(memcg);
        }
        if (swapout && memcg)
@@@ -2369,8 -2373,10 +2373,10 @@@ static int mem_cgroup_move_swap_account
  {
        unsigned short old_id, new_id;
  
+       rcu_read_lock();
        old_id = css_id(&from->css);
        new_id = css_id(&to->css);
+       rcu_read_unlock();
  
        if (swap_cgroup_cmpxchg(entry, old_id, new_id) == old_id) {
                mem_cgroup_swap_statistics(from, false);
@@@ -2429,11 -2435,11 +2435,11 @@@ int mem_cgroup_prepare_migration(struc
        }
        unlock_page_cgroup(pc);
  
 +      *ptr = mem;
        if (mem) {
 -              ret = __mem_cgroup_try_charge(NULL, GFP_KERNEL, &mem, false);
 +              ret = __mem_cgroup_try_charge(NULL, GFP_KERNEL, ptr, false);
                css_put(&mem->css);
        }
 -      *ptr = mem;
        return ret;
  }
  
@@@ -4038,11 -4044,16 +4044,16 @@@ static int is_target_pte_for_mc(struct 
                        put_page(page);
        }
        /* throught */
-       if (ent.val && do_swap_account && !ret &&
-                       css_id(&mc.from->css) == lookup_swap_cgroup(ent)) {
-               ret = MC_TARGET_SWAP;
-               if (target)
-                       target->ent = ent;
+       if (ent.val && do_swap_account && !ret) {
+               unsigned short id;
+               rcu_read_lock();
+               id = css_id(&mc.from->css);
+               rcu_read_unlock();
+               if (id == lookup_swap_cgroup(ent)) {
+                       ret = MC_TARGET_SWAP;
+                       if (target)
+                               target->ent = ent;
+               }
        }
        return ret;
  }