[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <29c4bb2a-ceaf-6c8b-c222-38b30460780f@huawei.com>
Date: Fri, 30 Jul 2021 09:52:20 +0800
From: Miaohe Lin <linmiaohe@...wei.com>
To: Shakeel Butt <shakeelb@...gle.com>
CC: Johannes Weiner <hannes@...xchg.org>,
Michal Hocko <mhocko@...nel.org>,
Vladimir Davydov <vdavydov.dev@...il.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Roman Gushchin <guro@...com>,
Matthew Wilcox <willy@...radead.org>, <alexs@...nel.org>,
Wei Yang <richard.weiyang@...il.com>,
Muchun Song <songmuchun@...edance.com>,
Linux MM <linux-mm@...ck.org>,
LKML <linux-kernel@...r.kernel.org>,
Cgroups <cgroups@...r.kernel.org>
Subject: Re: [PATCH 5/5] mm, memcg: always call __mod_node_page_state() with
preempt disabled
On 2021/7/29 22:39, Shakeel Butt wrote:
> On Thu, Jul 29, 2021 at 5:58 AM Miaohe Lin <linmiaohe@...wei.com> wrote:
>>
>> We should always ensure __mod_node_page_state() is called with preempt
>> disabled or percpu ops may manipulate the wrong cpu when preempt happened.
>>
>> Fixes: b4e0b68fbd9d ("mm: memcontrol: use obj_cgroup APIs to charge kmem pages")
>> Signed-off-by: Miaohe Lin <linmiaohe@...wei.com>
>> ---
>> mm/memcontrol.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
>> index 70a32174e7c4..616d1a72ece3 100644
>> --- a/mm/memcontrol.c
>> +++ b/mm/memcontrol.c
>> @@ -697,8 +697,8 @@ void __mod_lruvec_page_state(struct page *page, enum node_stat_item idx,
>> memcg = page_memcg(head);
>> /* Untracked pages have no memcg, no lruvec. Update only the node */
>> if (!memcg) {
>> - rcu_read_unlock();
>> __mod_node_page_state(pgdat, idx, val);
>> + rcu_read_unlock();
>
> This rcu is for page_memcg. The preemption and interrupts are disabled
> across __mod_lruvec_page_state().
>
I thought it's used to protect __mod_node_page_state(). Looks somewhat confusing for me.
Many thanks for pointing this out!
>> return;
>> }
>>
>> --
>> 2.23.0
>>
> .
>
Powered by blists - more mailing lists