mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-24 17:23:25 -05:00
cgroup, memcg, writeback: drop spurious rcu locking around mem_cgroup_css_from_page()
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>
This commit is contained in:
parent
6f8d2b8a26
commit
654a0dd095
2 changed files with 0 additions and 5 deletions
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue