From: "David Hildenbrand (Arm)" <david@kernel.org>
To: Dev Jain <dev.jain@arm.com>,
akpm@linux-foundation.org, ljs@kernel.org, muchun.song@linux.dev,
osalvador@suse.de
Cc: riel@surriel.com, liam@infradead.org, vbabka@kernel.org,
harry@kernel.org, jannh@google.com, lance.yang@linux.dev,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
ryan.roberts@arm.com, anshuman.khandual@arm.com
Subject: Re: [PATCH v2 5/5] mm/rmap: add anon folio unmap dispatcher
Date: Fri, 10 Jul 2026 14:27:01 +0200 [thread overview]
Message-ID: <00467fbf-0360-47be-94bc-d1456323e5a1@kernel.org> (raw)
In-Reply-To: <20260710055915.638659-6-dev.jain@arm.com>
On 7/10/26 07:59, Dev Jain wrote:
> Add ttu_anon_folio() as the common entry point for anonymous folio
> unmapping. It dispatches to the lazyfree or swapbacked helper as
> appropriate.
>
> Keep restoration of cleared PTEs in the caller, where the PTEs were
> removed.
>
> No functional change intended.
>
> Signed-off-by: Dev Jain <dev.jain@arm.com>
> ---
> mm/rmap.c | 47 +++++++++++++++++++++++++----------------------
> 1 file changed, 25 insertions(+), 22 deletions(-)
>
> diff --git a/mm/rmap.c b/mm/rmap.c
> index 68459f23f5c0a..55aa3ff8bf216 100644
> --- a/mm/rmap.c
> +++ b/mm/rmap.c
> @@ -2172,6 +2172,28 @@ static bool ttu_anon_swapbacked_folio(struct vm_area_struct *vma,
> return true;
> }
>
> +static bool ttu_anon_folio(struct vm_area_struct *vma, struct folio *folio,
> + struct page *page, unsigned long address, pte_t *ptep,
> + pte_t pteval, unsigned long nr_pages)
> +{
> + /*
> + * Store the swap location in the pte.
> + * See handle_pte_fault() ...
> + */
> + if (unlikely(folio_test_swapbacked(folio) !=
> + folio_test_swapcache(folio))) {
> + WARN_ON_ONCE(1);
Can't you directly do
if (WARN_ON_ONCE(...))
return false;
That even implies the unlikely() :)
> + return false;
> + }
> +
> + if (!folio_test_swapbacked(folio))
> + return ttu_anon_lazyfree_folio(vma, folio, nr_pages);
> +
> + /* nr_pages > 1 not supported yet */
> + return ttu_anon_swapbacked_folio(vma, folio, page, address, ptep,
LGTM
Acked-by: David Hildenbrand (Arm) <david@kernel.org>
--
Cheers,
David
next prev parent reply other threads:[~2026-07-10 12:27 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-10 5:59 [PATCH v2 0/5] mm/rmap: Refactor try_to_unmap_one Dev Jain
2026-07-10 5:59 ` [PATCH v2 1/5] mm/rmap: convert page -> folio for hwpoison checks Dev Jain
2026-07-10 12:22 ` David Hildenbrand (Arm)
2026-07-10 13:14 ` Dev Jain
2026-07-10 5:59 ` [PATCH v2 2/5] mm/rmap: Add try_to_unmap_hugetlb_one Dev Jain
2026-07-10 13:16 ` Dev Jain
2026-07-10 5:59 ` [PATCH v2 3/5] mm/rmap: refactor some code around lazyfree folio unmapping Dev Jain
2026-07-10 5:59 ` [PATCH v2 4/5] mm/rmap: refactor anon folio unmap in try_to_unmap_one Dev Jain
2026-07-10 5:59 ` [PATCH v2 5/5] mm/rmap: add anon folio unmap dispatcher Dev Jain
2026-07-10 12:27 ` David Hildenbrand (Arm) [this message]
2026-07-10 13:13 ` Dev Jain
2026-07-11 0:35 ` Andrew Morton
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=00467fbf-0360-47be-94bc-d1456323e5a1@kernel.org \
--to=david@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=anshuman.khandual@arm.com \
--cc=dev.jain@arm.com \
--cc=harry@kernel.org \
--cc=jannh@google.com \
--cc=lance.yang@linux.dev \
--cc=liam@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ljs@kernel.org \
--cc=muchun.song@linux.dev \
--cc=osalvador@suse.de \
--cc=riel@surriel.com \
--cc=ryan.roberts@arm.com \
--cc=vbabka@kernel.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