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 4F11DC25B77 for ; Wed, 22 May 2024 12:11:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C54BD6B0088; Wed, 22 May 2024 08:11:48 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C03DC6B0089; Wed, 22 May 2024 08:11:48 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AF2B76B008C; Wed, 22 May 2024 08:11:48 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 91F1D6B0088 for ; Wed, 22 May 2024 08:11:48 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 4718EA2D6F for ; Wed, 22 May 2024 12:11:48 +0000 (UTC) X-FDA: 82145917896.13.A3A9AE9 Received: from mail-ua1-f41.google.com (mail-ua1-f41.google.com [209.85.222.41]) by imf11.hostedemail.com (Postfix) with ESMTP id 607CF4001E for ; Wed, 22 May 2024 12:11:45 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=TF9zTOYt; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf11.hostedemail.com: domain of refault0@gmail.com designates 209.85.222.41 as permitted sender) smtp.mailfrom=refault0@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1716379905; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=TrO1EgX+XFaaM20QiGf+71AFWvOpo9n0VTGIHy7U0I0=; b=VSzzCm5IkOixcM7UkBjGdv2nHo0RgYixFge5sMQB8zM90NIaD5LFV02DmqfB5r++Q55Kqe aSHPF8Xv+WfrHsD6C7hbMYqNbfAq8Oq4Nu1fIfIfoqr9wV+etjyyd8G6JawQhevnyYfy2L qdNryqoY3psRuiKyLsUdcP8t9k2o3/k= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1716379905; a=rsa-sha256; cv=none; b=esg1vQjraHcytv7/zAr9ijk2juHExMCvf89DYY60gNE3hkGvq2M0iKRkDivDQ8HO2TM0pg PMKtDX2zRfErmdaFjk9q/LAmAxbONkej7umS3TSnkTpctNxpUcAZEwZZBBAcwwcUBuD/D6 vYHFmRXkMkDQqB3bVYBV06WI7YBf9FU= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=TF9zTOYt; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf11.hostedemail.com: domain of refault0@gmail.com designates 209.85.222.41 as permitted sender) smtp.mailfrom=refault0@gmail.com Received: by mail-ua1-f41.google.com with SMTP id a1e0cc1a2514c-7fc17895a84so171796241.1 for ; Wed, 22 May 2024 05:11:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716379904; x=1716984704; darn=kvack.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=TrO1EgX+XFaaM20QiGf+71AFWvOpo9n0VTGIHy7U0I0=; b=TF9zTOYtywSbuntk045NNGIjRT30moFVnV7uCjqhOhhaik+ckdpfiFw5v11+wKxEpZ TYWw2ts956Jx5kqDprZ/kgRo8ZDhDOJ/P5o+EsSsLjb1YmuVZ35iUuzxS6dtkcOxLxXM FrjlzVhpu6y4AU1A7wzzKPavBEr9n/yNQGhx6/5aOink0ydab4iH1E6iFhIEDuuXSSE6 DqpmPWesvrpkGmOeHKxrObUymVwTb6ZHB2JIcHE4uHQzj0Hy4PnA1vIPfonUCK1qItIZ NBY4ykss1FrrM1kp5pluVPGR18sJSFdM65xPafYNECgbm/tMACt5OcBRAMWmTqlS/k+8 SRyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716379904; x=1716984704; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=TrO1EgX+XFaaM20QiGf+71AFWvOpo9n0VTGIHy7U0I0=; b=IaeHZQzRPTDE1EMRpfRbwUinau9INaNga3I1eyS01fqVIq7AFLhNyJjPi3PanRyIgK ZQHrNpKcIg82MY/PEaXDUsmooqGhGGEEoXqP5+YvuTySCm836UZnAJ99rTk7TfSlZtta DOvEHXG0n6dGxLWByZ0RWAG2vAwqtrzSc2UeKdbaAe3A0VRPPvE29ksvFRYilwCGiEJt 8dmZ71Db7V08bKjnVmf/r3QcXW9gAByogzoa/8Nxe+B9zI1eoEIHKOkp/4cQ73jgzyK6 BggIU37OwrWVEUXXrs1mfAzBVkLbD5Kt40fl+mQ4XyteXmuAhZkPAXZuO5sGvnQaiQBM KjSA== X-Forwarded-Encrypted: i=1; AJvYcCVlfQa7mSRcB4y9xYbit/WCuIzxdGvUlHb0fPmo3BWCcUmXg9+Rrn2EN7VZ7SHogWjM0ekNLo9s3dmmEG/JihD/opk= X-Gm-Message-State: AOJu0YylvsgJkthFiIQT2d2mnpPuugWDODIDWxrZ3i/5iYyN/SAfnbit uvA2GwrvVbjEa52J2mgOqez476P/cb5VbyffspJWlBqcUCXiLKld//+uzjATiGTBzI8Qn/T2BQE qpxGv1ILfMQQxoFzrVqNvcz3yU74= X-Google-Smtp-Source: AGHT+IFwO+ZoDXwLARMyHWVQfAb49OZrvN7wRZnNt57AXwV3QQdIvuaXg335YcKEA1Hg4A9r1bBfhh+16vSn8iO/z3c= X-Received: by 2002:a05:6122:2b9:b0:4da:9aa1:dd6d with SMTP id 71dfb90a1353d-4e218599ef0mr1763982e0c.1.1716379904260; Wed, 22 May 2024 05:11:44 -0700 (PDT) MIME-Version: 1.0 References: <0e2a6f232e7579a2e4407ecf075531980d97f286.1716367360.git.baolin.wang@linux.alibaba.com> <22ac01a3-ddbb-4114-88cd-ad1a31982dad@redhat.com> <51ba1fc1-fd77-4601-8d27-459162fd008c@linux.alibaba.com> In-Reply-To: From: Lance Yang Date: Wed, 22 May 2024 20:11:33 +0800 Message-ID: Subject: Re: [PATCH] mm: drop the 'anon_' prefix for swap-out mTHP counters To: Baolin Wang Cc: Barry Song <21cnbao@gmail.com>, David Hildenbrand , akpm@linux-foundation.org, willy@infradead.org, ying.huang@intel.com, ryan.roberts@arm.com, ziy@nvidia.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Stat-Signature: smhxngzadigxex5jdhjumejrf6a4sb5x X-Rspamd-Queue-Id: 607CF4001E X-Rspam-User: X-Rspamd-Server: rspam01 X-HE-Tag: 1716379905-980520 X-HE-Meta: U2FsdGVkX1/R+0HWdpj0SxWkXtuu5HmzVj9PEANQZnHQjkApCuPFJ2YVujQCecsbwjWzKf41uPPt3sXzgKr9Dct5hEWGuJ1pRpxVeV0eIsWO85A0CpL8jk+xJnx4UMV9VHM4JrVGs9Mz3VThSxEYgU+8KhW9WLaZ9Li91dOpcaC0JxeyZlm8Tl5pkV//rA0teDOL/iJ2o7yXqtjfrCuhrJRJAid1AjdhVdhVrT158OlWslMqxR0EU1+zRz0YdfLcCziRNRbBgEJPnZ+Dv5r9SOE9dLnI5Twb1xM9jXu2Dd+XbhWWOtp6xs6teqxrPc7qPSZOryx11i4LrULboLBoYEPGKA2pWc6IotKlG8w1pszIZo1oBl+JRJQVUDzgI6w+25Kdrz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KpdyCiFOJ/OSvzkkZ8l/HQWDKr8pGQoWfzr0kdmw/3qP+T6KykkbQ8KFw7xZLIHN4SrfG12bJ0/X2g5EnvJZcXcrRkJpuGolhQoA6gkyVGF/59sKN048tcHa8Ok6uZbP87gxioX0k5Y8nv1m0qFM+hfy0Tnw9nm51WPHddepZhA4uFwgqqHeSRgHNNxnvByi3X3DFsXgkNl4GC6wp25s+w2pbsU2etb4Wq4ut1w== 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: List-Subscribe: List-Unsubscribe: Hi Baolin, On Wed, May 22, 2024 at 7:24=E2=80=AFPM Baolin Wang wrote: > > > > On 2024/5/22 18:40, Barry Song wrote: > > On Wed, May 22, 2024 at 9:38=E2=80=AFPM Baolin Wang > > wrote: > >> > >> > >> > >> On 2024/5/22 16:58, David Hildenbrand wrote: > >>> On 22.05.24 10:51, Baolin Wang wrote: > >>>> The mTHP swap related counters: 'anon_swpout' and > >>>> 'anon_swpout_fallback' are > >>>> confusing with an 'anon_' prefix, since the shmem can swap out > >>>> non-anonymous > >>>> pages. So drop the 'anon_' prefix to keep consistent with the old sw= ap > >>>> counter > >>>> names. > >>>> > >>>> Suggested-by: "Huang, Ying" > >>>> Signed-off-by: Baolin Wang > >>>> --- > >>> > >>> Am I daydreaming or did we add the anon_ for a reason and discussed t= he > >>> interaction with shmem? At least I remember some discussion around th= at. > >> > >> Do you mean the shmem mTHP allocation counters in previous > >> discussion[1]? But for 'anon_swpout' and 'anon_swpout_fallback', I can > >> not find previous discussions that provided a reason for adding the > >> =E2=80=98anon_=E2=80=99 prefix. Barry, any comments? Thanks. > > > > HI Baolin, > > We had tons of emails discussing about namin and I found this email, > > > > https://lore.kernel.org/all/bca6d142-15fd-4af5-9f71-821f891e8305@redhat= .com/ > > > > David had this comment, > > "I'm wondering if these should be ANON specific for now. We might want = to > > add others (shmem, file) in the future." > > > > This is likely how the 'anon_' prefix started being added, although it > > wasn't specifically > > targeting swapout. > > That's what I missed before. Thanks Barry. > > > I sense your patch slightly alters the behavior of thp_swpout_fallback > > in /proc/vmstat. > > Previously, we didn't classify them as THP_SWPOUT_FALLBACK, even though= we > > always split them. > > Sorry I did not get you here. I just re-name the mTHP swpout_fallback, > how can this patch change the THP_SWPOUT_FALLBACK statistic counted by > count_vm_event()? Currently, PMD-mapped shmem folios are not accounted for in THP_SWPOUT and related counters. So, IMO, if we intend to account for them in those counters in the future, removing the 'anon_' prefix from the mTHP swap counters would be reasonable :) Thanks, Lance > > > if (folio_test_anon(folio) && folio_test_swapbacked(fo= lio)) { > > ... > > if (!add_to_swap(folio)) { > > int __maybe_unused order =3D > > folio_order(folio); > > > > if (!folio_test_large(folio)) > > goto activate_locked_s= plit; > > /* Fallback to swap normal pag= es */ > > if (split_folio_to_list(folio, > > folio_list)) > > goto activate_locked; > > #ifdef CONFIG_TRANSPARENT_HUGEPAGE > > if (nr_pages >=3D HPAGE_PMD_NR= ) { > > count_memcg_folio_even= ts(folio, > > THP_SWPOUT_FAL= LBACK, 1); > > > > count_vm_event(THP_SWPOUT_FALLBACK); > > } > > count_mthp_stat(order, > > MTHP_STAT_ANON_SWPOUT_FALLBACK); > > #endif > > if (!add_to_swap(folio)) > > goto activate_locked_s= plit; > > } > > } > > } else if (folio_test_swapbacked(folio) && > > folio_test_large(folio)) { > > /* Split shmem folio */ > > if (split_folio_to_list(folio, folio_list)) > > goto keep_locked; > > } > > > > > > > > If the goal is to incorporate pmd-mapped shmem under thp_swpout* in > > /proc/vmstat, > > and if there is consistency between /proc/vmstat and sys regarding > > their definitions, > > then I have no objection to this patch. > > I think this is the goal, moreover shmem will support large folio (not > only THP) in future, so swpout related counters should be defined as > clear as possible. > > However, shmem_swpout and shmem_swpout_* > > appear more intuitive, given that thp_swpout_* in /proc/vmstat has > > never shown any > > increments for shmem until now - we have been always splitting shmem in= vmscan. > > This is somewhat similar to our previous discussion on the naming of the > shmem's mTHP counter[1], as David suggested, we should keep counter name > consistency for now and add more in the future as needed. > > [1] > https://lore.kernel.org/all/ce6be451-7c5a-402f-8340-be40699829c2@redhat.c= om/ > > > > By the way, if this patch is accepted, it must be included in version > > 6.10 to maintain > > ABI compatibility. Additionally, documentation must be updated accordin= gly. > > Sure. I missed update the documentation, and will do in next version. >