Skip to content

Commit f9b1038

Browse files
alexshitorvalds
authored andcommitted
mm/memcg: remove rcu locking for lock_page_lruvec function series
lock_page_lruvec() and its variants used rcu_read_lock() with the intention of safeguarding against the mem_cgroup being destroyed concurrently; but so long as they are called under the specified conditions (as they are), there is no way for the page's mem_cgroup to be destroyed. Delete the unnecessary rcu_read_lock() and _unlock(). Hugh Dickins polished the commit log. Thanks a lot! Link: https://lkml.kernel.org/r/1608614453-10739-2-git-send-email-alex.shi@linux.alibaba.com Signed-off-by: Alex Shi <alex.shi@linux.alibaba.com> Acked-by: Hugh Dickins <hughd@google.com> Cc: Hugh Dickins <hughd@google.com> Cc: Johannes Weiner <hannes@cmpxchg.org> Cc: Michal Hocko <mhocko@kernel.org> Cc: Vladimir Davydov <vdavydov.dev@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent d7e3aba commit f9b1038

File tree

1 file changed

+0
-6
lines changed

1 file changed

+0
-6
lines changed

mm/memcontrol.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1357,10 +1357,8 @@ struct lruvec *lock_page_lruvec(struct page *page)
13571357
struct lruvec *lruvec;
13581358
struct pglist_data *pgdat = page_pgdat(page);
13591359

1360-
rcu_read_lock();
13611360
lruvec = mem_cgroup_page_lruvec(page, pgdat);
13621361
spin_lock(&lruvec->lru_lock);
1363-
rcu_read_unlock();
13641362

13651363
lruvec_memcg_debug(lruvec, page);
13661364

@@ -1372,10 +1370,8 @@ struct lruvec *lock_page_lruvec_irq(struct page *page)
13721370
struct lruvec *lruvec;
13731371
struct pglist_data *pgdat = page_pgdat(page);
13741372

1375-
rcu_read_lock();
13761373
lruvec = mem_cgroup_page_lruvec(page, pgdat);
13771374
spin_lock_irq(&lruvec->lru_lock);
1378-
rcu_read_unlock();
13791375

13801376
lruvec_memcg_debug(lruvec, page);
13811377

@@ -1387,10 +1383,8 @@ struct lruvec *lock_page_lruvec_irqsave(struct page *page, unsigned long *flags)
13871383
struct lruvec *lruvec;
13881384
struct pglist_data *pgdat = page_pgdat(page);
13891385

1390-
rcu_read_lock();
13911386
lruvec = mem_cgroup_page_lruvec(page, pgdat);
13921387
spin_lock_irqsave(&lruvec->lru_lock, *flags);
1393-
rcu_read_unlock();
13941388

13951389
lruvec_memcg_debug(lruvec, page);
13961390

0 commit comments

Comments
 (0)