From: David Hildenbrand <david@redhat.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: Ryan Roberts <ryan.roberts@arm.com>,
Andrew Morton <akpm@linux-foundation.org>,
Yin Fengwei <fengwei.yin@intel.com>, Yu Zhao <yuzhao@google.com>,
Yang Shi <shy828301@gmail.com>,
"Huang, Ying" <ying.huang@intel.com>, Zi Yan <ziy@nvidia.com>,
linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH v1 1/3] mm: Allow deferred splitting of arbitrary large anon folios
Date: Mon, 17 Jul 2023 18:55:07 +0200 [thread overview]
Message-ID: <6d50e339-bdf9-191a-9389-ea0089fa7118@redhat.com> (raw)
In-Reply-To: <ZLVkUlQXmPH1BXEx@casper.infradead.org>
On 17.07.23 17:54, Matthew Wilcox wrote:
> On Mon, Jul 17, 2023 at 05:43:40PM +0200, David Hildenbrand wrote:
>> On 17.07.23 17:41, Ryan Roberts wrote:
>>> On 17/07/2023 16:30, Matthew Wilcox wrote:
>>>> On Mon, Jul 17, 2023 at 03:31:08PM +0100, Ryan Roberts wrote:
>>>>> In preparation for the introduction of large folios for anonymous
>>>>> memory, we would like to be able to split them when they have unmapped
>>>>> subpages, in order to free those unused pages under memory pressure. So
>>>>> remove the artificial requirement that the large folio needed to be at
>>>>> least PMD-sized.
>>>>>
>>>>> Signed-off-by: Ryan Roberts <ryan.roberts@arm.com>
>>>>> Reviewed-by: Yu Zhao <yuzhao@google.com>
>>>>> Reviewed-by: Yin Fengwei <fengwei.yin@intel.com>
>>>>
>>>> Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>
>>>
>>> Thanks!
>>>
>>>>
>>>>> */
>>>>> - if (folio_test_pmd_mappable(folio) && folio_test_anon(folio))
>>>>> + if (folio_test_large(folio) && folio_test_anon(folio))
>>>>> if (!compound || nr < nr_pmdmapped)
>>>>> deferred_split_folio(folio);
>>>>
>>>> I wonder if it's worth introducing a folio_test_deferred_split() (better
>>>> naming appreciated ...) to allow us to allocate order-1 folios and not
>>>> do horrible things. Maybe it's not worth supporting order-1 folios;
>>>> we're always better off going to order-2 immediately. Just thinking.
>>>
>>> There is more than just _deferred_list in the 3rd page; you also have _flags_2a
>>> and _head_2a. I guess you know much better than me what they store. But I'm
>>> guessing its harder than jsut not splitting an order-1 page?
>
> Those are page->flags and page->compound_head for the third page in
> the folio. They don't really need a name; nothing refers to them,
> but it's important that space not be reused ;-)
>
> This is slightly different from _flags_1; we do have some flags which
> reuse the bits (they're labelled as PF_SECOND). Right now, it's only
> PF_has_hwpoisoned, but we used to have PF_double_map. Others may arise.
>
>>> With the direction of large anon folios (_not_ retrying with every order down to
>>> 0), I'm not sure what the use case would be for order-1 anyway?
>>
>> Just noting that we might need some struct-page space for better
>> mapcount/shared tracking, which might get hard for order-1 pages.
>
> My assumption had been that we'd be able to reuse the _entire_mapcount
> and _nr_pages_mapped fields and not spill into the third page, but the
We most likely have to keep _entire_mapcount to keep "PMD mapped"
working (I don't think we can not account that, some user space relies
on that). Reusing _nr_pages_mapped for _total_mapcount would work until
we need more bits.
But once we want to sort out some other questions like "is this folio
mapped shared or mapped exclusive" we might need more space.
What I am playing with right now to tackle that would most probably not
fit in there (but I'll keep trying ;) ).
> third page is definitely available today if we want it. I'm fine with
> disallowing order-1 anon/file folios forever.
Yes, let's first sort out the open issues before going down that path
(might not really be worth it after all).
--
Cheers,
David / dhildenb
next prev parent reply other threads:[~2023-07-17 16:55 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-17 14:31 [PATCH v1 0/3] Optimize large folio interaction with deferred split Ryan Roberts
2023-07-17 14:31 ` [PATCH v1 1/3] mm: Allow deferred splitting of arbitrary large anon folios Ryan Roberts
2023-07-17 15:30 ` Matthew Wilcox
2023-07-17 15:41 ` Ryan Roberts
2023-07-17 15:43 ` David Hildenbrand
2023-07-17 15:54 ` Matthew Wilcox
2023-07-17 16:17 ` Matthew Wilcox
2023-07-17 16:55 ` David Hildenbrand [this message]
2023-07-17 15:42 ` David Hildenbrand
2023-07-17 16:01 ` Ryan Roberts
2023-07-17 16:48 ` David Hildenbrand
2023-07-18 8:58 ` Ryan Roberts
2023-07-18 9:08 ` David Hildenbrand
2023-07-18 9:33 ` Ryan Roberts
2023-07-17 14:31 ` [PATCH v1 2/3] mm: Implement folio_remove_rmap_range() Ryan Roberts
2023-07-17 15:07 ` Matthew Wilcox
2023-07-17 15:49 ` Ryan Roberts
2023-07-17 15:56 ` Matthew Wilcox
2023-07-17 15:09 ` Zi Yan
2023-07-17 15:51 ` Ryan Roberts
2023-07-17 15:53 ` Zi Yan
2023-07-18 1:14 ` Yin Fengwei
2023-07-18 6:22 ` Huang, Ying
2023-07-18 9:51 ` Ryan Roberts
2023-07-18 7:12 ` Huang, Ying
2023-07-18 10:02 ` Ryan Roberts
2023-07-17 14:31 ` [PATCH v1 3/3] mm: Batch-zap large anonymous folio PTE mappings Ryan Roberts
2023-07-17 15:25 ` Zi Yan
2023-07-17 15:55 ` Ryan Roberts
2023-07-17 16:15 ` Zi Yan
2023-07-18 10:19 ` Ryan Roberts
2023-07-18 14:01 ` Zi Yan
2023-07-17 23:27 ` Yin Fengwei
2023-07-18 10:27 ` Ryan Roberts
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6d50e339-bdf9-191a-9389-ea0089fa7118@redhat.com \
--to=david@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=fengwei.yin@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ryan.roberts@arm.com \
--cc=shy828301@gmail.com \
--cc=willy@infradead.org \
--cc=ying.huang@intel.com \
--cc=yuzhao@google.com \
--cc=ziy@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox