From: David Hildenbrand <david@redhat.com>
To: John Hubbard <jhubbard@nvidia.com>,
Christoph Hellwig <hch@infradead.org>,
Matthew Wilcox <willy@infradead.org>,
Jason Gunthorpe <jgg@nvidia.com>
Cc: Sooyong Suk <s.suk@samsung.com>,
viro@zeniv.linux.org.uk, linux-kernel@vger.kernel.org,
akpm@linux-foundation.org, linux-mm@kvack.org,
jaewon31.kim@gmail.com, spssyr@gmail.com, Zi Yan <ziy@nvidia.com>
Subject: Re: [RFC PATCH] block, fs: use FOLL_LONGTERM as gup_flags for direct IO
Date: Sun, 16 Mar 2025 00:00:09 +0100 [thread overview]
Message-ID: <e8996592-f7ba-4926-8556-1fe7534038dc@redhat.com> (raw)
In-Reply-To: <c45e1bf8-f91b-4383-8c1a-7e11be02743b@nvidia.com>
On 15.03.25 02:04, John Hubbard wrote:
> On 3/13/25 3:49 PM, David Hildenbrand wrote:
>> On 12.03.25 16:21, Christoph Hellwig wrote:
>>> On Fri, Mar 07, 2025 at 08:23:08PM +0000, Matthew Wilcox wrote:
>>>> Howver, the problem is real.
>>>
>>> What is the problem?
>>
>> I think the problem is the CMA allocation failure, not the latency.
>>
>> "if a large amount of direct IO is requested constantly, this can make
>> pages in CMA pageblocks pinned and unable to migrate outside of the
>> pageblock"
>>
>> We'd need a more reliable way to make CMA allocation -> page migration
>> make progress. For example, after we isolated the pageblocks and
>> migration starts doing its thing, we could disallow any further GUP
>> pins. (e.g., make GUP spin or wait for migration to end)
>>
>> We could detect in GUP code that a folio is soon expected to be migrated
>> by checking the pageblock (isolated) and/or whether the folio is locked.
>>
>
> Jason Gunthorpe and Matthew both had some ideas about how to fix this [1],
> which were very close (maybe the same) to what you're saying here: sleep
> and spin in an killable loop.
>
> It turns out to be a little difficult to do this--I had trouble making
> the folio's "has waiters" bit work for this, for example. And then...squirrel!
>
> However, I still believe, so far, this is the right approach. I'm just not
> sure which thing to wait on, exactly.
Zi Yan has a series to convert the "isolate" state of pageblocks to a
separate pageblock bit; it could be considered a lock-bit. Currently,
it's essentially the migratetype being MIGRATE_ISOLATE.
As soon as a pageblock is isolated, one must be prepared for contained
pages/folios to get migrated. The folio lock will only be grabbed once
actually trying to migrate a folio IIRC, so it might not be the best
choice: especially considering allocations that span many pageblocks.
So maybe one would need a "has waiters" bit per pageblock, so relevant
users (e.g., GUP) could wait on the isolate bit getting cleared.
--
Cheers,
David / dhildenb
next prev parent reply other threads:[~2025-03-15 23:00 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20250306074101epcas1p4b24ac546f93df2c7fe3176607b20e47f@epcas1p4.samsung.com>
2025-03-06 7:40 ` Sooyong Suk
2025-03-06 15:26 ` Christoph Hellwig
2025-03-06 23:28 ` Jaewon Kim
2025-03-07 2:07 ` Sooyong Suk
2025-03-07 2:28 ` Suren Baghdasaryan
2025-03-07 6:38 ` Sooyong Suk
2025-03-12 15:17 ` Christoph Hellwig
2025-03-12 15:20 ` Suren Baghdasaryan
2025-03-12 15:25 ` Christoph Hellwig
2025-03-12 15:38 ` Suren Baghdasaryan
2025-03-12 15:52 ` Christoph Hellwig
2025-03-12 16:03 ` Bart Van Assche
2025-03-12 16:06 ` Suren Baghdasaryan
2025-03-12 16:21 ` Christoph Hellwig
2025-03-07 20:23 ` Matthew Wilcox
2025-03-07 21:37 ` Suren Baghdasaryan
2025-03-12 15:21 ` Christoph Hellwig
2025-03-13 22:49 ` David Hildenbrand
2025-03-15 1:04 ` John Hubbard
2025-03-15 23:00 ` David Hildenbrand [this message]
2025-03-15 23:09 ` Zi Yan
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=e8996592-f7ba-4926-8556-1fe7534038dc@redhat.com \
--to=david@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=hch@infradead.org \
--cc=jaewon31.kim@gmail.com \
--cc=jgg@nvidia.com \
--cc=jhubbard@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=s.suk@samsung.com \
--cc=spssyr@gmail.com \
--cc=viro@zeniv.linux.org.uk \
--cc=willy@infradead.org \
--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