From: Vlastimil Babka <vbabka@suse.cz>
To: Lorenzo Stoakes <lstoakes@gmail.com>,
linux-mm@kvack.org, Andrew Morton <akpm@linux-foundation.org>,
linux-kernel@vger.kernel.org
Cc: Matthew Wilcox <willy@infradead.org>,
Hugh Dickins <hughd@google.com>,
Liam Howlett <liam.howlett@oracle.com>,
William Kucharski <william.kucharski@oracle.com>,
Christian Brauner <brauner@kernel.org>,
Jonathan Corbet <corbet@lwn.net>, Mike Rapoport <rppt@kernel.org>,
Joel Fernandes <joel@joelfernandes.org>,
Geert Uytterhoeven <geert@linux-m68k.org>
Subject: Re: [PATCH v3 5/5] Documentation/mm: Update references to __m[un]lock_page() to *_folio()
Date: Thu, 12 Jan 2023 12:04:53 +0100 [thread overview]
Message-ID: <ef422b84-cd33-69c7-9fef-cc8d1d45651c@suse.cz> (raw)
In-Reply-To: <cf3c5615d98f4e690dad46b074933024b8469d37.1672043615.git.lstoakes@gmail.com>
On 12/26/22 09:44, Lorenzo Stoakes wrote:
> We now pass folios to these functions, so update the documentation
> accordingly.
>
> Additionally, correct the outdated reference to __pagevec_lru_add_fn(), the
> referenced action occurs in __munlock_folio() directly now.
>
> Signed-off-by: Lorenzo Stoakes <lstoakes@gmail.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
With:
> ---
> Documentation/mm/unevictable-lru.rst | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/Documentation/mm/unevictable-lru.rst b/Documentation/mm/unevictable-lru.rst
> index 4a0e158aa9ce..153629e0c100 100644
> --- a/Documentation/mm/unevictable-lru.rst
> +++ b/Documentation/mm/unevictable-lru.rst
> @@ -308,22 +308,22 @@ do end up getting faulted into this VM_LOCKED VMA, they will be handled in the
> fault path - which is also how mlock2()'s MLOCK_ONFAULT areas are handled.
>
> For each PTE (or PMD) being faulted into a VMA, the page add rmap function
> -calls mlock_vma_page(), which calls mlock_page() when the VMA is VM_LOCKED
> +calls mlock_vma_page(), which calls mlock_folio() when the VMA is VM_LOCKED
> (unless it is a PTE mapping of a part of a transparent huge page). Or when
> it is a newly allocated anonymous page, lru_cache_add_inactive_or_unevictable()
Think it would be more appropriate now: ^ folio_add_lru_vma()
> -calls mlock_new_page() instead: similar to mlock_page(), but can make better
> +calls mlock_new_folio() instead: similar to mlock_folio(), but can make better
> judgments, since this page is held exclusively and known not to be on LRU yet.
>
> -mlock_page() sets PageMlocked immediately, then places the page on the CPU's
PG_mlocked?
> -mlock pagevec, to batch up the rest of the work to be done under lru_lock by
> -__mlock_page(). __mlock_page() sets PageUnevictable, initializes mlock_count
PG_unevictable
ditto below
> +mlock_folio() sets PageMlocked immediately, then places the page on the CPU's
> +mlock folio batch, to batch up the rest of the work to be done under lru_lock by
> +__mlock_folio(). __mlock_folio() sets PageUnevictable, initializes mlock_count
> and moves the page to unevictable state ("the unevictable LRU", but with
> mlock_count in place of LRU threading). Or if the page was already PageLRU
> and PageUnevictable and PageMlocked, it simply increments the mlock_count.
>
> But in practice that may not work ideally: the page may not yet be on an LRU, or
> it may have been temporarily isolated from LRU. In such cases the mlock_count
> -field cannot be touched, but will be set to 0 later when __pagevec_lru_add_fn()
> +field cannot be touched, but will be set to 0 later when __munlock_folio()
> returns the page to "LRU". Races prohibit mlock_count from being set to 1 then:
> rather than risk stranding a page indefinitely as unevictable, always err with
> mlock_count on the low side, so that when munlocked the page will be rescued to
prev parent reply other threads:[~2023-01-12 11:04 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-26 8:44 [PATCH v3 0/5] update mlock to use folios Lorenzo Stoakes
2022-12-26 8:44 ` [PATCH v3 1/5] mm: pagevec: add folio_batch_reinit() Lorenzo Stoakes
2023-01-12 9:57 ` Vlastimil Babka
2022-12-26 8:44 ` [PATCH v3 2/5] mm: mlock: use folios and a folio batch internally Lorenzo Stoakes
2023-01-12 10:31 ` Vlastimil Babka
2023-01-12 11:27 ` Lorenzo Stoakes
2022-12-26 8:44 ` [PATCH v3 3/5] m68k/mm/motorola: specify pmd_page() type Lorenzo Stoakes
2022-12-27 9:38 ` Geert Uytterhoeven
2023-01-12 10:38 ` Vlastimil Babka
2022-12-26 8:44 ` [PATCH v3 4/5] mm: mlock: update the interface to use folios Lorenzo Stoakes
2023-01-12 10:55 ` Vlastimil Babka
2023-01-12 12:01 ` Lorenzo Stoakes
2022-12-26 8:44 ` [PATCH v3 5/5] Documentation/mm: Update references to __m[un]lock_page() to *_folio() Lorenzo Stoakes
2023-01-12 11:04 ` Vlastimil Babka [this message]
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=ef422b84-cd33-69c7-9fef-cc8d1d45651c@suse.cz \
--to=vbabka@suse.cz \
--cc=akpm@linux-foundation.org \
--cc=brauner@kernel.org \
--cc=corbet@lwn.net \
--cc=geert@linux-m68k.org \
--cc=hughd@google.com \
--cc=joel@joelfernandes.org \
--cc=liam.howlett@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lstoakes@gmail.com \
--cc=rppt@kernel.org \
--cc=william.kucharski@oracle.com \
--cc=willy@infradead.org \
/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