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 E9DFBC32774 for ; Mon, 22 Aug 2022 16:06:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 57EBC8D0002; Mon, 22 Aug 2022 12:06:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 52DA08D0001; Mon, 22 Aug 2022 12:06:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 41CF08D0002; Mon, 22 Aug 2022 12:06:23 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 33C288D0001 for ; Mon, 22 Aug 2022 12:06:23 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 0B2DA1412DE for ; Mon, 22 Aug 2022 16:06:23 +0000 (UTC) X-FDA: 79827705846.26.20E5FB1 Received: from mail-pg1-f175.google.com (mail-pg1-f175.google.com [209.85.215.175]) by imf05.hostedemail.com (Postfix) with ESMTP id 0B5481002CF for ; Mon, 22 Aug 2022 16:05:11 +0000 (UTC) Received: by mail-pg1-f175.google.com with SMTP id l64so9802149pge.0 for ; Mon, 22 Aug 2022 09:05:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc; bh=Gsdq66BkjynIpRPrwWnOavgdKVDsGQ5+owwtyl9S4wc=; b=FCtgY9iinm8oIY5V3F0fuHisMULPTP8CQ+xh/Bo5Gk3eVocKSH5pJdqM+NrFCk5yNp C/YGEDtKfv2IeT6AmCu73ng/KgcB1e3J6zvGZBDJaQRXHcj3tN23Tv/MhEOscujEMLJ5 xyYk5bpEg2crzlxiekFp9X9OD/yfiaG6k0mDe8aulUmg8Umb7MrkjHZX4pGlK3JTLFNe Ywl56Z7zDPixLCxQT7eP7burucLhwhQBi8Bmc51HtR0S3LB5qkV698CWc9NctsG4DkCE 5U6M+vkFI6nGdhVyAgLZmrPCSAgv732qwe2Dng3VOnpr0ocEVXV6qBHvaBbf6pfIfatM h98g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc; bh=Gsdq66BkjynIpRPrwWnOavgdKVDsGQ5+owwtyl9S4wc=; b=wA9+wUMwXNl06KtFFSmLE6utzsd1p1gVGPFrMN84VciuPb3vAZlMP8XagZLB6/FdiZ 6uEgDNJRhTdriFQUgE/Ff5Bp1+8YS5YwPD+ozHhp4JB64Y1CQsLUdASG4Rl5Y9tqZqKO 2EgePYqLEizbKJ3YjQNxHqwyRR/+AyD/zVBdF4cYezNSj/HyGjwmEVSeQ+IXNCfBFv5T 4Lns1Xj/rzkY/HO4/sA8FRMEE7yTExHqFpzWdGL5G/Ca29MkrycP+SujpNRL73hrO7vB o+05oNhNeolosNxOmRQiNVRRTyWh6yMNUrRvl9rgsQNhU0QOYg65AWiTWz33PrrJ4pjI JAPQ== X-Gm-Message-State: ACgBeo3q+ui4ns3Jj01a/8ivq4QsDDbUlcBHxnNGdXv5UxZLNx7F9Vk8 UQOxFrEXHAIzf4OPRTzxJQXqEcaO7FWnDqROgMrJ4A== X-Google-Smtp-Source: AA6agR6sdwDfhdjqCX6dqJyxJ5ybluZ96v9XhwuPllXX1mMtxZCnsOVM4A+fRNO2CxOVQx85qxZzBP7d5u49kiL0mQY= X-Received: by 2002:a63:5f8e:0:b0:429:c286:4ef7 with SMTP id t136-20020a635f8e000000b00429c2864ef7mr17156340pgb.166.1661184310649; Mon, 22 Aug 2022 09:05:10 -0700 (PDT) MIME-Version: 1.0 References: <20220822001737.4120417-1-shakeelb@google.com> <20220822001737.4120417-3-shakeelb@google.com> In-Reply-To: From: Shakeel Butt Date: Mon, 22 Aug 2022 09:04:59 -0700 Message-ID: Subject: Re: [PATCH 2/3] mm: page_counter: rearrange struct page_counter fields To: Michal Hocko Cc: Johannes Weiner , Roman Gushchin , Muchun Song , =?UTF-8?Q?Michal_Koutn=C3=BD?= , Eric Dumazet , Soheil Hassas Yeganeh , Feng Tang , Oliver Sang , Andrew Morton , lkp@lists.01.org, Cgroups , Linux MM , netdev , LKML Content-Type: text/plain; charset="UTF-8" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1661184312; 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=Gsdq66BkjynIpRPrwWnOavgdKVDsGQ5+owwtyl9S4wc=; b=TSHoNz37eCScmM5buTrxPujVkfsyyc4FOdRzmgn7RHJ9zDFwrV1nwesXwQHkAa4WZdrX2X EMAvqepdsaeURgb10HcX6UZUUDnyWT7s7WgN25Z0CkQial2bmBmPYvve00PX5GzSjploqt /yuTeo/Hkx+vdCD0PIzDw9MslLX0EkM= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=FCtgY9ii; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf05.hostedemail.com: domain of shakeelb@google.com designates 209.85.215.175 as permitted sender) smtp.mailfrom=shakeelb@google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1661184312; a=rsa-sha256; cv=none; b=D43aJXhG+O8BEAq8gwq7isas3sGz2o/ox5IDiknxCAHcalXyFEVPeRfJ01R/ymwkTLHTkg fnk/pwNM42gLedOPRDU5uhmm7mIvUQLmLfgugcJG379dfmei+ctf0lRK8Da1Z7CmiVWxxA 6N6eNfXX+w66aATVCSrMTqgFhpxMiXY= X-Rspamd-Queue-Id: 0B5481002CF X-Rspam-User: Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=FCtgY9ii; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf05.hostedemail.com: domain of shakeelb@google.com designates 209.85.215.175 as permitted sender) smtp.mailfrom=shakeelb@google.com X-Rspamd-Server: rspam03 X-Stat-Signature: eynyczfn3ss4c4o464ts11tu9xfp9aer X-HE-Tag: 1661184311-686042 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000002, 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 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.