From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.4 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DC462C4338F for ; Fri, 30 Jul 2021 01:53:26 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 53BD560232 for ; Fri, 30 Jul 2021 01:53:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 53BD560232 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id DCB206B0036; Thu, 29 Jul 2021 21:53:25 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D7B206B005D; Thu, 29 Jul 2021 21:53:25 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C8EFA6B006C; Thu, 29 Jul 2021 21:53:25 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0193.hostedemail.com [216.40.44.193]) by kanga.kvack.org (Postfix) with ESMTP id AC4E56B0036 for ; Thu, 29 Jul 2021 21:53:25 -0400 (EDT) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 4DA1F1802F655 for ; Fri, 30 Jul 2021 01:53:25 +0000 (UTC) X-FDA: 78417581970.22.FF73C96 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf21.hostedemail.com (Postfix) with ESMTP id 7DECED0124AB for ; Fri, 30 Jul 2021 01:52:24 +0000 (UTC) Received: from dggeme703-chm.china.huawei.com (unknown [172.30.72.56]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4GbVfp6W2Cz810M; Fri, 30 Jul 2021 09:48:34 +0800 (CST) Received: from [10.174.178.209] (10.174.178.209) by dggeme703-chm.china.huawei.com (10.1.199.99) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2; Fri, 30 Jul 2021 09:52:20 +0800 Subject: Re: [PATCH 5/5] mm, memcg: always call __mod_node_page_state() with preempt disabled To: Shakeel Butt CC: Johannes Weiner , Michal Hocko , Vladimir Davydov , Andrew Morton , Roman Gushchin , Matthew Wilcox , , Wei Yang , Muchun Song , Linux MM , LKML , Cgroups References: <20210729125755.16871-1-linmiaohe@huawei.com> <20210729125755.16871-6-linmiaohe@huawei.com> From: Miaohe Lin Message-ID: <29c4bb2a-ceaf-6c8b-c222-38b30460780f@huawei.com> Date: Fri, 30 Jul 2021 09:52:20 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.178.209] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggeme703-chm.china.huawei.com (10.1.199.99) X-CFilter-Loop: Reflected X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 7DECED0124AB Authentication-Results: imf21.hostedemail.com; dkim=none; spf=pass (imf21.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com; dmarc=pass (policy=none) header.from=huawei.com X-Stat-Signature: rb31ukfkex98sypcahtymjpifwx5hsq1 X-HE-Tag: 1627609944-688250 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 2021/7/29 22:39, Shakeel Butt wrote: > On Thu, Jul 29, 2021 at 5:58 AM Miaohe Lin 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 >> --- >> 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 >> > . >