Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp6074826pxv; Thu, 29 Jul 2021 06:00:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyQNywhnQhr9/OlCTQulOo5zaX7xF4FRhUsUfYLG9gU2bAcRz18jFYjlbMgSWI6Wg62GSgE X-Received: by 2002:a17:906:c1da:: with SMTP id bw26mr4484159ejb.253.1627563656790; Thu, 29 Jul 2021 06:00:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627563656; cv=none; d=google.com; s=arc-20160816; b=cUAFGmOqRb6Qy7ET3u0TI9AhcHgPU6GFMjCCQtl7kYaLoxsdGsRlymqnw5z3K6oU+m euachmalxYgLZm+LlbXAOLT36KhpkYQ1Ls1UGQRR+SgHLzKb6dzxDVA90d/M/mj3XfL3 7pPuWIyxqL/nuC7Pp9ulia2c6uoJlAGkNmv58e+CwcdZbYlDwvrF6swUyeWkx8F4q3of 0T14/Uy/6mMq1ldQnxzpmvxJ+LBJNOAPd/TYR2W6TSQKLRKw5y83mfFIK0BdG1JFRW66 n+bqMb7UWJJrw5SwM82CQWRzhdbfSH+/seKvgbW1zb+iNNhtQBeeL/7Qq0qYIUmNxZU1 JXCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=Ss4yONcZnw0N2HAq1G7qlRcsfMp4BrGgPJoxWDb2j2w=; b=o7ljuK9lVSluauRU6PN5f0GayUU8f9tRurHeiwYCNeIDLKiqW8jrPXK6IZkUdwr/a9 Kn+HI4c7t1+n4dZ62X01hAwUQaYfPjCVQIipqT0nzntF2Nv9LNikkm/I1uePoq8/Wcyz UwQf6QV0QQr9rIaNe8cqCyuH8qwgSZaegwsDHVN9O8oAU6rX5YjdrjUEHPz1NjyZQT9Z xKM6V8ekzoQgtov6qcltRiJSxQzbHF5br0K3cLh1vG0Vf+2xb07UCIC6Gc7/Lm3GbZ/D fVVpCHSz4B3YsnkGFCxt7+QCCwUmN+qshb0yDEoS2ytnot4xtLS1OxGvkcAwLtlGN4Nr dZvA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x64si2673383ede.13.2021.07.29.06.00.32; Thu, 29 Jul 2021 06:00:56 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237442AbhG2M6I (ORCPT + 99 others); Thu, 29 Jul 2021 08:58:08 -0400 Received: from szxga08-in.huawei.com ([45.249.212.255]:13212 "EHLO szxga08-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237324AbhG2M6B (ORCPT ); Thu, 29 Jul 2021 08:58:01 -0400 Received: from dggeme703-chm.china.huawei.com (unknown [172.30.72.54]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4Gb9Qm2F9zz1CQLZ; Thu, 29 Jul 2021 20:52:00 +0800 (CST) Received: from huawei.com (10.175.124.27) 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; Thu, 29 Jul 2021 20:57:56 +0800 From: Miaohe Lin To: , , , CC: , , , , , , , , , Subject: [PATCH 5/5] mm, memcg: always call __mod_node_page_state() with preempt disabled Date: Thu, 29 Jul 2021 20:57:55 +0800 Message-ID: <20210729125755.16871-6-linmiaohe@huawei.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20210729125755.16871-1-linmiaohe@huawei.com> References: <20210729125755.16871-1-linmiaohe@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.124.27] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggeme703-chm.china.huawei.com (10.1.199.99) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(); return; } -- 2.23.0