From patchwork Mon Jul 1 18:59:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roman Gushchin X-Patchwork-Id: 13718551 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 753C8C2BD09 for ; Mon, 1 Jul 2024 18:59:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E75ED6B0085; Mon, 1 Jul 2024 14:59:46 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DFE626B0088; Mon, 1 Jul 2024 14:59:46 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C76D46B008A; Mon, 1 Jul 2024 14:59:46 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id A68126B0085 for ; Mon, 1 Jul 2024 14:59:46 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 52536121E45 for ; Mon, 1 Jul 2024 18:59:46 +0000 (UTC) X-FDA: 82292097972.13.E53E6FF Received: from out-181.mta1.migadu.com (out-181.mta1.migadu.com [95.215.58.181]) by imf30.hostedemail.com (Postfix) with ESMTP id AC84780017 for ; Mon, 1 Jul 2024 18:59:42 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=CzfXIpYZ; spf=pass (imf30.hostedemail.com: domain of roman.gushchin@linux.dev designates 95.215.58.181 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=1719860354; 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=Npw8pvNw25Ks7XJp2oW+XVmk4yIUrowgtJPiLL8fvyw=; b=smMpRNgbfT9uNNc9RTcb7b5L5x1i5gdlRDGDSQ74kbuzg05DphPXeGRagcrBVjV1ESUv+C wurbem/DvPVUck6lLIKU3VoYnKXjKb0h5xr5658vh4bFVNv+tQ712H3KV8ibhetOtGXJ3+ m4HEcLr/fkffANIeQgs+FEYTLlGX9lU= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=CzfXIpYZ; spf=pass (imf30.hostedemail.com: domain of roman.gushchin@linux.dev designates 95.215.58.181 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=1719860354; a=rsa-sha256; cv=none; b=sgj2REMg5go0DnACZANmfnQcwmb7teBR8S0zYiK5GSrq54DIW2pBITEt3ycigTg2oOaZBZ rH+//rUTi8sIcc5ngAetrNgto6+W/TUE6ajbfCmxLFfmxxipnrRnqHDPFGFBSbURVN2I4+ KgfGIMOgz6YvIWqPyLLACjh4D1mzdpg= X-Envelope-To: akpm@linux-foundation.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1719860380; 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=Npw8pvNw25Ks7XJp2oW+XVmk4yIUrowgtJPiLL8fvyw=; b=CzfXIpYZM5WBwSRno7JUDjNGOilWl6/wo+Q2Eqc6Bxp+svqQvsID/wz96aaQd34brepaBn OSm70+SCGmuZGWFn+igjN94c554AyDcOb8NCLatSMowjUdjhzH4/XhOWmqmPSX9YbIEca1 SC17iavLKg4a8X3ojigQKDxEuKHXW0I= X-Envelope-To: shakeel.butt@linux.dev 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: 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 , Shakeel Butt Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Johannes Weiner , Michal Hocko , Muchun Song , Roman Gushchin Subject: [PATCH 1/2] mm: memcg: drop obsolete cache line padding in struct mem_cgroup Date: Mon, 1 Jul 2024 18:59:31 +0000 Message-ID: <20240701185932.704807-1-roman.gushchin@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: AC84780017 X-Stat-Signature: 89fnks8srf799aih399qb96j1g3jpkxp X-Rspam-User: X-HE-Tag: 1719860382-684260 X-HE-Meta: U2FsdGVkX19y7yB7YHUMUb2fIWLW/bq3KiDVhBftnZm29oZB4iHcbFfIKGfJqymSOX7k6/DiFUi2uhhvpDcxWfNLJRM4LTquGugQk/BJO2sl3wRFkIwNrRr5N4hbDufNMWnhu08TYqpUdXN4+WFOrHEgQ4R6rYAsgWO8ADNP8AWreoiUi+B7FYxy1Le2VNSf1KCZ8RrgEGeapO7XdCae2xrpS2pidD363L1uzErGCV6e6lAY6tVV76jDw09g7vrfrGFttWUXEF8wnLLzCAq9UrNQR0RvAMYaEr9oVUK8NR71X/xCvduwDxf2N5DUmIQ6X+EDbh8o0P2/Prpx6sq467rv1QCMFzObeUMjbbF4t+yZbs5MBTy2Q+SD2lL9p6W3jv1ElfimihP4wgF1URr94YD83g8kSjEt6ig/BZ9cv0TjcS4mARY/KynJOUYszOv4Fg60A1nFr8a+8C5d64Op9iSiGgrx603T5MLoHS7Y2fM45EFhWPfecJAHertjUF54TnMj2xg0UrH/MxmRrDSmkQq00m0+gWT0FlVo90hO+sAtu4gzWK4GhtiBdi8L5dD4RHVDNSf8PGeyHBLo+RaXEiZhqkaHCFgTPKhPQYS+A/qefPpqHdBO/ibJj5EQmEsuX1Tah5RrwR+9vV03n26Ec73MWFhn3HZnI4jNqBfMpJL7Chjj3ZeVYTo3V4hGMOYWCZpkcAWb0DFccb6i2vzF0sTKZzz9A3KXJaZ546dzSUOQiMloUOcwspv5Ib8+2DC61H+Y4AmcVigSsroLwHLJrXjOHuiaQNDtsinZlun16arHDf/0Lb8B1+D5yifsZq18bCNNIIWZUQYZgrI9VXbURTfk9C/nsB+toWw3XIk7SIvn8HfAD1sRhR1r/wiXMI5ylEfO4meNoG0pDoiEJmPbBhieZXBbaPSEjE7TuBbpgTPW7qJ38cGER/PgAnC6JIRaXfnn8G6uWwYrKFD9yb0 iEWlJ7Ww UDh/AcONbRjLdVdkCLhY0sFa1u2N0nbCRX8nMEJsZbNce0EtMItSrFjzTZDmfbNS3rZqDVE+P0gTZrVqxzLEQCBut/WENFJkaZbMlI948L6kSOlWJjp9Q0ByK1M0pXW9w9duXce6xYQiDX6db1iuUtyqBnNFMrEONv5ie 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: After the grouping of the cgroup v1-related fields and the corresponding reorganization of the struct mem_cgroup, the existing cache line padding doesn't make much sense anymore. Let's drop it for now and put back to new places, if necessary. Suggested-by: Shakeel Butt Signed-off-by: Roman Gushchin Acked-by: Shakeel Butt --- include/linux/memcontrol.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index d0c9365ff039..8b5b3ddeba05 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h @@ -220,8 +220,6 @@ struct mem_cgroup { /* handle for "memory.swap.events" */ struct cgroup_file swap_events_file; - CACHELINE_PADDING(_pad1_); - /* memory.stat */ struct memcg_vmstats *vmstats; @@ -305,8 +303,6 @@ struct mem_cgroup { bool tcpmem_active; int tcpmem_pressure; - CACHELINE_PADDING(_pad2_); - /* * set > 0 if pages under this cgroup are moving to other cgroup. */ From patchwork Mon Jul 1 18:59:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roman Gushchin X-Patchwork-Id: 13718550 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 62D81C3065A for ; Mon, 1 Jul 2024 18:59:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 770E26B0083; Mon, 1 Jul 2024 14:59:46 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6F9746B0085; Mon, 1 Jul 2024 14:59:46 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 572646B0088; Mon, 1 Jul 2024 14:59:46 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 353966B0083 for ; Mon, 1 Jul 2024 14:59:46 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id DE315A4BFC for ; Mon, 1 Jul 2024 18:59:45 +0000 (UTC) X-FDA: 82292097930.23.8DC5FA5 Received: from out-185.mta1.migadu.com (out-185.mta1.migadu.com [95.215.58.185]) by imf22.hostedemail.com (Postfix) with ESMTP id BFDE6C0012 for ; Mon, 1 Jul 2024 18:59:43 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=g+aCSeNT; spf=pass (imf22.hostedemail.com: domain of roman.gushchin@linux.dev designates 95.215.58.185 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=1719860372; a=rsa-sha256; cv=none; b=ROoJx+jklCPrVFGeviwTVFlwiNxwg37UFB+Q3lPS25mkaNkPFithLYbXXXukGV0pH+ikfq v3tlOcq37ZiXMwntk4rszpc9oH4x+7fRRhq+lGbrPBfFh3eGvIy7pP/ei9rt5TxzU5ekqe 0nk3lumt/2D3tkZWEfa5ZZOkxN/j8Vg= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=g+aCSeNT; spf=pass (imf22.hostedemail.com: domain of roman.gushchin@linux.dev designates 95.215.58.185 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=1719860372; 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=smDq7+iTT1okj9ZvP29aA6Rct11y7oIiaW2hKTFwcKY=; b=L/P+FZY+7h+YvSB8C9pxCQYkZYTCIO0GxvM17z8PJCwsQRau3w1K/OqPNmMWo8HYW2miWG XoNRO4sY4ugFMsGdjmuUhFW6rHyOqDMrAyp9zsoCxXHH7IDgom/s7J/VdU3tinTG/qC/Vn HJ4wrcpulwWf+PScg203yQxazdHj6cE= X-Envelope-To: akpm@linux-foundation.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1719860382; 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=smDq7+iTT1okj9ZvP29aA6Rct11y7oIiaW2hKTFwcKY=; b=g+aCSeNThkUPOWTRUWoDOHDKYJhEIhoT1Modh/ERdIQOOU0GCpxLwtpkhZQxAPcacR/vcr cAS/UU3mdgkpx00ba7FYHoelHULHQNTkc7cbhZQqhqmiBrTHofMpawis0RaUIKHdejQvX8 t8d2nrLzCnVUgVTY1u0SNyn3RSRC2Ow= X-Envelope-To: shakeel.butt@linux.dev 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: 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 , Shakeel Butt Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Johannes Weiner , Michal Hocko , Muchun Song , Roman Gushchin Subject: [PATCH 2/2] mm: memcg: add cache line padding to mem_cgroup_per_node Date: Mon, 1 Jul 2024 18:59:32 +0000 Message-ID: <20240701185932.704807-2-roman.gushchin@linux.dev> In-Reply-To: <20240701185932.704807-1-roman.gushchin@linux.dev> References: <20240701185932.704807-1-roman.gushchin@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Stat-Signature: eyc3m6rjfeb4mys6ywydb63nkz8ux8xr X-Rspamd-Queue-Id: BFDE6C0012 X-Rspam-User: X-Rspamd-Server: rspam10 X-HE-Tag: 1719860383-653725 X-HE-Meta: U2FsdGVkX1+LcPTrRe22d3iS8VnGu5+JLlV3xVVttkDaPuySAc81GyegzsWbPRhv2Dz7bPH3z1rBsFoP8byi6cy4jETBpfQCHsGvMnA2JsvcrKqRrOy7yFAauLG0xm5W49KR5VOCXRIFsVR9WrD0GoFtio1aWgpAz3plYo63XqstPnOH/kho+Z+ytSfLukCsmE1dj7nzjIBaY9pT/PG20VcgjMIXpX2LTaiw2C03C5ZDnQj/6GtXkgY+AsAi0IRsk74cJZ9jCPdjd8+5CIdVEnz+2LqIavlqngKUqqZkZORPP32X4yoga5hnKsEka/UUlBKkgU49W+Vxk/6QqROqr+mRAMJtEIsV+eCZWql43GPotq5RRIN6G/Y689T4oYfptEVtjJsCTjj+0Sn+LP3u8wcFoyRJ3m5CJpot+6NdNNar7DS3Z09Z2Mww+euRUUgv4rbecsNe+C7fpi7paJJNcqPE6RN6EJ75dsDI2dS3jUdTQtmEVEBUwE0k6+OagEzrDR6wwNvEmngR3ObddqLsQxr5mRzP+3uGZe1BXE+5mDyIwLsXMfAVWNo/A8FpK8XK9Sddhi8AdAyr6a1wBTHAorP7PRdPfCs2ciHG4cce049C2psOxAqf61dOQ+2HLsojgyzRtPJ6SFeCTflSZqiUH8vImFlgJNeCYuDy5BKNt/e/6IsE+hLEOfLplEgZrcLHwZZpaEk0Winv92ympVuuwTwXTAuXDYFgM6XCfjNpyYryIGyb+rKQpBYVdUXTrheIzYQMiAKzimXdDu3e0zPHcPY0tleGw9YdlfC4tFkPjQahNmroNvNniE2KrE+iBaPJy7Cp6RDvp0V/YguNtdksvTmVHbRDNj7zei2HtqdzpAoRhlxfxM5o5Wti8JC66AOF4QfzChGdfb/FoiQYuPP/mmA8iXtwqj/o1ttJQBsQmriAeA7BRvggg+5w6GLteFSDLkI2Ma+jinZraLGuO0w f8gn5Bgz 5zmbJm9L4mh0KRvivcCccusgDig1oZM1C62kL3OU/KYYN77YKdl023d7l2+uksKs7Xd2o/CHB7tqAqUjSF9jpY3S9UCqZ+8+Ss/SAOD0G6YJAZ4lPi1XwQzl9r6tkbrjW0Fdlx9+Gq+ZG7lVYkx3I80vJfxkMYp7C3cmM 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: Memcg v1-specific fields serve a buffer function between read-mostly and update often parts of the mem_cgroup_per_node structure. If CONFIG_MEMCG_V1 is not set and these fields are not present, an explicit cacheline padding is needed. Suggested-by: Shakeel Butt Signed-off-by: Roman Gushchin Acked-by: Shakeel Butt --- include/linux/memcontrol.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index 8b5b3ddeba05..60418934827c 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h @@ -95,14 +95,16 @@ struct mem_cgroup_per_node { #ifdef CONFIG_MEMCG_V1 /* * Memcg-v1 only stuff in middle as buffer between read mostly fields - * and update often fields to avoid false sharing. Once v1 stuff is - * moved in a separate struct, an explicit padding is needed. + * and update often fields to avoid false sharing. If v1 stuff is + * not present, an explicit padding is needed. */ struct rb_node tree_node; /* RB tree node */ unsigned long usage_in_excess;/* Set to the value by which */ /* the soft limit is exceeded*/ bool on_tree; +#else + CACHELINE_PADDING(_pad1_); #endif /* Fields which get updated often at the end. */