From: David Hildenbrand <david@redhat.com>
To: "Yin, Fengwei" <fengwei.yin@intel.com>,
Matthew Wilcox <willy@infradead.org>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
yuzhao@google.com, ryan.roberts@arm.com, shy828301@gmail.com,
akpm@linux-foundation.org
Subject: Re: [RFC PATCH 0/3] support large folio for mlock
Date: Mon, 10 Jul 2023 11:32:40 +0200 [thread overview]
Message-ID: <04efd5eb-06c2-d449-8427-d7c30df962d1@redhat.com> (raw)
In-Reply-To: <676ce1b3-6c72-011e-3a4f-723945db3d31@intel.com>
On 09.07.23 15:25, Yin, Fengwei wrote:
>
>
> On 7/8/2023 12:02 PM, Matthew Wilcox wrote:
>> I would be tempted to allocate memory & copy to the new mlocked VMA.
>> The old folio will go on the deferred_list and be split later, or its
>> valid parts will be written to swap and then it can be freed.
> If the large folio splitting failure is because of GUP pages, can we
> do copy here?
>
> Let's say, if the GUP page is target of DMA operation and DMA operation
> is ongoing. We allocated a new page and copy GUP page content to the
> new page, the data in the new page can be corrupted.
No, we may only replace anon pages that are flagged as maybe shared
(!PageAnonExclusive). We must not replace pages that are exclusive
(PageAnonExclusive) unless we first try marking them maybe shared.
Clearing will fail if the page maybe pinned.
page_try_share_anon_rmap() implements the clearing logic, taking care of
synchronizing against concurrent GUP-fast.
There are some additional nasty details regarding O_DIRECT. But once it
completely switched from using FOLL_GET to properly using FOLL_PIN (a
lot of that conversion already happened IIRC), we're fine in that regard.
--
Cheers,
David / dhildenb
next prev parent reply other threads:[~2023-07-10 9:32 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-07 16:52 Yin Fengwei
2023-07-07 16:52 ` [RFC PATCH 1/3] mm: add function folio_in_range() Yin Fengwei
2023-07-08 5:47 ` Yu Zhao
2023-07-08 6:44 ` Yin, Fengwei
2023-07-07 16:52 ` [RFC PATCH 2/3] mm: handle large folio when large folio in VM_LOCKED VMA range Yin Fengwei
2023-07-08 5:11 ` Yu Zhao
2023-07-08 5:33 ` Yin, Fengwei
2023-07-08 5:56 ` Yu Zhao
2023-07-07 16:52 ` [RFC PATCH 3/3] mm: mlock: update mlock_pte_range to handle large folio Yin Fengwei
2023-07-07 17:26 ` [RFC PATCH 0/3] support large folio for mlock Matthew Wilcox
2023-07-07 18:54 ` David Hildenbrand
2023-07-07 19:06 ` Matthew Wilcox
2023-07-07 19:15 ` David Hildenbrand
2023-07-07 19:26 ` Matthew Wilcox
2023-07-10 10:36 ` Ryan Roberts
2023-07-08 3:52 ` Yin, Fengwei
2023-07-08 4:02 ` Matthew Wilcox
2023-07-08 4:35 ` Yu Zhao
2023-07-08 4:40 ` Yin, Fengwei
2023-07-08 4:36 ` Yin, Fengwei
2023-07-09 13:25 ` Yin, Fengwei
2023-07-10 9:32 ` David Hildenbrand [this message]
2023-07-10 9:43 ` Yin, Fengwei
2023-07-10 9:57 ` David Hildenbrand
2023-07-10 10:19 ` Yin, Fengwei
2023-07-08 3:34 ` Yin, Fengwei
2023-07-08 3:31 ` Yin, Fengwei
2023-07-08 4:45 ` Yu Zhao
2023-07-08 5:01 ` Yin, Fengwei
2023-07-08 5:06 ` Yu Zhao
2023-07-08 5:35 ` Yin, Fengwei
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=04efd5eb-06c2-d449-8427-d7c30df962d1@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=yuzhao@google.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