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 55DF6C2BD09 for ; Tue, 9 Jul 2024 07:47:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 992BF6B0098; Tue, 9 Jul 2024 03:47:26 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 93FD66B0099; Tue, 9 Jul 2024 03:47:26 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 806686B009A; Tue, 9 Jul 2024 03:47:26 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 631216B0098 for ; Tue, 9 Jul 2024 03:47:26 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 2215481260 for ; Tue, 9 Jul 2024 07:47:26 +0000 (UTC) X-FDA: 82319434092.01.67F6699 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf23.hostedemail.com (Postfix) with ESMTP id B625114000D for ; Tue, 9 Jul 2024 07:47:23 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf23.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1720511215; 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; bh=ELcvx1vyE3/TN3bM3zM8jvF0pZ7i5TKNnMoffc3HoHs=; b=KfmgRX+6WjavCGpByMSLrEw/Kve6jMcxY/tZHiT7Cdfv6yNP8UNTtbk+9g+ZbTIJrQXkf0 qD2g11DqWh3Ievy3zfVTxArp37eWXr2pWhfmzIIJvk4jeWJJkaUGglGcadqyMc4y3qfOcI Ha06IWnRvpVq9IQFbh5AcrAq2T+Gt+A= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1720511215; a=rsa-sha256; cv=none; b=UQDNYEnwMlsQg52hZxYZ5JkS7hA1Tz+gbrZxswC+5WoKOsVF2Xu42eze+HlJ0PVgQkcRam e1Mte8ikYkjQ125PzsRWTjAoz3ksypMtMti6X7WIc7tnwQu13SU+g2CY3y4NzHosPTSS7a DleAGPjLP+632nIJf6EeYCyqBnSkXI4= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf23.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 816251042; Tue, 9 Jul 2024 00:47:47 -0700 (PDT) Received: from [10.57.76.194] (unknown [10.57.76.194]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 2C3FD3F641; Tue, 9 Jul 2024 00:47:20 -0700 (PDT) Message-ID: <0240add9-4c56-4f66-b761-494cc2cf8fb5@arm.com> Date: Tue, 9 Jul 2024 08:47:18 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v1] mm: shmem: Rename mTHP shmem counters Content-Language: en-GB To: David Hildenbrand , Barry Song Cc: Andrew Morton , Hugh Dickins , Jonathan Corbet , Baolin Wang , Lance Yang , Matthew Wilcox , Zi Yan , Daniel Gomez , linux-kernel@vger.kernel.org, linux-mm@kvack.org References: <20240708112445.2690631-1-ryan.roberts@arm.com> <744749c3-4506-40d9-ac48-0dbc59689f92@arm.com> <10b201b1-53d3-4f62-be8e-996aa95d2b99@redhat.com> From: Ryan Roberts In-Reply-To: <10b201b1-53d3-4f62-be8e-996aa95d2b99@redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: B625114000D X-Stat-Signature: 5ehn7x7g7nkre5b8si35eadt4f6qqihu X-Rspamd-Server: rspam09 X-Rspam-User: X-HE-Tag: 1720511243-83625 X-HE-Meta: U2FsdGVkX1/Lrhyr+TrErtquJAFwzCCVX0QvuGkF5/7eewyZkvVp1FPJU7AzamgLV7aOJrYsDnhvCO7OU+6+K/pwPoN5nsKJolEBYInQ/s1tJjBVUbvoutQ1gIjLu8UK2bWParamgcg2sYYnodIqthoMZtu7MOD2ChMS+PmknFa/SLSG1fRx8leO2by9HEy46xggKkaDqi2pChMoDVY8Gzn9Lh8rnyuV2h4dr5rdnPLmTspOe9bcu+t8Q+2rRiifYAJ4TpRUvDp5geBx7ye6g3wxMEdtOximrYw3TZkW1qKRP35KNPCG/lIrUqr3V5wfmDqWxT0N+ioZHE/+Sf4Af5JlFfG8qMYK+sB2/T6o/EQgE7eycJz2k1WWCdu6bpnOlbPV2fW8Krn4IHBt7JUyaGp0g15K7w6KgUhAxPbGbp1cIVjwbTFEzfyOUT31wKN0hConZFU2ddVgTYkelhj6JnMDqRxMyvIic2jD0f4QJiidzO3gwAam2sIlzskw4tJU2he3cz/3MLf4VxmKGs9gkN4I4oaY4W44KJJ2KTQgRaCCdZAujQtykpIcUAde5g7IM1X6TVs92478DcxLxDyrcqHcBUHjD982BnBH7pjZnvLAfvaq44fPFatmXPJhrCAgKR7wVuHoaI9nNC8dl4y1USanXaQrJJdeW50F9OsC0yjdu/3NYhPuuvVm8wHm5zONijQqtXlxFyxtMPGv8ELCPllvMyOosZFv6Pbj25Ioz5CrAKbJn2GxGRv7mkrP97Cy6zzckEQjpBSzpb+SUFcAl9OZfsHBKy9tN/N/ABtpTbH5Di9DhduBo3ngiBRAeY1XbfWNKB5I6BxJrqjXTX2q0a4fhT59QdA5cncMjJasL5Rl51zsa2nDMVfVH13qTjf1HkYyuFarhELoQh8UpK4Llmfy3i2U4T9K+j1bsdZPt0fXZZo5nxphtVZ+Z8hfvLNerCHFrs1NNnG4YDxP3ZB xis5k464 7rRpXCZHLAY1FBY5uMnPI9rv/1l7b4g/IqwP9fXICbaQkQw0VbKKRHXm1WWtwS6BSJ8LFjEM8OalLrIB3V7heiX4y8QnbFsYPqaf6m850QDECqZmBjIrDIo+ZeY9w6FgMI6bSAWCYUxXdHaT7y5dbZmzNme0k9wAI1EKMsFeAdNuGlF6usiOoSHpoaLeM4sdp6mqo3eo5rE2ot2wHAKkDSvoe+VQHF/KtCRaJn3GxsVPNG5o= 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 08/07/2024 21:50, David Hildenbrand wrote: > On 08.07.24 14:29, Ryan Roberts wrote: >> On 08/07/2024 12:36, Barry Song wrote: >>> On Mon, Jul 8, 2024 at 11:24 PM Ryan Roberts wrote: >>>> >>>> The legacy PMD-sized THP counters at /proc/vmstat include >>>> thp_file_alloc, thp_file_fallback and thp_file_fallback_charge, which >>>> rather confusingly refer to shmem THP and do not include any other types >>>> of file pages. This is inconsistent since in most other places in the >>>> kernel, THP counters are explicitly separated for anon, shmem and file >>>> flavours. However, we are stuck with it since it constitutes a user ABI. >>>> >>>> Recently, commit 66f44583f9b6 ("mm: shmem: add mTHP counters for >>>> anonymous shmem") added equivalent mTHP stats for shmem, keeping the >>>> same "file_" prefix in the names. But in future, we may want to add >>>> extra stats to cover actual file pages, at which point, it would all >>>> become very confusing. >>>> >>>> So let's take the opportunity to rename these new counters "shmem_" >>>> before the change makes it upstream and the ABI becomes immutable. >>> >>> Personally, I think this approach is much clearer. However, I recall >>> we discussed this >>> before [1], and it seems that inconsistency is a concern? >> >> Embarrassingly, I don't recall that converstation at all :-| but at least what I >> said then is consistent with what I've done in this patch. >> >> I think David's conclusion from that thread was to call them FILE_, and add both >> shmem and pagecache counts to those counters, meaning we can keep the same name >> as legacy THP counters. But those legacy THP counters only count shmem, and I >> don't think we would get away with adding pagecache counts to those at this >> point? (argument: they have been around for long time and there is a risk that >> user space relies on them and if they were to dramatically increase due to >> pagecache addition now that could break things). In that case, there is still >> inconsistency, but its worse; the names are consistent but the semantics are >> inconsistent. >> >> So my vote is to change to SHMEM_ as per this patch :) > > I also forgot most of the discussion, but these 3 legacy counters are really > only (currently) incremented for shmem. I think my idea was to keep everything > as FILE_ for now, maybe at some point make the pagecache also use them, and then > maybe have separate FILE_ + SHMEM_. > > But yeah, likely it's best to only have "shmem" here for now, because who knows > what we can actually change about the legacy counters. But it's always though > messing with legacy stuff that is clearly suboptimal ... Sorry David, I've read your response a bunch of times and am still not completely sure what you are advocating for. To make my proposal crystal clear, I think we should leave the legacy counters alone - neither change their name nor what they count (which is _only_ shmem). I think we should rename the new mTHP counters to "shmem" and have them continue to only count shmem. Then additionally, I think we should introduce new "file" mTHP counters that count the page cache allocations (that's a future set of patches, which I'm working on together with user controls to determine which mTHP sizes can be used by page cache). As suggested by Barry, I propose to also improve the documentation for the legacy counters to make it clear that dispite their name being "file" they are actually counting "shmem". I'll do this for v2. David, would you support this approach? If so, I'd like to push this forwards asap so that it gets into v6.11 to avoid ever exposing the mthp counters with the "file" name. Thanks, Ryan