From patchwork Tue Jun 25 00:58:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roman Gushchin X-Patchwork-Id: 13710395 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 1C74DC30659 for ; Tue, 25 Jun 2024 00:59:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 702AA6B034A; Mon, 24 Jun 2024 20:59:33 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6B2A56B034B; Mon, 24 Jun 2024 20:59:33 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4B6526B034C; Mon, 24 Jun 2024 20:59:33 -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 2E5EC6B034A for ; Mon, 24 Jun 2024 20:59:33 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id AE82CA3592 for ; Tue, 25 Jun 2024 00:59:32 +0000 (UTC) X-FDA: 82267602984.02.268E08C Received: from out-188.mta0.migadu.com (out-188.mta0.migadu.com [91.218.175.188]) by imf26.hostedemail.com (Postfix) with ESMTP id 82718140015 for ; Tue, 25 Jun 2024 00:59:30 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=SNHEm2mO; spf=pass (imf26.hostedemail.com: domain of roman.gushchin@linux.dev designates 91.218.175.188 as permitted sender) smtp.mailfrom=roman.gushchin@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=1719277164; 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=0K8TiASsfXHI+86AZ2a2bPWGqGFFcRCb/gQyRRUpsu8=; b=4+V5BYWOpt+6sE2S+TOs74hVBn+29A7rdhgKvehP170l7BiFHWwUuU+lfTdLusxjHZFBBZ V4mGZOKeDazg7uwrLIS8PbBGaGhTYFUISY9/8HwYOZXCxc3GHVz7MAOo/RVuXEa49pT5JR rtYL/xr+U5HFP2XZsHxJgMBUmhrJKMg= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=SNHEm2mO; spf=pass (imf26.hostedemail.com: domain of roman.gushchin@linux.dev designates 91.218.175.188 as permitted sender) smtp.mailfrom=roman.gushchin@linux.dev; dmarc=pass (policy=none) header.from=linux.dev ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1719277164; a=rsa-sha256; cv=none; b=Qh5p73fSbvkvngz0sdvrg2bbJ0HXMIpKmr+Mw4krYY5djgNks/2bDavPVSkeyY5WLvo+K5 VT5FFkn/S/kQvdKM/09zOZnmF8dUBElKAhrAg4EPxI39o4gsNbK9PPngp4QjijzXT9lD6Z tyCXGtquuiK1+/p9uyb2V8bZlUNOtNE= X-Envelope-To: akpm@linux-foundation.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1719277168; 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=0K8TiASsfXHI+86AZ2a2bPWGqGFFcRCb/gQyRRUpsu8=; b=SNHEm2mO/2MBhZOMRXB4XkfaEiY2p+h8mD8OBd4U1zfPiQ3BuKoVwWbf2ski/Cc+TvOfxT QpO01xxRyLiHWa3dG3T+27zaWcaG96hCPF5P1nHpIMrWd4l1kPGh8RycYujNQQJUiVPl5+ uPIKcwxBcy2hngodxGz3SoUlayh91Iw= X-Envelope-To: hannes@cmpxchg.org X-Envelope-To: mhocko@kernel.org X-Envelope-To: shakeel.butt@linux.dev X-Envelope-To: muchun.song@linux.dev X-Envelope-To: linux-kernel@vger.kernel.org X-Envelope-To: cgroups@vger.kernel.org X-Envelope-To: linux-mm@kvack.org X-Envelope-To: roman.gushchin@linux.dev X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Roman Gushchin To: Andrew Morton Cc: Johannes Weiner , Michal Hocko , Shakeel Butt , Muchun Song , linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, linux-mm@kvack.org, Roman Gushchin Subject: [PATCH v2 01/14] mm: memcg: introduce memcontrol-v1.c Date: Mon, 24 Jun 2024 17:58:53 -0700 Message-ID: <20240625005906.106920-2-roman.gushchin@linux.dev> In-Reply-To: <20240625005906.106920-1-roman.gushchin@linux.dev> References: <20240625005906.106920-1-roman.gushchin@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Rspam-User: X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 82718140015 X-Stat-Signature: 8gao7kzemxoej4uxta6gbxy5853xg6od X-HE-Tag: 1719277170-269098 X-HE-Meta: U2FsdGVkX18IR+561HQq56O2nSR4lWu8ClLowot67YcN/0wwZxev4RBEybNL+WOibEeUZ2tjhgsGzgsKZyht3+SxNjiM2zaU1Ar044cmUNkoteA4FQ/nat13nS3MbrxpDothCFfWFxgR5kinAGb53msNRvRkZMoexKTb+ftQ541NKpjapJuYT9C3ikY+RPN2DRs8CYLkA/Y8IfLt0N2Wti8pB7WBbdf+fWX2fTyhDWFiQEEW5P1LqLlAbQJUQsKV27kkNyjDucOTHRRUV9vLYU361u/upButC1bAhmxahucrYvMgKOJTjL987fchjN520jrU8/9rjl0YYn7X1Q6LpDR4fvn8xA/P9NEu59uCNl70tE4942I0xGrZlYMDPlc6BFiuLQptqh99z7eg4NtzpKsTKtwPOCpz96ZGgqW5XybmYqNA9SB2c9H96hhLkWR+e/CHtdPoXY6OR0Q21pvmvrTXj1o/sekvfUiJGQM6RcCwjSn+lrObSnYF5ZRckAl86hcu4BisYRy/sjQC1DKsW0waQsp/58+pVEBPJa5QZcBWoyHDAHXjuhVjNaoBNTiiXYpbg/+e5pM9Qd/YqMoEALRCBigBbheYeyDH8yIvQ2J9K3w/6GrBy+uN2FbcfpDSRPF8JZZK1SxPv8yEArueM8IQN9G3ipFyDz9jpg4aq/mLrsA+HdLVHgBbDzud/HetEhYIkOhdSRbkqN6pB/nWgkKnLJYQVHPasvJBE+JRwy5s8yqbCP1DmvXuKkhkL05+8cWdssh0yRyprYxUigwdksBEUH6Z0TUPM6hePX/5IlwO4im4CqPpoW6E7GFfoAqZRlgSVBmmLP5BkTFnlFp2Nq+06cnUe9bri+3PugoaWal1ZpzvieZDj/UF/EFR0OBJ4/g85q6uVqO4q+uZrhq9kTxPcGWjUIHe0Z+RARaq7lHpNSzlqZv+AJ5hd967l61P9UzEOwFMTBvUEWVjar0 WZQXsPik enbVTofd061haBqFnC0/DHL4zWtWgJjQbg+ejCEMEUxfmWENOSdzkR0pIE3HsPfV1S3J5i79cAQGVsgdOZq1/HZNZN1CfOfF9duqVtAZ9fL60Xxc= 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: This patch introduces the mm/memcontrol-v1.c source file which will be used for all legacy (cgroup v1) memory cgroup code. It also introduces mm/memcontrol-v1.h to keep declarations shared between mm/memcontrol.c and mm/memcontrol-v1.c. As of now, let's compile it if CONFIG_MEMCG is set, similar to mm/memcontrol.c. Later on it can be switched to use a separate config option, so that the legacy code won't be compiled if not required. Signed-off-by: Roman Gushchin Acked-by: Michal Hocko --- mm/Makefile | 3 ++- mm/memcontrol-v1.c | 3 +++ mm/memcontrol-v1.h | 7 +++++++ 3 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 mm/memcontrol-v1.c create mode 100644 mm/memcontrol-v1.h diff --git a/mm/Makefile b/mm/Makefile index 8fb85acda1b1..124d4dea2035 100644 --- a/mm/Makefile +++ b/mm/Makefile @@ -26,6 +26,7 @@ KCOV_INSTRUMENT_page_alloc.o := n KCOV_INSTRUMENT_debug-pagealloc.o := n KCOV_INSTRUMENT_kmemleak.o := n KCOV_INSTRUMENT_memcontrol.o := n +KCOV_INSTRUMENT_memcontrol-v1.o := n KCOV_INSTRUMENT_mmzone.o := n KCOV_INSTRUMENT_vmstat.o := n KCOV_INSTRUMENT_failslab.o := n @@ -95,7 +96,7 @@ obj-$(CONFIG_NUMA) += memory-tiers.o obj-$(CONFIG_DEVICE_MIGRATION) += migrate_device.o obj-$(CONFIG_TRANSPARENT_HUGEPAGE) += huge_memory.o khugepaged.o obj-$(CONFIG_PAGE_COUNTER) += page_counter.o -obj-$(CONFIG_MEMCG) += memcontrol.o vmpressure.o +obj-$(CONFIG_MEMCG) += memcontrol.o memcontrol-v1.o vmpressure.o ifdef CONFIG_SWAP obj-$(CONFIG_MEMCG) += swap_cgroup.o endif diff --git a/mm/memcontrol-v1.c b/mm/memcontrol-v1.c new file mode 100644 index 000000000000..a941446ba575 --- /dev/null +++ b/mm/memcontrol-v1.c @@ -0,0 +1,3 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "memcontrol-v1.h" diff --git a/mm/memcontrol-v1.h b/mm/memcontrol-v1.h new file mode 100644 index 000000000000..7c5f094755ff --- /dev/null +++ b/mm/memcontrol-v1.h @@ -0,0 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#ifndef __MM_MEMCONTROL_V1_H +#define __MM_MEMCONTROL_V1_H + + +#endif /* __MM_MEMCONTROL_V1_H */