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 10B65C3DA49 for ; Tue, 16 Jul 2024 10:19:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 77D8C6B007B; Tue, 16 Jul 2024 06:19:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 72BBF6B0083; Tue, 16 Jul 2024 06:19:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5A49A6B0085; Tue, 16 Jul 2024 06:19:39 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 384FE6B007B for ; Tue, 16 Jul 2024 06:19:39 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id CF4C38046A for ; Tue, 16 Jul 2024 10:19:38 +0000 (UTC) X-FDA: 82345219236.01.62D4D91 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf19.hostedemail.com (Postfix) with ESMTP id 8135F1A0013 for ; Tue, 16 Jul 2024 10:19:36 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b="GQgFlV/a"; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf19.hostedemail.com: domain of david@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=david@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1721125145; a=rsa-sha256; cv=none; b=HnYoVPuWXM86CnXh6uRStSaaBdQ9lohktC4IUPBd5CcPO3L6sZLVz+dO3aaM2FqeMr4ASK A4b5BVfB29yT4j1lcYuTCFXsVN57IyUWHLQX9m1YPurmBPH4zYpH+VHSw5MwxbuDc65fKc L6jSjEunz0ZDYZi7R+UwjkmDnkrDgBI= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b="GQgFlV/a"; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf19.hostedemail.com: domain of david@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=david@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1721125145; 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=CFikzQ9FR6uq6Qkl11RGCdjEuVlFhdkxIDCeTFIs1Mk=; b=rsOfsJ5osFZC02Eh0pQJHjWhgV2CF4e/8tFbSkZPzkH2A4U7oI/HIYgPIOCakC8n/6qU0J ugI48FJcjQNPqm6bpI24p9MNGHf12s9pxVkS5w0TcxTaSLGCrn03oNJDXnGrCucaQ79+wm tGq487rIkANVCCxZPBKwM/8I7dkd0mk= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1721125175; h=from:from: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:autocrypt:autocrypt; bh=CFikzQ9FR6uq6Qkl11RGCdjEuVlFhdkxIDCeTFIs1Mk=; b=GQgFlV/aSVWNBDnbLnu/mnjdNFF72wlnriGrOVs/o0d6Utkf7WDsesqdq/xfttrx+Dxq2r gVHJSl45OWcMBUoA/hItneIy5KxU6iWEeDB4aRU/U1BMv6EAJ+RImxO/Vw756UHXAruBiO nEBMA08O/sN9j0MoXe9j6ZJeF+LP/ac= Received: from mail-lf1-f70.google.com (mail-lf1-f70.google.com [209.85.167.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-266-UASCL-rtOJSNUj-1P5FSuQ-1; Tue, 16 Jul 2024 06:19:34 -0400 X-MC-Unique: UASCL-rtOJSNUj-1P5FSuQ-1 Received: by mail-lf1-f70.google.com with SMTP id 2adb3069b0e04-52e993e31a9so5318608e87.1 for ; Tue, 16 Jul 2024 03:19:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721125173; x=1721729973; h=content-transfer-encoding:in-reply-to:organization:autocrypt :content-language:from:references:cc:to:subject:user-agent :mime-version:date:message-id:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=CFikzQ9FR6uq6Qkl11RGCdjEuVlFhdkxIDCeTFIs1Mk=; b=FueVb3aYSuJM5HHV6Duvv0ZUzygk20Im+9851S4p80lrMnJ5CFymnCZy8XyZUoHmQY v2VEXTee3haZXT5UTMJwg9Iv505lpljqxnXx4hn6bvKRUhk1hwqVms0qEfaCKkggYaH7 TUx181tc/BifIFM4c+nDjLWWhLUXAPHdZBMEK267ax3rDrgkwjfnkPzJWPgb7mFG31vS b5uxitJidMZGteSrsr0UdhzHq3Hdir3kaB84xeyAWBLFYtqID+OvCHvm3TmlljdQo4+u g6ym8INCXcJ8IADRwq6KpD/9gMfarY/JfRttyvaite1Osil5Gdy5NXRiA6sUB8s9gyLe sHOA== X-Forwarded-Encrypted: i=1; AJvYcCVWVoYT5GCHmgm8wnokn4glz8QAb/7Tn8Fzg9PAMwse5NOMWVAa2QdZKqHMqvmHRQT0vmpWZlqCtDkbN4CM5gsFig8= X-Gm-Message-State: AOJu0YxpJfVcqMiK25EN5h4NpE7u2d/E+CeRTYJNcT+6Xqe4hUQWp14E KdXRtJVd0nT4hu88qWA9Tt3Ahqm9LqQmemnfcsgHH51ypVTdgildlgsrQKjowVqxkJfgdht+Yvv 5PG4Xy02+jGYUVlFSOyYnLdYQZGc8L5dT2jx+/4xpZejAI0MK X-Received: by 2002:a05:6512:1091:b0:52e:9c0a:3514 with SMTP id 2adb3069b0e04-52edf030c05mr989910e87.44.1721125172561; Tue, 16 Jul 2024 03:19:32 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEIW/1pxgkTNM1wTgFJhZVq+2eKZEG0JtpvIoXxgJyFvHvcVymyCR1jszuYP8kB03uFUMIH+g== X-Received: by 2002:a05:6512:1091:b0:52e:9c0a:3514 with SMTP id 2adb3069b0e04-52edf030c05mr989893e87.44.1721125171989; Tue, 16 Jul 2024 03:19:31 -0700 (PDT) Received: from ?IPV6:2003:d8:2f02:7c00:e95e:dbc6:7ea8:d075? (p200300d82f027c00e95edbc67ea8d075.dip0.t-ipconnect.de. [2003:d8:2f02:7c00:e95e:dbc6:7ea8:d075]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-427b8609d54sm30775205e9.42.2024.07.16.03.19.31 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 16 Jul 2024 03:19:31 -0700 (PDT) Message-ID: <5c58d9ea-8490-4ae6-b7bf-be816dab3356@redhat.com> Date: Tue, 16 Jul 2024 12:19:30 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v1 2/2] mm: mTHP stats for pagecache folio allocations To: Ryan Roberts , Lance Yang , Baolin Wang Cc: Andrew Morton , Hugh Dickins , Jonathan Corbet , "Matthew Wilcox (Oracle)" , Barry Song , linux-kernel@vger.kernel.org, linux-mm@kvack.org References: <20240711072929.3590000-1-ryan.roberts@arm.com> <20240711072929.3590000-3-ryan.roberts@arm.com> <9e0d84e5-2319-4425-9760-2c6bb23fc390@linux.alibaba.com> <756c359e-bb8f-481e-a33f-163c729afa31@redhat.com> <8c32a2fc-252d-406b-9fec-ce5bab0829df@arm.com> From: David Hildenbrand Autocrypt: add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1ymZC1ORZKANLnRAb0NH/UCzcsstw2TAkFnMEbo9Zu9w7Kv AxBQXWeXhJI9XQssfrf4Gusdqx8nPEpfOqCtbbwJMATbHyqLt7/oz/5deGuwxgb65pWIzufa N7eop7uh+6bezi+rugUI+w6DABEBAAHCwXwEGAEIACYCGwwWIQQb2cqtc1xMOkYN/MpN3hD3 AP+DWgUCXw7HsgUJEqkpoQAKCRBN3hD3AP+DWrrpD/4qS3dyVRxDcDHIlmguXjC1Q5tZTwNB boaBTPHSy/Nksu0eY7x6HfQJ3xajVH32Ms6t1trDQmPx2iP5+7iDsb7OKAb5eOS8h+BEBDeq 3ecsQDv0fFJOA9ag5O3LLNk+3x3q7e0uo06XMaY7UHS341ozXUUI7wC7iKfoUTv03iO9El5f XpNMx/YrIMduZ2+nd9Di7o5+KIwlb2mAB9sTNHdMrXesX8eBL6T9b+MZJk+mZuPxKNVfEQMQ a5SxUEADIPQTPNvBewdeI80yeOCrN+Zzwy/Mrx9EPeu59Y5vSJOx/z6OUImD/GhX7Xvkt3kq Er5KTrJz3++B6SH9pum9PuoE/k+nntJkNMmQpR4MCBaV/J9gIOPGodDKnjdng+mXliF3Ptu6 3oxc2RCyGzTlxyMwuc2U5Q7KtUNTdDe8T0uE+9b8BLMVQDDfJjqY0VVqSUwImzTDLX9S4g/8 kC4HRcclk8hpyhY2jKGluZO0awwTIMgVEzmTyBphDg/Gx7dZU1Xf8HFuE+UZ5UDHDTnwgv7E th6RC9+WrhDNspZ9fJjKWRbveQgUFCpe1sa77LAw+XFrKmBHXp9ZVIe90RMe2tRL06BGiRZr jPrnvUsUUsjRoRNJjKKA/REq+sAnhkNPPZ/NNMjaZ5b8Tovi8C0tmxiCHaQYqj7G2rgnT0kt WNyWQQ== Organization: Red Hat In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Rspamd-Server: rspam12 X-Rspamd-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bovpg lgUnY6a0vWZ6WyS05WjaM6Fcz3gX3L0smQty6557DIoYJy7gVEKcwQqt0BFzMNvGBdm4/cYIj0qXn3srHgAJ7GdiqTH7mlqFNOf96jlbj/HaOG2hb9dFoOQRVlkcpkb9IBodLNJABXQWRdF5Tp/QbRpxZqKTcp1LLOGck3bQvySQxS41C4IE/x7IBCzjK2KmWixtEHK3XJW5mjjnl9LWRvHVOUlxV2Olr4QVplT/k38qWJncMfgYAnxQmPsfbZ265DEz3sBYXRfisYKhszHm0lYkz3/o0XAUXzUUNCcCXUG1ufpwoFXJQvR/D0lcJwHZORj9PThNTkhmkHQdqC0USzsLyJ2Fe3ge4M0QOwoHRerEF+GecDYncuZyomQ== 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 16.07.24 10:31, Ryan Roberts wrote: > On 13/07/2024 11:45, Ryan Roberts wrote: >> On 13/07/2024 02:08, David Hildenbrand wrote: >>> On 12.07.24 14:22, Lance Yang wrote: >>>> On Fri, Jul 12, 2024 at 11:00 AM Baolin Wang >>>> wrote: >>>>> >>>>> >>>>> >>>>> On 2024/7/11 15:29, Ryan Roberts wrote: >>>>>> Expose 3 new mTHP stats for file (pagecache) folio allocations: >>>>>> >>>>>>     /sys/kernel/mm/transparent_hugepage/hugepages-*kB/stats/file_alloc >>>>>>     /sys/kernel/mm/transparent_hugepage/hugepages-*kB/stats/file_fallback >>>>>> >>>>>> /sys/kernel/mm/transparent_hugepage/hugepages-*kB/stats/file_fallback_charge >>>>>> >>>>>> This will provide some insight on the sizes of large folios being >>>>>> allocated for file-backed memory, and how often allocation is failing. >>>>>> >>>>>> All non-order-0 (and most order-0) folio allocations are currently done >>>>>> through filemap_alloc_folio(), and folios are charged in a subsequent >>>>>> call to filemap_add_folio(). So count file_fallback when allocation >>>>>> fails in filemap_alloc_folio() and count file_alloc or >>>>>> file_fallback_charge in filemap_add_folio(), based on whether charging >>>>>> succeeded or not. There are some users of filemap_add_folio() that >>>>>> allocate their own order-0 folio by other means, so we would not count >>>>>> an allocation failure in this case, but we also don't care about order-0 >>>>>> allocations. This approach feels like it should be good enough and >>>>>> doesn't require any (impractically large) refactoring. >>>>>> >>>>>> The existing mTHP stats interface is reused to provide consistency to >>>>>> users. And because we are reusing the same interface, we can reuse the >>>>>> same infrastructure on the kernel side. The one small wrinkle is that >>>>>> the set of folio sizes supported by the pagecache are not identical to >>>>>> those supported by anon and shmem; pagecache supports order-1, unlike >>>>>> anon and shmem, and the max pagecache order may be less than PMD-size >>>>>> (see arm64 with 64K base pages), again unlike anon and shmem. So we now >>>>>> create a hugepages-*kB directory for the union of the sizes supported by >>>>>> all 3 memory types and populate it with the relevant stats and controls. >>>>> >>>>> Personally, I like the idea that can help analyze the allocation of >>>>> large folios for the page cache. >>>>> >>>>> However, I have a slight concern about the consistency of the interface. >>>>> >>>>> For 64K, the fields layout: >>>>> ├── hugepages-64kB >>>>> │   ├── enabled >>>>> │   ├── shmem_enabled >>>>> │   └── stats >>>>> │       ├── anon_fault_alloc >>>>> │       ├── anon_fault_fallback >>>>> │       ├── anon_fault_fallback_charge >>>>> │       ├── file_alloc >>>>> │       ├── file_fallback >>>>> │       ├── file_fallback_charge >>>>> │       ├── shmem_alloc >>>>> │       ├── shmem_fallback >>>>> │       ├── shmem_fallback_charge >>>>> │       ├── split >>>>> │       ├── split_deferred >>>>> │       ├── split_failed >>>>> │       ├── swpout >>>>> │       └── swpout_fallback >>>>> >>>>> But for 8K (for pagecache), you removed some fields (of course, I >>>>> understand why they are not supported). >>>>> >>>>> ├── hugepages-8kB >>>>> │   └── stats >>>>> │       ├── file_alloc >>>>> │       ├── file_fallback >>>>> │       └── file_fallback_charge >>>>> >>>>> This might not be user-friendly for some user-space parsing tools, as >>>>> they lack certain fields for the same pattern interfaces. Of course, >>>>> this might not be an issue if we have clear documentation describing the >>>>> differences here:) >>>>> >>>>> Another possible approach is to maintain the same field layout to keep >>>>> consistent, but prohibit writing to the fields that are not supported by >>>>> the pagecache, and any stats read from them would be 0. >>>> >>>> I agree that maintaining a uniform field layout, especially at the stats >>>> level, might be necessary ;) >>>> >>>> Keeping a consistent interface could future-proof the design. It allows >>>> for the possibility that features not currently supported for 8kB pages >>>> might be enabled in the future. >>> >>> I'll just note that, with shmem/file effectively being disabled for order > 11, >>> we'll also have entries there that are effectively unused. >> >> Indeed, I mentioned that in the commit log :) Well, I think it's more extreme than what you mentioned. For example, shmem_enable on arm64 with 64k is now effectively non-functional. Just like it will be for other orders in the anon-shmem case when the order exceeds MAX_PAGECACHE_ORDER. >> >>> >>> Good question how we want to deal with that (stats are easy, but what about when >>> we enable something? Maybe we should document that "enabled" is only effective >>> when supported). >> >> The documentation already says "If enabling multiple hugepage sizes, the kernel >> will select the most appropriate enabled size for a given allocation." for anon >> THP (and I've added similar wording for my as-yet-unposted patch to add controls >> for page cache folio sizes). So I think we could easily add dummy *enabled >> controls for all sizes, that can be written to and read back consistently, but >> the kernel just ignores them when deciding what size to use. It would also >> simplify the code that populates the controls. >> >> Personally though, I'm not convinced of the value of trying to make the controls >> for every size look identical. What's the real value to the user to pretend that >> they can select a size that they cannot? What happens when we inevitably want to >> add some new control in future which only applies to select sizes and there is >> no good way to fake it for the other sizes? Why can't user space just be >> expected to rely on the existance of the files rather than on the existance of >> the directories? >> >> As always, I'll go with the majority, but just wanted to register my opinion. > > Should I assume from the lack of reply on this that everyone else is in favour > of adding dummy controls so that all sizes have the same set of controls? If I > don't hear anything further, I'll post v2 with dummry controls today or tomorrow. Sorry, busy with other stuff. Indicating only what really exists sounds cleaner. But I wonder how we would want to handle in general orders that are effectively non-existant? -- Cheers, David / dhildenb