Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp2502432rwa; Mon, 22 Aug 2022 08:41:38 -0700 (PDT) X-Google-Smtp-Source: AA6agR62OwOmpBwpm+0WpX1JhkL1SLTGZrHW0hI2jrmagCI4tfup/TW6iIlS3NtevcG9VBTWYztr X-Received: by 2002:a17:902:e94c:b0:171:3df0:c886 with SMTP id b12-20020a170902e94c00b001713df0c886mr21076884pll.39.1661182897975; Mon, 22 Aug 2022 08:41:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661182897; cv=none; d=google.com; s=arc-20160816; b=LR/uPKBGfB11eA0oZGv/am20FohauJkCns9CUrNOHAjpOhXCnFIJmcyWQge7U0mMsi 5atc+7fnkGgSTDmg09WHs9D22lEHF+dHaYiveyIQUBJz+9chNlXbmqV3MK4rkXIiJv/n liTukFI3fQujM2WvmoFQP7yZh3w7Jef/p8yuf+dqAAQFuqieNrjoLPV9zcT2k/wnQ1sK PiNwloAWHUlB1zAX+kIMzJSSJwNUKZaK026k9P3UE6LYxfEXl2/TSR4W4e5ChYiKgC5z B3CXE6xfvHYAuhk3YHq93bFp97900elMgyeJ4UnX40Aein6jAZPcG/4kauRJuY95sO/7 lyHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Ko/ZbbYlRZVDcCBDACh47r5MpCi7V/QJtzGfx/uTT4o=; b=FSSKuD+3jXUJwpxFxUTvrmTgYO/RboK8xVQ9TKyElexlU2ADGHYUxUa/I5wRMMMZaU cw7UVLvszcx/QijIbRGePxpCJ/x6aq2AlGeGd49TZlC9O6QXHFdG/p+jQAvNaK1PyO+w 2X41fZ2CA+D8GEz/nzQMLo1YXFgcezObUMDd9ZlOrqBlvMV+wQF+pmXW+D/a1PQBePPf 91GIgGJup2/4t4rAy8NVUFKpEdaTbLSbJnDQsyrrG3UitQMRjhUAOfbFnhmrCAKIt15B iYZjZsoigtdCrBmjzSrvKTUoEigpRSV8yJOXHlS8HcDqbkD6hftfZHlpQerBvI4Gp02Z i6OA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=AXWrARvl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p8-20020a1709026b8800b0016f09d4e90esi3697845plk.294.2022.08.22.08.41.26; Mon, 22 Aug 2022 08:41:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=AXWrARvl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236466AbiHVPXW (ORCPT + 99 others); Mon, 22 Aug 2022 11:23:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55588 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236482AbiHVPV7 (ORCPT ); Mon, 22 Aug 2022 11:21:59 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B86863E767; Mon, 22 Aug 2022 08:15:10 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 9F132202FF; Mon, 22 Aug 2022 15:15:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1661181308; h=from:from:reply-to: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=Ko/ZbbYlRZVDcCBDACh47r5MpCi7V/QJtzGfx/uTT4o=; b=AXWrARvl88HySuV2IvKZojEAAxu+6WFr21jizwVhd03l87uhLlzEhtWF1q5t+tYCKFoU1r zhU9Xf5P/O2u82zIGY3fhc2PPA5D+bx5XJNxv1WYALMnAhhLQVdq10YN3QdYT/wpkS5CBR HnhzLzMG9IccwSBFROGrZYIj9DWOx1g= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 6F85F1332D; Mon, 22 Aug 2022 15:15:08 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id U/SfGHydA2PFEwAAMHmgww (envelope-from ); Mon, 22 Aug 2022 15:15:08 +0000 Date: Mon, 22 Aug 2022 17:15:07 +0200 From: Michal Hocko To: Shakeel Butt Cc: Johannes Weiner , Roman Gushchin , 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-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. -- Michal Hocko SUSE Labs