From mboxrd@z Thu Jan 1 00:00:00 1970 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 32C30C28D13 for ; Mon, 22 Aug 2022 18:27:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BA8968D0002; Mon, 22 Aug 2022 14:27:53 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B58478D0001; Mon, 22 Aug 2022 14:27:53 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A46788D0002; Mon, 22 Aug 2022 14:27:53 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 96F748D0001 for ; Mon, 22 Aug 2022 14:27:53 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id EED53AB243 for ; Mon, 22 Aug 2022 18:27:52 +0000 (UTC) X-FDA: 79828062384.21.1D67DA4 Received: from out2.migadu.com (out2.migadu.com [188.165.223.204]) by imf04.hostedemail.com (Postfix) with ESMTP id 38D2F400CB for ; Mon, 22 Aug 2022 18:27:52 +0000 (UTC) Date: Mon, 22 Aug 2022 11:27:46 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1661192870; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=859bRFvYP0PwP1RQEaN1BuNqPudeM49yRCMP2gzbo/M=; b=mCGQi+2b3AdYVcCk9kc+RYKSR5DNMp8IBmyH6G+E69Cq3b2l19KvwGFIuMAQgaZ1ip974E Gfuml2lG4ZQJmNqdc9vHZ1ompfYFjZdFzV0Xj/H73RUciXDYNcSERvs7e3WDbYpIjcVsB1 T0npKZERgo9FQlUXzHgUKV2CBE3OL1Y= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Roman Gushchin To: Shakeel Butt Cc: Michal Hocko , Johannes Weiner , Muchun Song , Michal =?iso-8859-1?Q?Koutn=FD?= , Eric Dumazet , Soheil Hassas Yeganeh , Feng Tang , Oliver Sang , Andrew Morton , lkp@lists.01.org, Cgroups , Linux MM , netdev , LKML Subject: Re: [PATCH 2/3] mm: page_counter: rearrange struct page_counter fields Message-ID: References: <20220822001737.4120417-1-shakeelb@google.com> <20220822001737.4120417-3-shakeelb@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: linux.dev ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1661192872; 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-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=859bRFvYP0PwP1RQEaN1BuNqPudeM49yRCMP2gzbo/M=; b=MeF3h3msRrpFTvpA2NIXyYpP7KBFQQZLPk7BUHbypPtwMOkRUWiN7TS84sIPp/DDCA9NMe NQdWEgrr7+GzcVlKjCPKARur7L0aGXm2VUkkJVZ7dWRMGy+Z63GobubAveoDHyhPyDZwp5 LlvXH9Zdn61i7c1Gz5PjefkVa1ZO56I= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=mCGQi+2b; spf=pass (imf04.hostedemail.com: domain of roman.gushchin@linux.dev designates 188.165.223.204 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=1661192872; a=rsa-sha256; cv=none; b=XqdUywIYbRloEzxivuwOYDNn4VR+a1lXAxozaD7jKuB5LrDigG+fFbjW+znMDe/wmiZF5a eu4D6TA9xlPDSGnAM0u7QwYuctL8dzzwsNDMcLl+td3onBTEiV6Rn7LCMNARqvx1XNBDGK Ksyd5OaMCrbtNtcXBybPCRc3+Ty8Z1E= X-Rspam-User: Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=mCGQi+2b; spf=pass (imf04.hostedemail.com: domain of roman.gushchin@linux.dev designates 188.165.223.204 as permitted sender) smtp.mailfrom=roman.gushchin@linux.dev; dmarc=pass (policy=none) header.from=linux.dev X-Stat-Signature: p766dqcgh3h9zi73tji5hwdtu5c4gcso X-Rspamd-Queue-Id: 38D2F400CB X-Rspamd-Server: rspam08 X-HE-Tag: 1661192872-90321 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: On Mon, Aug 22, 2022 at 09:04:59AM -0700, Shakeel Butt wrote: > On Mon, Aug 22, 2022 at 8:15 AM Michal Hocko wrote: > > > > On Mon 22-08-22 08:06:14, Shakeel Butt wrote: > > [...] > > > > > struct page_counter { > > > > > + /* > > > > > + * Make sure 'usage' does not share cacheline with any other field. The > > > > > + * memcg->memory.usage is a hot member of struct mem_cgroup. > > > > > + */ > > > > > + PC_PADDING(_pad1_); > > > > > > > > Why don't you simply require alignment for the structure? > > > > > > I don't just want the alignment of the structure. I want different > > > fields of this structure to not share the cache line. More > > > specifically the 'high' and 'usage' fields. With this change the usage > > > will be its own cache line, the read-most fields will be on separate > > > cache line and the fields which sometimes get updated on charge path > > > based on some condition will be a different cache line from the > > > previous two. > > > > I do not follow. If you make an explicit requirement for the structure > > alignement then the first field in the structure will be guarantied to > > have that alignement and you achieve the rest to be in the other cache > > line by adding padding behind that. > > Oh, you were talking explicitly about _pad1_, yes, we can remove it > and make the struct cache align. I will do it in the next version. Yes, please, it caught my eyes too. With this change: Acked-by: Roman Gushchin Also, can you, please, include the numbers on the additional memory overhead? I think it still worth it, just think we need to include them for a record. Thanks!