Received: by 2002:ab2:7855:0:b0:1f9:5764:f03e with SMTP id m21csp720417lqp; Wed, 22 May 2024 19:13:12 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV+YzuP/z6GhatcDc1M8T7/m6tOqndCBSAtmnocBTQiLI5qdVRhZk1aCDGWEbwCIW4luoQw/q6HVShbk6IBNUsB9a8G90adp4PrVlf86g== X-Google-Smtp-Source: AGHT+IH9eZrKVXSz3vV6vqXyEQCisTWnuRtLY0nbMa3u39tMtsp0br9YBpqBeHx5HKNcl3Jq40YL X-Received: by 2002:ac8:7e92:0:b0:43e:17e6:606f with SMTP id d75a77b69052e-43f9e137176mr38872661cf.67.1716430391839; Wed, 22 May 2024 19:13:11 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716430391; cv=pass; d=google.com; s=arc-20160816; b=Pe1PjgOepDUZoE0h5vioYH/Tf+/nmmXG0H3Sq6EsrYzq8KYQhIh/+j79KFm8Tpp+0Z RzLYZogJZ/mQ0JDSrlbuvpwosOLuccXruXV2BAbUF5h6LUpXxD9+DgTsXrXguRN8wnZF 8lUciS5QijcObE6m0YSvAvdYnEzVa8LbjwV9kMnMv2ceXAKt3gPiuo2KqQtUqsdQpKOU xU+6PGlvkMN6WW+Pqr+9RY6/UNiwXDvE2siEGtHcygkLfOIjm2kaJTHWKl1xtUDyCAdG kXYi5htFE8aZuG16ZTSf2D4f0UFumb0vCSsJT7M6pxgt5tFFWPGeh8ihbE8nvBzwC/mM HIMw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=X1lMe0BW3zdhy3z9O2IXydLXD1KWR4YUlXDc/mEdmhI=; fh=AaI1OiXf7luMoHVXOS/zlbRXGPXA9kHUNLCapuGNf3k=; b=xZ8Whcqgn6Vcng+yaQkPLdtdfT5TnDPPOFzej1JV0yEDcWtzJpotb/Tp5kX4RQL/z4 oEex61quzzOQxXILgdeUWhmp1lDE1pTMOmkUt0HHpWb9XZyCrhM66musdnRafLI4oXVV rWk1qW4vfuJ5DLFoNp667rCHy3cQb4HFkHtc+0AY381NBOcxpMAJfMVx1ieACtJC9YD4 wMKWD9Lut3oCpP1YxsYBeBa1ReuVRtL/TmpBLIu0MHEZTYzRJWNadM9OLmQIrcXnCLX0 FuP2gRUoRUNbxdg+kW8PtZXRRsVDKTfB+mD7rG0kOHedegI8A2L/NIU291+ssDRSy6FV pAWg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=FWCjd5qB; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-186903-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-186903-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id d75a77b69052e-43e3fcf3716si56575571cf.14.2024.05.22.19.13.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 May 2024 19:13:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-186903-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=FWCjd5qB; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-186903-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-186903-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 8183C1C20E86 for ; Thu, 23 May 2024 02:13:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 67EB6469D; Thu, 23 May 2024 02:13:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="FWCjd5qB" Received: from mail-vs1-f48.google.com (mail-vs1-f48.google.com [209.85.217.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F1D294C8C for ; Thu, 23 May 2024 02:13:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.217.48 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716430384; cv=none; b=JFY2X01SQxulr+iuZEm2bHyq0cAXJQsmf9QtHiAxyu2vk16ZUpNHGgL16MzJPyL1suGD9FGh1/HF9Bq+r4/hO06C5ZDdR2rRzX2OgSZaPWWfPqu0lYGAiQUlY0NmB+BdLe0pmAiy/Qlg5c+NhrdhDifc2ST8dU9+ZTEGKCK85ao= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716430384; c=relaxed/simple; bh=Ztd03uGOTEtX6qI8i5/IfRp+ZjhZu3fhnFwlMDr/pOk=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=P6mrjggL/VupURN8gNFW4J4QKWqwqEbvJnyG+fJdUvQMPmbBbwtu9Nx+TNLA7x/PyxjPiZ9V+UjRkaMpnXqR+3A3wj6q2SUsoPLOcJTuzdotSgfvwp0Tf2yjYgB8XTry/aVJER2VHRkQBtaOwTGeZgHmbrjwI4vneyaTaBT7BrA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=FWCjd5qB; arc=none smtp.client-ip=209.85.217.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-vs1-f48.google.com with SMTP id ada2fe7eead31-481e9c27378so553569137.3 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=vger.kernel.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=FWCjd5qB7yquVlCDkZa4zZ1kRBbvfqyzFlJc+oxiv35f3lzxdmUtD15uk+G+/CrD7m kXsDdxL8K6leRrQy7oaUA2aOZrhfG+Jv67W4U4vpn4IwTeb2rUsMfB9FRBrvym1/2dxk FRhMPOg901JHWaCNUoMfPVfCvloh8KBeYK9ZS1O6qN9tAtz7oMg0xw+aZ7Y/HQ4HmjyZ 1/hKyy12571ws0rAyQfPPhDOlJbpfFvrwb7LbhvdjIOTdGhD2cJs31PDTcRi/gB/9fLN 5b6OAG9tuRuw7hJg0HC4Puqi9noRAGMN9QbGzUcD59Dh8VRWnkBFVGBGNxbpBRyGROH5 GfTA== 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=ews3nmIW7uI2Q7KuMYRImvIbWDBeFsXdyCShhp0UM7ruU3WazdbjsmW2UJPHqCggp+ TCgchKwEaTaW92/ncp/ECipQ4KGTc2fbdPcJGpVYQknjMpWSbkpCijiMrMFu7xk6g/SG qGZPKBgy99N/tyGk18SI91JXMDSBbdLIW3UPfwSltI0VcVbqS3odcBgtwPayMcs6NjyR WjDfZXYaOo/HNNRdUJbeQkjl+sLDKhbgpD/AxT3TCBvF86foCyA+A2bq4q24GPERI3+M Uh+ZMyygxJBeoQEpmagt3V1LPfG0CSNmiHQZh5Dnk7WH4t3f5ChereoZAqo9vyOQFnYs XFKg== X-Forwarded-Encrypted: i=1; AJvYcCXV/khl+Y/j08OE8Z/xXsS+W6vUKjil4KNTDozsjjHWbx8k5vLHk1x6BDaqZDPy+11JuHKNcLGyTBX4CPVyotd9uidOkH2Ubsp019L7 X-Gm-Message-State: AOJu0YyvRBq5FkjOnRAByhDvCCBNBVhDKtdl/L6P+aMiYi+h/L3wORe+ xBUfrRGpRxDc5MWKCgCitaO7AOgEHEbjcYXEjTKppsjL+tYHGD/KPliKBx/rKr+y2AIdHjlWY+u EQKzBMUBfXjKxn/v++gxOA6KoTzE= 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) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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 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