From patchwork Fri Jun 28 21:03:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roman Gushchin X-Patchwork-Id: 13716622 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 CEFDEC2BD09 for ; Fri, 28 Jun 2024 21:03:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 583AC6B009D; Fri, 28 Jun 2024 17:03:53 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 532F86B009E; Fri, 28 Jun 2024 17:03:53 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3FC386B009F; Fri, 28 Jun 2024 17:03:53 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 1F2046B009D for ; Fri, 28 Jun 2024 17:03:53 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id CCB651C02FD for ; Fri, 28 Jun 2024 21:03:52 +0000 (UTC) X-FDA: 82281524304.22.0FF3DA1 Received: from out-178.mta1.migadu.com (out-178.mta1.migadu.com [95.215.58.178]) by imf24.hostedemail.com (Postfix) with ESMTP id 90AA3180014 for ; Fri, 28 Jun 2024 21:03:50 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=cgwe8JnE; spf=pass (imf24.hostedemail.com: domain of roman.gushchin@linux.dev designates 95.215.58.178 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=1719608622; 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:references:dkim-signature; bh=UgbnkHx82nflf7HlsUPTfmPWNgaY3AQgPh+QDBth92w=; b=H32UBNu/cqyI+rEtjxiA3RFTSBHc+Cnt4J0Azro2CZBRKWTG9cl5inpBXQY8GJV3klJj4D OD6eXm5jeUzTUwzZHPbkdJuN3icKtgHLsCAP27Z9dhU0pYPIe8GQpQMbWML595oj72E+49 DBbFydWQ7NvTHYdZuPztAdPBP4/XbnU= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=cgwe8JnE; spf=pass (imf24.hostedemail.com: domain of roman.gushchin@linux.dev designates 95.215.58.178 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=1719608622; a=rsa-sha256; cv=none; b=qWOz8Cyfcv4iKmT4J4bwVpXjhS20+PWVjJ1nusowDGQEb6RVgR1o9EFBOqTASnw93p6Qdr C1y0GKX1679tPoSSFppJu0BqrMz4hRb5KoNyj8fWU6u7AkI8oi38qPQQE76bT4I7klvI5q LO4uB9ZVpkZjTmViIM2JNBW9WOc8Ri4= X-Envelope-To: akpm@linux-foundation.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1719608628; 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; bh=UgbnkHx82nflf7HlsUPTfmPWNgaY3AQgPh+QDBth92w=; b=cgwe8JnEU4blDvdwwiVvVRbGuFQkvFfgcEO1UxQSS9ooOq3Ori39dsZ1s5pn8Ilfs30eK9 vL3UUD1o0tttKe1k/v2eMlJERnS1DGPzhvtsOHUXPtFu9QXLfdLRbdPMjQNaWpUhsgBXym u2LWNo2rvzoJpA6KVXLB5tYp3OUYSi4= X-Envelope-To: linux-mm@kvack.org X-Envelope-To: linux-kernel@vger.kernel.org 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: 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: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Johannes Weiner , Michal Hocko , Shakeel Butt , Muchun Song , Roman Gushchin Subject: [PATCH v1 0/9] mm: memcg: put cgroup v1-specific memcg data under CONFIG_MEMCG_V1 Date: Fri, 28 Jun 2024 21:03:08 +0000 Message-ID: <20240628210317.272856-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: 90AA3180014 X-Stat-Signature: b9e76m6pfab5drzapfxkru74typeh7is X-HE-Tag: 1719608630-278167 X-HE-Meta: U2FsdGVkX19i8HGU3Z3nyNCw/g8ET4oIQQ6yUQw6abVu0C65ps6r4p4tbRUPeXXA/Yy+iNhRahK4la6xW0JTk51p7iEmu7JTpS3Ero+z92HpqMF+Owy9h+58g/G+aTxNcEWX/DWWI5wPWVRUDh/GaBOnKC9lIIdhMTjN4vq33CD9Vi5lIw1g3ad9w3bcPR5wQw2Z8IlzhTCShj/YkpnqAUyHsSPZiqWAhdwcYFqpTne82FRRbq/SRLRrx4ZP6WJSVPgcWr4inFz9/07xV9YHEBpovcCN+vbtJb4D0RtDow9/ijkDBYiD4jsw9469uFbn1pLzHW1itCKpm2I3gK32vOmmzABThVekGIr2HwRDus72kTzlxgagluaNdWZ6/hc1C/X7IowzmAcJ7ExZrWcPZVsXgdSlxie1I8O9A5CK3YXivsxgQLdkDcyyXAuPnmT1iwifnlS92gBngodjmwH/K3z2U2xqwcCloJ0rjcM3xIZrLMGFnMIfZDIZhCqNrOg6wJVV/DCyIVNWtEb3r0SAgjN4hhbcg/AzIz8Dx0hT4+99fq9y3SwWbU6bCZsUPTN4l67HHLRrxcbo9Cm862fAUehuT6yw2bHtl8rO6GiuSE4iPlw19/qd/CPxOcwSvEpJPSdWDA2zDE/2/3QMPbP/O3ALTmcgj2M6v5eBx18LSw0DAA3hds2oRAtL+oTxR5ecuSCMtuu3MMmZdTACmDDgW1DuCVS6tkyRxtpDOeO0N6oNW+8SFU9+eUg25pFcWmU5qfD3C7PbeMXiwJFLWroq6NBaE8HmIAUF4SELqmtjReDXu1jgjt/ZHINTQSEZx5dqYcHTfzvdORArphWDWw6IVo8/T21vnachN42ifKQvWPiOEfgQ7LHHWzGNPozvv+suKMgxqfXZcEXfstUzMrtxNH+UBGo0b7f44x81Lt+3eIa90PIah81zspNv+NOXFIDeF0h/JvK8/BMs8Dp/DvV 7LdHBKKh KSqU8PhOlx5IjexQfscjngalJYROgBPoGdmVgW6LE0pfcLL26qVLZUpcbUKWfNJzJvLsV8O7QViyVLSWS9y9p5vCMvP6NHpGxKdn67glhL1+xiktuSlUaujUPIIUJAHkB9bLZUQHFl/YAED+NH/h13hIczQ== 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 patchset puts all cgroup v1's members of struct mem_cgroup, struct mem_cgroup_per_node and struct task_struct under the CONFIG_MEMCG_V1 config option. If cgroup v1 support is not required (and it's true for many cgroup users these days), it allows to save a bit of memory and compile out some code, some of which is on relatively hot paths. It also structures the code a bit better by grouping cgroup v1-specific stuff in one place. Roman Gushchin (9): mm: memcg: move memcg_account_kmem() to memcontrol-v1.c mm: memcg: factor out legacy socket memory accounting code mm: memcg: guard cgroup v1-specific code in mem_cgroup_print_oom_meminfo() mm: memcg: gather memcg1-specific fields initialization in memcg1_memcg_init() mm: memcg: guard memcg1-specific fields accesses in mm/memcontrol.c mm: memcg: put memcg1-specific struct mem_cgroup's members under CONFIG_MEMCG_V1 mm: memcg: guard memcg1-specific members of struct mem_cgroup_per_node mm: memcg: put struct task_struct::memcg_in_oom under CONFIG_MEMCG_V1 mm: memcg: put struct task_struct::in_user_fault under CONFIG_MEMCG_V1 include/linux/memcontrol.h | 147 +++++++++++++++++++------------------ include/linux/sched.h | 6 +- mm/memcontrol-v1.c | 38 ++++++++++ mm/memcontrol-v1.h | 20 +++++ mm/memcontrol.c | 70 +++++++----------- 5 files changed, 164 insertions(+), 117 deletions(-)