From patchwork Tue Jul 23 17:12:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roman Gushchin X-Patchwork-Id: 13740231 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 35914C3DA49 for ; Tue, 23 Jul 2024 17:13:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9BB676B0082; Tue, 23 Jul 2024 13:13:20 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 973A56B0083; Tue, 23 Jul 2024 13:13:20 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 859CE6B0085; Tue, 23 Jul 2024 13:13:20 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 694216B0082 for ; Tue, 23 Jul 2024 13:13:20 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 1770A1A02ED for ; Tue, 23 Jul 2024 17:13:20 +0000 (UTC) X-FDA: 82371663360.05.B08915E Received: from out-182.mta1.migadu.com (out-182.mta1.migadu.com [95.215.58.182]) by imf12.hostedemail.com (Postfix) with ESMTP id DB02F4001D for ; Tue, 23 Jul 2024 17:13:15 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=ucsEjwFA; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf12.hostedemail.com: domain of roman.gushchin@linux.dev designates 95.215.58.182 as permitted sender) smtp.mailfrom=roman.gushchin@linux.dev ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1721754746; 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=dLz0vahepvw5FTvGG6yOrYP5EjiNPFCxxG6q6oBLdpU=; b=hP+UV6egr6s3Xk7Sok0y4V/dfpemlkZanJU/OH/CdkeepK1XyZVxVRpFhk1dnkRywsnETW ZX5lf3NG3NH785/u3Y+NvgI4tg8vocu/f0B0Q1bgGXWXotRMI+K+8cM7Ql8hiQO/gAkpC3 zd0e8KjCjvLqdCQAp+upblprweWIUKI= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1721754746; a=rsa-sha256; cv=none; b=jEc2u61JiTXs+A5Q4XgeJmt7NcAVRGe7VaO4g5h5Vgn62F+B3FWqd/UEvHdqVqe1i2Htdz CBq/HusAYrLxzUFflJ3qE0UWLzH/bGhYtMVh8Iv08Vebpa4BVEx3bOfRFjSu8Em7vCLORA wcQvKWy0T0a+aHC6FOVVNexkE0Qpmbw= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=ucsEjwFA; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf12.hostedemail.com: domain of roman.gushchin@linux.dev designates 95.215.58.182 as permitted sender) smtp.mailfrom=roman.gushchin@linux.dev X-Envelope-To: akpm@linux-foundation.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1721754792; 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=dLz0vahepvw5FTvGG6yOrYP5EjiNPFCxxG6q6oBLdpU=; b=ucsEjwFAYOrYRoJ7GRVx8yCm1LlZ02eTPQcczoBQmZE2jz3QVYdBG9QyfTVkOx94UItfzT y57GDSTHLu/NOgjkCog7068lgkH9NwbmaT8/zweTTeu8RlF68+0m4fU9HHZME7KS6ZlYTV kMFhy2HpE2xEjQhbRAfDdLQyQJBSUic= 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-Envelope-To: oliver.sang@intel.com 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 , kernel test robot Subject: [PATCH] mm: memcg: add cacheline padding after lruvec in mem_cgroup_per_node Date: Tue, 23 Jul 2024 17:12:44 +0000 Message-ID: <20240723171244.747521-1-roman.gushchin@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: DB02F4001D X-Stat-Signature: jjicpk5d3ejhwjh8texzwtdk35s3qfmx X-Rspam-User: X-HE-Tag: 1721754795-994392 X-HE-Meta: U2FsdGVkX19wnSvNWCcLFirWemhXD+zc1A80oEJcSPIp8ZUt98EsIENh7+tggKIGRbnA2G/Ibw1GDVlns3gT7dvixAsCvVf9T0di0uCBPjEfHHRDT2fqGWV5L7DCfq4kwxa9qvDNfSvUOXXdt2LyQT8Be8csRxf2Ar2eI+lAs+/lWb/1jsQtA2Lb0za3xRsQzP6xlY7gWkh4qvv835jEWHtwN/L5nqP852nHmgkCPme6UM9JImyE5uvm/UAz37NJv/MG2QjF2LY1kR0tTJOzLw/p2fbRUSxbyDIPAdGJ07T39+6MOLZOFjNislqDQDVZEFKpp0mRARWNLSGhXBINA6UFh/ptUfmeombtIpCynqwXskPNmfluhjK0QcWxbGiXHK2FbKXvBhWsAS6dJZ64F+f92Y4GAVJiFlluHO0dBXOgWQrSuZLTsPh0L0mYJeH8xeWx/JeaKMI4QjeptE78JKq9jU3JyecfY0tXFS6YJhcJvvOUvQfyZ3AofitfC+uHpuYfPkd9WuJHoWZpvM0U4S+FZ/2a3ZxxtaHagtReNuJfucpzqY+Uhx+23soiYe7l+V5jqmqYCMdw/rZEMlkrRiL2lR56ndVKDSK+NV2W+a613wgT+qL/tdYuuE2nsBMd/e5xAOlcbh/WrOkK+fZHTCW/l/DjhvWn8PB1qMIWvduONjqLJQQsW32G2WvGbHxFhyggiRSFqXhYoOL3T6DTH2Q8t3UFAgCN1qN7ET6sCaHfDEYyTm2lpspWxI+cW/lgE/Bw9iDFlil+fVtZ+VFeKLxC4R9P5YjaCliFeZUth4JazLjbFCLRkC5nq4JrIxOiUge190ELGnAXbwSDCsbHUepnoXKDbVusnly3sFMu0OzbvH6EyAyEyB8cnhu5+EcneIDMQGVSaWPEM2vAqv4LY3+eDlTPxPgsxbmmgivKLWZNHrumJl2N1HMa9PWAQhX7YqeQDD/4oCSjIsB292V ymEtzqBR bU8/XZwNS7uob4O3QjRCUpr5L/IH9e2xZuxcl6reppm7kjkqpxienxUG5tm6k0ncLJ05ahaHR+zHtjR2FWbTx++/Ooe/+1eCcmd3TSqEEkE70ADBdGFoHXuYeypjHZf16oC2pPocsaykr8nG4eRQ9QdLCr6C29sZFBmjDHnTr55GSsH2wpjVL2j53DogUms3KhgMYrSK4OhofDSMgLzMrOKGPjJeNCjetXLH/WUm083PbG6V7zSbtnvJ5Ng== 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: Oliver Sand reported a performance regression caused by commit 98c9daf5ae6b ("mm: memcg: guard memcg1-specific members of struct mem_cgroup_per_node"), which puts some fields of the mem_cgroup_per_node structure under the CONFIG_MEMCG_V1 config option. Apparently it causes a false cache sharing between lruvec and lru_zone_size members of the structure. Fix it by adding an explicit padding after the lruvec member. Even though the padding is not required with CONFIG_MEMCG_V1 set, it seems like the introduced memory overhead is not significant enough to warrant another divergence in the mem_cgroup_per_node layout, so the padding is added unconditionally. Fixes: 98c9daf5ae6b ("mm: memcg: guard memcg1-specific members of struct mem_cgroup_per_node") Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-lkp/202407121335.31a10cb6-oliver.sang@intel.com Tested-by: Oliver Sang Signed-off-by: Roman Gushchin Acked-by: Shakeel Butt --- include/linux/memcontrol.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index 7e2eb091049a..0e5bf25d324f 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h @@ -109,6 +109,7 @@ struct mem_cgroup_per_node { /* Fields which get updated often at the end. */ struct lruvec lruvec; + CACHELINE_PADDING(_pad2_); unsigned long lru_zone_size[MAX_NR_ZONES][NR_LRU_LISTS]; struct mem_cgroup_reclaim_iter iter; };