Re: [PATCH] mm/memcontrol: remove the unnecessary rcu_read_[un]lock
From: Michal Hocko
Date: Wed Dec 16 2020 - 02:36:01 EST
On Wed 16-12-20 13:52:13, Hui Su wrote:
> the rcu_read_lock and rcu_read_unlock is unnecessary in:
> lock_page_lruvec()
> lock_page_lruvec_irq()
> lock_page_lruvec_irqsave()
Please add an explanation why it is unnecessary.
> Signed-off-by: Hui Su <sh_def@xxxxxxx>
> ---
> mm/memcontrol.c | 6 ------
> 1 file changed, 6 deletions(-)
>
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index e3c7ca7dc174..a19f820e8a3f 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -1396,10 +1396,8 @@ struct lruvec *lock_page_lruvec(struct page *page)
> struct lruvec *lruvec;
> struct pglist_data *pgdat = page_pgdat(page);
>
> - rcu_read_lock();
> lruvec = mem_cgroup_page_lruvec(page, pgdat);
> spin_lock(&lruvec->lru_lock);
> - rcu_read_unlock();
>
> lruvec_memcg_debug(lruvec, page);
>
> @@ -1411,10 +1409,8 @@ struct lruvec *lock_page_lruvec_irq(struct page *page)
> struct lruvec *lruvec;
> struct pglist_data *pgdat = page_pgdat(page);
>
> - rcu_read_lock();
> lruvec = mem_cgroup_page_lruvec(page, pgdat);
> spin_lock_irq(&lruvec->lru_lock);
> - rcu_read_unlock();
>
> lruvec_memcg_debug(lruvec, page);
>
> @@ -1426,10 +1422,8 @@ struct lruvec *lock_page_lruvec_irqsave(struct page *page, unsigned long *flags)
> struct lruvec *lruvec;
> struct pglist_data *pgdat = page_pgdat(page);
>
> - rcu_read_lock();
> lruvec = mem_cgroup_page_lruvec(page, pgdat);
> spin_lock_irqsave(&lruvec->lru_lock, *flags);
> - rcu_read_unlock();
>
> lruvec_memcg_debug(lruvec, page);
>
> --
> 2.29.2
--
Michal Hocko
SUSE Labs