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 91CEBC25B77 for ; Wed, 22 May 2024 11:24:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 08B766B008A; Wed, 22 May 2024 07:24:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 03BC66B0092; Wed, 22 May 2024 07:24:54 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E6C5C6B0093; Wed, 22 May 2024 07:24:54 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id C92966B008A for ; Wed, 22 May 2024 07:24:54 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 6571AC022A for ; Wed, 22 May 2024 11:24:54 +0000 (UTC) X-FDA: 82145799708.19.042F8DF Received: from out30-98.freemail.mail.aliyun.com (out30-98.freemail.mail.aliyun.com [115.124.30.98]) by imf17.hostedemail.com (Postfix) with ESMTP id 10AE34001B for ; Wed, 22 May 2024 11:24:50 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=linux.alibaba.com header.s=default header.b="B1egY/XP"; dmarc=pass (policy=none) header.from=linux.alibaba.com; spf=pass (imf17.hostedemail.com: domain of baolin.wang@linux.alibaba.com designates 115.124.30.98 as permitted sender) smtp.mailfrom=baolin.wang@linux.alibaba.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1716377092; 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=FsfoN0B25x/yfr2/PDmpfakYf9XUAtERkvPB+NSPL1M=; b=1Ee+d0DQ2WMecpugimB3+4+zrSqCg9A0F4clJr7x3wPxsdNU0Arp+Wgrx+ElHnr3yVBQuV +L3tTLvfRTR5ugZpIJ2WtfXegmNK+T0AgjowLNtq0+DF7DR2Rrmlr+QZ684+I8zO1cWoO+ j6fcGPqvSaf9Ka3eF/WsCGp+cEr7Vic= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=linux.alibaba.com header.s=default header.b="B1egY/XP"; dmarc=pass (policy=none) header.from=linux.alibaba.com; spf=pass (imf17.hostedemail.com: domain of baolin.wang@linux.alibaba.com designates 115.124.30.98 as permitted sender) smtp.mailfrom=baolin.wang@linux.alibaba.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1716377092; a=rsa-sha256; cv=none; b=K6jkkY0SnDAWesUpfns7zv1pX02iJ69foYRw7bXb+p+DjTcg3f4yT350g+fkJGcr4EotS0 Kx3YSXxmi7j7EjAU4tFWtAr4AaXDW8l0iQpRz+5QEhUTAeXleYZaPAayyaIZASyT7SE9eD uO4fNMfpK129pyZL3UvxZU7MkdbOSJY= DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1716377088; h=Message-ID:Date:MIME-Version:Subject:To:From:Content-Type; bh=FsfoN0B25x/yfr2/PDmpfakYf9XUAtERkvPB+NSPL1M=; b=B1egY/XP1p0UPAo3eT1CHANv/Ew2Sd183XCU7hl3POyKuH6/jfN6s/mFlkkPrpAss0rCoC9xRzYK5V4dv7H+1HwFKeX9o7AStIoiWw8VdxUCuiRsl4BV1tYIeo1nRa19dbn117TBP0uIMI6PTdQo09Ce58M0guWbFbQs4Wf7Dhw= X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R111e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=maildocker-contentspam033022160150;MF=baolin.wang@linux.alibaba.com;NM=1;PH=DS;RN=9;SR=0;TI=SMTPD_---0W7.Qpex_1716377085; Received: from 30.97.56.54(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0W7.Qpex_1716377085) by smtp.aliyun-inc.com; Wed, 22 May 2024 19:24:46 +0800 Message-ID: Date: Wed, 22 May 2024 19:24:45 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] mm: drop the 'anon_' prefix for swap-out mTHP counters To: Barry Song <21cnbao@gmail.com> Cc: 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 References: <0e2a6f232e7579a2e4407ecf075531980d97f286.1716367360.git.baolin.wang@linux.alibaba.com> <22ac01a3-ddbb-4114-88cd-ad1a31982dad@redhat.com> <51ba1fc1-fd77-4601-8d27-459162fd008c@linux.alibaba.com> From: Baolin Wang In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 10AE34001B X-Stat-Signature: u7gasxj8i684dm9xc47h3mrww3k8gewi X-Rspam-User: X-Rspamd-Server: rspam11 X-HE-Tag: 1716377090-844090 X-HE-Meta: U2FsdGVkX1/4Ax/SopeWQP98zgLRCDINdmSqRwrR/xcJKw++5vj0Vn+sGQQSI+HLKl+v5q1GlMyRTS79y+HYPfYikx/J3TEfJUng3lXgAy0ozftg56x8CusuLXhss5O7evrW1/W8T2O/5nFHnY4xoPHV/oHvGPVuci8oDpLJDkFk7YSNHvC1RrJKRRS1QzShKTtlPCzORDMuICQ0TIZlTiy7LyIeKdjqCKwLQbBQFtaYS1PG9DbH/y9q02j+Rc8fMydiKlMFkwENshiU1ebLkgAGmuz0fmQi2tvUMDinQk1ZEk5fHkLdIeTk/mzGSaNcjEQ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w0t+cYzaRMJlKidawgsO8TR/KZCi4v2wUxUA3K60D1a1MuMoWQGtCLp8tyYl92DUCtmgqy7PCMJoZM5VSbzBMKxPdyCfk4cXq37lbsIiKQ295YPsnkkBWhBLkhnreAA== 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: List-Subscribe: List-Unsubscribe: On 2024/5/22 18:40, Barry Song wrote: > On Wed, May 22, 2024 at 9:38 PM 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 swap >>>> 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 that. >> >> 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 >> ‘anon_’ 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()? > if (folio_test_anon(folio) && folio_test_swapbacked(folio)) { > ... > if (!add_to_swap(folio)) { > int __maybe_unused order = > folio_order(folio); > > if (!folio_test_large(folio)) > goto activate_locked_split; > /* Fallback to swap normal pages */ > if (split_folio_to_list(folio, > folio_list)) > goto activate_locked; > #ifdef CONFIG_TRANSPARENT_HUGEPAGE > if (nr_pages >= HPAGE_PMD_NR) { > count_memcg_folio_events(folio, > THP_SWPOUT_FALLBACK, 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_split; > } > } > } 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.com/ > > 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 accordingly. Sure. I missed update the documentation, and will do in next version.