Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp6152750pxv; Thu, 29 Jul 2021 07:43:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxYL+B4DKCyCBcaf9BD626KTlRhcCNb9OPo7KqSEz+rfm7Oiuy312wXOPO4IiV2GH8ihNZP X-Received: by 2002:a17:906:8741:: with SMTP id hj1mr5036550ejb.140.1627569820942; Thu, 29 Jul 2021 07:43:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627569820; cv=none; d=google.com; s=arc-20160816; b=Sb+3OU7kSURM0uRuxa5sX5pVWHkGkkZPKl5TrpkiNQqLT+xN7oY7GudKVEUgMpkXZM RelPdcDsp8RjLba364CIZt6g8Jo3vPq9acyHf7VfShlNlh9mNyoQvO7XhdJfmldN6kRH vmcmW9DOP+QRZxlszY3WevvuIL78TTopwRcH2zlznd1y9n0VkhyDrPdmzpcs1JD4oSyl RaZ8zVanJA2XKXb6WtA/fzBqVrXWR2nrxZ//8rOwbi8YM0XYvA45mRnou94YfAZlFvIp hQ8LVSze39jCVg3L3JH2R7N0RSWWp4LtEEtd66bzohj5eSJPf9VXnEs0dBvkIws+4nYQ Cbcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=pQ+TosWiDAdG8+90eQclOC0l7J20f+GG4ER7QwTBKX8=; b=pC5cbOY1vBHTTNjl1qqabcUUxJVI2DQQoORsj4jcFT9n1IWboOx/qX1kH2H0bCaeZZ sMgNOnMIASuRrWFqkXry18f+44ZfcQeqFPbrlc3hdTIYzrO6HMgbStXjiCQZqPz+Zj8E 5PlMIo9ZgZkRf0cEgv36SofQAdWdI1R0JfZMLLbVUu4OnqkD5GntpKeMBPSAkc+djfvd PupcyVcSCnrPxwNqSFz1B0pnPxWUuY1X8OgFsjTLAnPgJuTpxbt4ZakkvT91TIx9BkZR 4HyQR65uCsHsFCbn3UvhXb6a13Yt8s5vi0+MhDW/iGSoh7Gp6MjEz7Tsz+EylQiayNhH MXxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=R23L4N03; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c8si2797553ede.304.2021.07.29.07.43.17; Thu, 29 Jul 2021 07:43:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=R23L4N03; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236309AbhG2Oja (ORCPT + 99 others); Thu, 29 Jul 2021 10:39:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35666 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236285AbhG2Oj0 (ORCPT ); Thu, 29 Jul 2021 10:39:26 -0400 Received: from mail-lj1-x232.google.com (mail-lj1-x232.google.com [IPv6:2a00:1450:4864:20::232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 77426C061765 for ; Thu, 29 Jul 2021 07:39:22 -0700 (PDT) Received: by mail-lj1-x232.google.com with SMTP id l17so7880761ljn.2 for ; Thu, 29 Jul 2021 07:39:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=pQ+TosWiDAdG8+90eQclOC0l7J20f+GG4ER7QwTBKX8=; b=R23L4N03E0Cp8DvPNPKl1idmWh2CJdaYEmaLa1zbfrqP6vbUf+kVIxIr+waUl74KJ7 Mphdxreoppmm+jRPzPzsh1BxrZm8LVudhznf1T4QIzuK2yPi+akMMez82h2jumMlbVBf S4s7yiBKeS5xYqWyj6/0VB0Gc5h/lkfbSVQ8/wSDflor4uoM7saLwFNOPaGtfgypCOj/ +WIjAxfYsT6tTBO/q53IY7HCwDcgVv78qaKosze2J5wD59XRmrOEtTa4h7EmF5Pf5cK0 nkmiVrgBr2zJPDiZ0MD0JZ5mxei1/97cIXhT5vYsbRVqwrZO7WrhQf5r9ywwwTopzLvU jR6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=pQ+TosWiDAdG8+90eQclOC0l7J20f+GG4ER7QwTBKX8=; b=rVkNYNSXCKB79dApVm8gCOOu6Ke2Nc8aIVTTU7VteeDwCfRyCXlg6xtNC9NQP/8vLK 0Z/u5RCwv7PAiFAQoukBFWypijNJNdc9ZOUBQ412sG/9vewVCaTHca28/sjIc06nw/VK aDdPMxaB3SdauUo8ON27+0VOoHgwPNGb+tEpHIZfJ/5IpddiVpYYBRjvMhmUP0WX1uMu 2vUrSxVBLZAsJCfGs+/ndCjityAYMkCdk4WL+cfeRM8fAWd+AlYNAGr0WjUZvBNA+8LH T3VJy0Kr48b5aRQ0XLfC9cFlA2pQd+QqwZFv7243Pkeqito/NqVdvNrIQW3FHLq8QldX ifYQ== X-Gm-Message-State: AOAM530TQZLWHKgFknmz5/LfJguAZ5Vx/pdaXMtJKCfCSoOoEH6x2KZR xDoy3MKIJCAbPDeX16we7emXWAbffNnbxRNIYecqIg== X-Received: by 2002:a2e:85d7:: with SMTP id h23mr3111083ljj.279.1627569560514; Thu, 29 Jul 2021 07:39:20 -0700 (PDT) MIME-Version: 1.0 References: <20210729125755.16871-1-linmiaohe@huawei.com> <20210729125755.16871-6-linmiaohe@huawei.com> In-Reply-To: <20210729125755.16871-6-linmiaohe@huawei.com> From: Shakeel Butt Date: Thu, 29 Jul 2021 07:39:08 -0700 Message-ID: Subject: Re: [PATCH 5/5] mm, memcg: always call __mod_node_page_state() with preempt disabled To: Miaohe Lin Cc: Johannes Weiner , Michal Hocko , Vladimir Davydov , Andrew Morton , Roman Gushchin , Matthew Wilcox , alexs@kernel.org, Wei Yang , Muchun Song , Linux MM , LKML , Cgroups Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(). > return; > } > > -- > 2.23.0 >