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. */