From nobody Mon Sep 16 19:23:40 2024 Received: from out-176.mta1.migadu.com (out-176.mta1.migadu.com [95.215.58.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6864814D431 for ; Tue, 23 Jul 2024 17:13:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721754800; cv=none; b=WlTW1RYNhpX9KObXHyuEWAG+/oyipebFkndZ87s/MMMJeNNuOAPlxRLtdvXD34p+eSb3rfoAYOSN8CIlVxtMCqRwW/kFTVkNHcMKtRV67xhphtG6qjYcgZW3NsTwIZDvi0tw75vY8g9DFoLWBE6Ppo2mhAQfLBVuNQI8+BxCZj8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721754800; c=relaxed/simple; bh=4paGlhH/Aypyp/LG/X6ZYeFrNUMMuieVYmt0yYwo4EU=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=ZSi6t/bmsXFarkwUKUOWK8gLvLAXXziuHORJR0YY51AXLIyqAGX6LpkCfRSbcU+rhuQRctgJGV77CRh3+WvoHLAYAxdf2Gu+3VnwdGDXYgwk7XYecpDRKYmQbu4PbdYvwYPEEEklBhG3IuOWXdwQVzHFhtuPAVaYnmqUQBfgtHU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=ucsEjwFA; arc=none smtp.client-ip=95.215.58.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="ucsEjwFA" 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" 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 me= m_cgroup_per_node") Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-lkp/202407121335.31a10cb6-oliver.sang@in= tel.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 { =20 /* 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; }; --=20 2.45.2.1089.g2a221341d9-goog