From patchwork Tue Apr 23 05:23:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shakeel Butt X-Patchwork-Id: 13639358 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0A466C4345F for ; Tue, 23 Apr 2024 05:23:52 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9314F6B00BE; Tue, 23 Apr 2024 01:23:51 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8E17A6B00BF; Tue, 23 Apr 2024 01:23:51 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7F8A56B00C0; Tue, 23 Apr 2024 01:23:51 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 5F5C06B00BE for ; Tue, 23 Apr 2024 01:23:51 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id EBAC614025D for ; Tue, 23 Apr 2024 05:23:50 +0000 (UTC) X-FDA: 82039654620.19.705F351 Received: from out-180.mta0.migadu.com (out-180.mta0.migadu.com [91.218.175.180]) by imf19.hostedemail.com (Postfix) with ESMTP id 3EA1A1A000B for ; Tue, 23 Apr 2024 05:23:49 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=OvsiSo2V; spf=pass (imf19.hostedemail.com: domain of shakeel.butt@linux.dev designates 91.218.175.180 as permitted sender) smtp.mailfrom=shakeel.butt@linux.dev; dmarc=pass (policy=none) header.from=linux.dev ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1713849829; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=7wZMRsMyHQHXjFKrcDnWCD1NMGczgsTlPNC9ZrGXAJ8=; b=W5CSsyKe4MIlTnkOrQ6b2iYq0bRSknkigSybbY/lXZjpo65CkhgzIdJ3a1qEzNSGffQsgt 8fD5/Np2zwh9G5d0/F3n5lpkXcNKNz1F7hQmT4p/tpncT/Gft8WiU9W+uPJpSbV7IvAROY XSgGtO/A0bd6asuIw0akjCJU/RkFKG8= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1713849829; a=rsa-sha256; cv=none; b=FYZ/WKp/98TOtYZ0YqzsGSl6jclxLzMWSh+2VdqaYlzKuLRuWSgiEB2vujp/x47pozqjZr m6NERzYLtjxB87RqDHWnwX5lLo6l96hXEHcqTYaC8atJ6gs5Z6orO/4NWxKoDw+iuBgozg gd76Ar+aGwEXKO7z133IeiYK/8Iy7RA= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=OvsiSo2V; spf=pass (imf19.hostedemail.com: domain of shakeel.butt@linux.dev designates 91.218.175.180 as permitted sender) smtp.mailfrom=shakeel.butt@linux.dev; dmarc=pass (policy=none) header.from=linux.dev X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1713849827; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7wZMRsMyHQHXjFKrcDnWCD1NMGczgsTlPNC9ZrGXAJ8=; b=OvsiSo2VciEz80V+ECLlsVWhu9VrKAZMMiT5JyhaIJpiJCaRlCFNPBSSnIM/oQ0A13NJ6j Q0M6ktSc75eUe/FEsbEGO8Xw0LzcxsIBnDqZmgTIXd3X28/O0v+b8GHm92PPzMRnAkJ0U6 /BuPKk6hpDPgJz/MbeeRSvhhJ5MUOLI= From: Shakeel Butt To: Andrew Morton , Johannes Weiner , Michal Hocko , Roman Gushchin , Muchun Song Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/4] memcg: restrict __mod_memcg_lruvec_state to memcg stats Date: Mon, 22 Apr 2024 22:23:43 -0700 Message-ID: <20240423052343.811563-1-shakeel.butt@linux.dev> In-Reply-To: <20240423051826.791934-1-shakeel.butt@linux.dev> References: <20240423051826.791934-1-shakeel.butt@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 3EA1A1A000B X-Rspam-User: X-Stat-Signature: ri4ch78tcybtogmf59dq5dt64zbuao68 X-HE-Tag: 1713849829-291192 X-HE-Meta: U2FsdGVkX18ISl58GNvfrOvP6Ji+rEWriJnoZBd/UAmnAmokr3i3SqS0EchFItTYWHwhlt4ati2X8nvGaECr0aRkjiLfI3d0dBjjjHIoj7bY3DLBXWK8W/+yuHbz/0Vo3wYn7ARgOTQTcn335W/V8BkLehgH4fLdzlz1iAK/BfkUudj5s1KGbNJL6FCJ6E3AeAoCD/3qMLTbjVE6QFcCvNtH2jWWB7Y/mGpZ5BhUJbcFUq7Ai+yBYHQexTjDS5VogUG3v11QrJgc9cexgA09lTPdb58yPVjdbzNDu2L2hf8ik8gyQWe9OLay+cEF16u/gT+4MyE0DxjBHnODmWk3Cc6lol0iT9T5DKjGnEhhbxqLIx9QIutNvPu9MvSmewwpjgzLTST0VBTVOBDbMPnu4ILwOIMA3JCvOqnwxG2A3IMyOGUt5OoAhAXS10xkysxtLBbdaNoKstyQr7zcssmQTY8YZZYTkvpj8GWO9QTFcnXfj0y5EoxPzAaC026YK6MoaJBsmMT9uLIZE1QxBptQ5U/RJU89tX+tUjoEPm+ul4nsElo7nGFDeFxhb4oRfDFxDV/EiE5GkZ7ha+vwac2ZVo4XcKbpRv5dCQqN05RaPlZdmNb3lsdaZpKlvbC2OpQG6zZoFDdhsy7Jno24BUPK1l7dawlekC4dV2bjVJxja3Wr7PDdhiVC95aCOqaRvlZBFLajQkYCy8YKCLWv3/8LSA0j/rGNbehDnCAJ5fwpCP3Wi/Remesweqvdop7KP1kmWSn96X3MXHY9YT/DGBr4Z0BGuKMd1R1e7Q9YqC+mtHR5bOXcfJniN55SzwoMbq/c4e4jXA9uNEZPRGVo2gIsUCp7wElpdNBuF+fFKEi5pwtm4uCPyRjr2wCBsy4/oH/zQBZj9kIAHAuDmfwfjJ68PG1YuxvH9r5aRXNLC/VGj4lZFPF9BQokLrWBJMN/nbmHbdfTQlLvR+3mbEyUlno SCHrY/jq 6RyYK7YooGIuuyuuyvc/LgsDIwIpaL+a0tZuuhzc72uDUQgsLExj6BH9+525wlZDYsp2rT8po6zV15fdnt1YNXZ5xwKcJBAOe/n4vmMAca1RSXWilRtUZ2eBjrPLa/OQoGx0/ 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: List-Subscribe: List-Unsubscribe: Currently __mod_memcg_lruvec_state takes enum node_stat_item as a parameter and enum node_stat_item contains both memcg and non-memcg stats but __mod_memcg_lruvec_state can only handle the memcg stats, so simply only call __mod_memcg_lruvec_state for memcg stats. Signed-off-by: Shakeel Butt --- mm/memcontrol.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 4e991e913393..531b6ff711c7 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -860,8 +860,6 @@ static void __mod_memcg_lruvec_state(struct lruvec *lruvec, case NR_ANON_MAPPED: case NR_FILE_MAPPED: case NR_ANON_THPS: - case NR_SHMEM_PMDMAPPED: - case NR_FILE_PMDMAPPED: if (WARN_ON_ONCE(!in_task())) pr_warn("stat item index: %d\n", idx); break; @@ -899,7 +897,7 @@ void __mod_lruvec_state(struct lruvec *lruvec, enum node_stat_item idx, __mod_node_page_state(lruvec_pgdat(lruvec), idx, val); /* Update memcg and lruvec */ - if (!mem_cgroup_disabled()) + if (!mem_cgroup_disabled() && idx < NR_VM_NODE_MEMCG_STAT_ITEMS) __mod_memcg_lruvec_state(lruvec, idx, val); }