• KAMEZAWA Hiroyuki's avatar
    memcg: fix css_id() RCU locking for real · 7f0f1546
    KAMEZAWA Hiroyuki authored
    Commit ad4ba375 ("memcg: css_id() must be
    called under rcu_read_lock()") modifies memcontol.c for fixing RCU check
    message.  But Andrew Morton pointed out that the fix doesn't seems sane
    and it was just for hidining lockdep messages.
    
    This is a patch for do proper things.  Checking again, all places,
    accessing without rcu_read_lock, that commit fixies was intentional....
    all callers of css_id() has reference count on it.  So, it's not necessary
    to be under rcu_read_lock().
    
    Considering again, we can use rcu_dereference_check for css_id().  We know
    css->id is valid if css->refcnt > 0.  (css->id never changes and freed
    after css->refcnt going to be 0.)
    
    This patch makes use of rcu_dereference_check() in css_id/depth and remove
    unnecessary rcu-read-lock added by the commit.
    Signed-off-by: default avatarKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
    Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
    Cc: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
    Cc: Balbir Singh <balbir@linux.vnet.ibm.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    7f0f1546
cgroup.c 126 KB