From: Dev Jain <dev.jain@arm.com>
To: "David Hildenbrand (Arm)" <david@kernel.org>,
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 18:43:14 +0530 [thread overview]
Message-ID: <42300e6c-523b-4f58-98f7-672ce9173fe2@arm.com> (raw)
In-Reply-To: <00467fbf-0360-47be-94bc-d1456323e5a1@kernel.org>
On 10/07/26 5:57 pm, David Hildenbrand (Arm) wrote:
> 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;
Right. I didn't do it perhaps because I was playing with if (VM_WARN_ON_ONCE) somewhere
and that didn't build. But this is without the VM_ , this will work.
Andrew, could you you squash this diff:
diff --git a/mm/rmap.c b/mm/rmap.c
index 55aa3ff8bf216..41a049e7dd231 100644
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -2180,11 +2180,9 @@ static bool ttu_anon_folio(struct vm_area_struct *vma, struct folio *folio,
* 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);
+ if (WARN_ON_ONCE(folio_test_swapbacked(folio) !=
+ folio_test_swapcache(folio)))
return false;
- }
if (!folio_test_swapbacked(folio))
return ttu_anon_lazyfree_folio(vma, folio, nr_pages);
>
> 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>
>
next prev parent reply other threads:[~2026-07-10 13:13 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)
2026-07-10 13:13 ` Dev Jain [this message]
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=42300e6c-523b-4f58-98f7-672ce9173fe2@arm.com \
--to=dev.jain@arm.com \
--cc=akpm@linux-foundation.org \
--cc=anshuman.khandual@arm.com \
--cc=david@kernel.org \
--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