]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
cgroup, memcg, writeback: drop spurious rcu locking around mem_cgroup_css_from_page()
authorTejun Heo <tj@kernel.org>
Sat, 16 Jan 2016 00:57:16 +0000 (16:57 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 16 Jan 2016 01:56:32 +0000 (17:56 -0800)
In earlier versions, mem_cgroup_css_from_page() could return non-root
css on a legacy hierarchy which can go away and required rcu locking;
however, the eventual version simply returns the root cgroup if memcg is
on a legacy hierarchy and thus doesn't need rcu locking around or in it.
Remove spurious rcu lockings.

Signed-off-by: Tejun Heo <tj@kernel.org>
Reported-by: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Vladimir Davydov <vdavydov@virtuozzo.com>
Cc: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/fs-writeback.c
mm/memcontrol.c

index 023f6a1f23cd034810aa26acde809cde118841f2..6915c950e6e8aeefb7c6162e7e7410de98f4e309 100644 (file)
@@ -677,9 +677,7 @@ void wbc_account_io(struct writeback_control *wbc, struct page *page,
        if (!wbc->wb)
                return;
 
-       rcu_read_lock();
        id = mem_cgroup_css_from_page(page)->id;
-       rcu_read_unlock();
 
        if (id == wbc->wb_id) {
                wbc->wb_bytes += bytes;
index bee6b1c9fdce1d7906d87e353ffb106ad9b61d02..23d8cf5a86c30c9407def299e3088895b7c00ebf 100644 (file)
@@ -382,14 +382,11 @@ struct cgroup_subsys_state *mem_cgroup_css_from_page(struct page *page)
 {
        struct mem_cgroup *memcg;
 
-       rcu_read_lock();
-
        memcg = page->mem_cgroup;
 
        if (!memcg || !cgroup_subsys_on_dfl(memory_cgrp_subsys))
                memcg = root_mem_cgroup;
 
-       rcu_read_unlock();
        return &memcg->css;
 }