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 C4479C25B7C for ; Thu, 23 May 2024 02:13:05 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 43D906B0082; Wed, 22 May 2024 22:13:05 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3C4F86B0088; Wed, 22 May 2024 22:13:05 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 265F26B0089; Wed, 22 May 2024 22:13:05 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id F32006B0082 for ; Wed, 22 May 2024 22:13:04 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 959CE1C05A3 for ; Thu, 23 May 2024 02:13:04 +0000 (UTC) X-FDA: 82148037888.01.ECD63C5 Received: from mail-vs1-f45.google.com (mail-vs1-f45.google.com [209.85.217.45]) by imf10.hostedemail.com (Postfix) with ESMTP id CA747C0006 for ; Thu, 23 May 2024 02:13:02 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=HwNa2m2Z; spf=pass (imf10.hostedemail.com: domain of 21cnbao@gmail.com designates 209.85.217.45 as permitted sender) smtp.mailfrom=21cnbao@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1716430382; a=rsa-sha256; cv=none; b=lLSn0Vpypi1lJvy8dx8yMfB0KZd5b0/ey8Zi4awTJG0ddr8KC7XXnDywekw0EMXH/z7O7k jPqbv2SLsrLX5WDsOgHVgyCdA2Qfuxfu/nd34Ne2dn7kDUX4w9ujk39ZiyGvJmJ65Xaxph d1hokS+wHCeYEUJfaVdWMpPnYKJMZww= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=HwNa2m2Z; spf=pass (imf10.hostedemail.com: domain of 21cnbao@gmail.com designates 209.85.217.45 as permitted sender) smtp.mailfrom=21cnbao@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1716430382; 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=X1lMe0BW3zdhy3z9O2IXydLXD1KWR4YUlXDc/mEdmhI=; b=2/mNmoKlweN+28+gBpd8emc/5kJw/KutcHP8oSrEreGadddO+XzXFkxFY2XIodpR5brin6 3ezmI2JeyAhwRDpbRhzpt5XnO1xR7pC32BL8q463jD2+PrpQmIk7BeSXzzlOe0D5ZhjSV+ Qn5n5NT8iykbWew/q7Nr64GQ9T402LI= Received: by mail-vs1-f45.google.com with SMTP id ada2fe7eead31-47ef5a51829so577453137.2 for ; Wed, 22 May 2024 19:13:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716430382; x=1717035182; 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=X1lMe0BW3zdhy3z9O2IXydLXD1KWR4YUlXDc/mEdmhI=; b=HwNa2m2ZnYHOjXr0IDFVrXB5E2i/UEb7P07oX24ocz2/+rTFfXxKBk/9N/o/nXTru/ fNMW4V8IcqYRPQbexpr/5Z12TR+sJlw2X+LA1z87dG24mCshm7B1+iOkn8x4FDqHraGL XkOIiKch65EJGaXbCVZIGNiWC820K7JIFVFI+Y3skaE2BjxG7yDIbsly10fjHrZJJm1J ACfX738v7Ug1OquK4DK86165VBF9BGl7SdVqNsHjzTwBtL16u161ZT8pcJ1fX6ML0aAG CfWL6JBhuwPuv/QzYknOqwxhuCXdVc0WzVduKACO/YNLn2BPMnxuqiohXcBfQ0Nvf/ec +MCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716430382; x=1717035182; 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=X1lMe0BW3zdhy3z9O2IXydLXD1KWR4YUlXDc/mEdmhI=; b=dQX792SXasA5CEkLODq2R7DtSgnPNCsG6QuH1FcLifodcOvseUm0zavCyjUH4PF20H TUPgn5i5c03OiUPaAJg+RuWD0ZKvn/FU92lqBHxKUMtag1GTYxq/FOy48InFBp+UhMZe 8SYv2ZT/ghqmIReAr9Mln0N26751HwVL3CvXhn7zlMuerCMzFaVGIrFbyHjmiCKLx6Lf z5rlGQ1hYRhRJbS57ywxzoBAwPCt0wjtInU+pkSi2Ef7sdnOicmOKO59YkG47Gi3dZUc /l1GfqQnn1OrRT4GTZLxsgcTA3lZVY/cmbGigKtcMsl/kbYNtks3YItAaY/FkiKZMto3 GfoA== X-Forwarded-Encrypted: i=1; AJvYcCVYJqGpLrDScbeDd/cxs9OaMcJE46NfAXa50bcse63R//0ZPJcQBsL2W79Vl73VeezIcgynWgc72D8ufv8dq+5nrZk= X-Gm-Message-State: AOJu0YynbyYXEHcOVIaYKPdSpb3GzxTyYWiAPH9osR7x9F5aS+m+Si2Y lMajkmlb3imOjeMO+K85PuMM1+s8t6fxgmSCTCqFEiEHVKQI5Iiv++bEHHx43DTtVduSPhc0pN4 nK/W4SrvKdkgGlCyqO1eIo7tbcAQ= X-Google-Smtp-Source: AGHT+IErkUXRES85a2bRgpqDt3Wexpr/W6CJgPc1CpxJihpy/ZFuGZkfSevk7hBeUKzryVCzkej6/WFM5RoE96X3i6o= X-Received: by 2002:a05:6102:3f44:b0:47e:f2ea:f673 with SMTP id ada2fe7eead31-4890a275124mr4493024137.23.1716430381785; Wed, 22 May 2024 19:13:01 -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> <875xv5ba8t.fsf@yhuang6-desk2.ccr.corp.intel.com> <18aa865a-6d4a-4dcf-99ce-bcfbc0c92f19@linux.alibaba.com> In-Reply-To: <18aa865a-6d4a-4dcf-99ce-bcfbc0c92f19@linux.alibaba.com> From: Barry Song <21cnbao@gmail.com> Date: Thu, 23 May 2024 14:12:50 +1200 Message-ID: Subject: Re: [PATCH] mm: drop the 'anon_' prefix for swap-out mTHP counters To: Baolin Wang Cc: "Huang, Ying" , David Hildenbrand , akpm@linux-foundation.org, willy@infradead.org, 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-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: CA747C0006 X-Stat-Signature: t8z44n8i5ptkhkky1d8bzg1q8phcwz1s X-HE-Tag: 1716430382-735886 X-HE-Meta: U2FsdGVkX19CjOLXIIVQZax6uLZRZpyWBygjYLhOTWCwpZNEfY8IZ/MRrFS79u7dJTV/+Vd/DIa/4BrDWXd3xEcK2kNF2laIgFRxvNRfNo/TtwmI1hvP5yR3JAB509JqQhy886JJolIxdg92+z4ou0g7mOXZcVymaU+CpCrYmUWZCga/23+ubDWd2GAk8yLayUq1QttZqBqDkv8NAx/rDT7ei/hsneeZTxXNs170xjGXELirc7G2f1beISka/HiBH8ylsbQvOY/opAoaKMPQ+1AOVcBwD8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/vmsknQl/JDtbbWuGSmxutUbPBchDZ7WU8KQI5hCH3NwItOrEgn5GS/Ibi8PWkzY51oubpwQa+4E4JG+onrw73p4PPDnS3mawFEhzCwcI9MqF8akcf6CKUfswdDVOmT7i6fOdCrgaqK2czbj8T9fxiIGPeHhkt1aVsTt0KKdXg41U8dYkf6VjGnff0K6f3y0k X-Bogosity: Ham, tests=bogofilter, spamicity=0.000004, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Thu, May 23, 2024 at 1:38=E2=80=AFPM Baolin Wang wrote: > > > > On 2024/5/23 09:14, Huang, Ying wrote: > > Barry Song <21cnbao@gmail.com> writes: > > > >> 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 s= wap > >>>>> 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 = the > >>>> interaction with shmem? At least I remember some discussion around t= hat. > >>> > >>> Do you mean the shmem mTHP allocation counters in previous > >>> discussion[1]? But for 'anon_swpout' and 'anon_swpout_fallback', I ca= n > >>> 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@redha= t.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. > >> > >> 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 thoug= h we > >> always split them. > > > > IIUC, "fallback" means you try to do something, but fail, so try > > something else as fallback. If so, then we don't need to count > > splitting shmem large folio as fallback. > > Agree. In additon, IIUC we have never counted splitting shmem large > folio as THP_SWPOUT_FALLBACK before or after this patch. Hi Baolin, My point is that THP_SWPOUT* has been dedicated to anonymous memory for yea= rs because we have not had the capability to perform THP_SWPOUT for shared mem= ory before. This is the historical context of thp_swpout* in /proc/vmstat, even though it is not ideal. Therefore, placing shmem sysfs entries in /sys/kernel/mm/transparent_hugepage/hugepages-2048kB/stats allows us to monitor SWPOUT and SWPOUT FALLBACK for shmem without altering the tradition of /proc/vmstat. But I am not firm on this because I don't see the necessity to differentiate shmem's swpout from anon's swpout. They basically seem the same while anon mTHP faults might be significantly different from file mTHP faults, in which cas= e we must distinguish them. So please send version 2 with the updated documentat= ion. I believe it should target v6.10-rc rather than v6.11 to avoid ABI conflicts if it is accepted. > > > For example, before commit 5ed890ce5147 ("mm: vmscan: avoid split durin= g > > shrink_folio_list()"), if folio_entire_mapcount() =3D=3D 0, we will spl= it > > the THP. But we will not count it as "fallback" because we haven't > > tried to swap it out as a whole. Thanks Barry