mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Dev Jain <dev.jain@arm.com>
Cc: david@kernel.org, ljs@kernel.org, muchun.song@linux.dev,
	osalvador@suse.de, 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 v4 0/5] mm/rmap: Refactor try_to_unmap_one
Date: Thu, 30 Jul 2026 12:26:02 -0700	[thread overview]
Message-ID: <20260730122602.587dc6cfea1859059e29ac6c@linux-foundation.org> (raw)
In-Reply-To: <20260730094559.418003-1-dev.jain@arm.com>

On Thu, 30 Jul 2026 09:45:51 +0000 Dev Jain <dev.jain@arm.com> wrote:

> In preparation for batching anonymous large folio unmapping to optimize it,
> refactor try_to_unmap_one. This series refactors hugetlb, anon-lazyfree
> and anon-swapbacked logic into their own functions, significantly
> reducing the length of the huge try_to_unmap_one.
> 

Thanks, updated.

> 
> v3->v4:
>  - Tighten comment around TTU_HWPOISON
>  - try_to_unmap_hugetlb_one -> try_to_unmap_poisoned_hugetlb_one
>  - VM_WARN_ON -> VM_WARN_ON_ONCE

Here's how v4 altered mm.git:


 mm/rmap.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

--- a/mm/rmap.c~b
+++ a/mm/rmap.c
@@ -1978,7 +1978,7 @@ static inline unsigned int folio_unmap_p
 				     FPB_RESPECT_WRITE | FPB_RESPECT_SOFT_DIRTY);
 }
 
-static bool try_to_unmap_hugetlb_one(struct folio *folio,
+static bool try_to_unmap_poisoned_hugetlb_one(struct folio *folio,
 		struct vm_area_struct *vma, unsigned long address, void *arg)
 {
 	DEFINE_FOLIO_VMA_WALK(pvmw, folio, vma, address, 0);
@@ -1993,7 +1993,7 @@ static bool try_to_unmap_hugetlb_one(str
 	 * The try_to_unmap() is only passed a hugetlb folio in the case
 	 * where the hugetlb folio is poisoned.
 	 */
-	VM_WARN_ON_FOLIO(!folio_test_hwpoison(folio), folio);
+	VM_WARN_ON_ONCE_FOLIO(!folio_test_hwpoison(folio), folio);
 	VM_WARN_ON_ONCE(!(flags & TTU_HWPOISON));
 
 	range.end = vma_address_end(&pvmw);
@@ -2031,7 +2031,7 @@ static bool try_to_unmap_hugetlb_one(str
 	if (!folio_test_anon(folio)) {
 		struct mmu_gather tlb;
 
-		VM_WARN_ON(!(flags & TTU_RMAP_LOCKED));
+		VM_WARN_ON_ONCE(!(flags & TTU_RMAP_LOCKED));
 		if (!hugetlb_vma_trylock_write(vma)) {
 			ret = false;
 			goto walk_done;
@@ -2350,7 +2350,7 @@ static bool try_to_unmap_one(struct foli
 		/* Update high watermark before we lower rss */
 		update_hiwater_rss(mm);
 
-		/* With TTU_HWPOISON, we only expect small folios here. */
+		/* unmap_poisoned_folio() only refs order-0 folios */
 		if (folio_test_hwpoison(folio) && (flags & TTU_HWPOISON)) {
 			pteval = swp_entry_to_pte(make_hwpoison_entry(page));
 			dec_mm_counter(mm, mm_counter(folio));
@@ -2440,7 +2440,7 @@ void try_to_unmap(struct folio *folio, e
 {
 	struct rmap_walk_control rwc = {
 		.rmap_one = folio_test_hugetlb(folio) ?
-				try_to_unmap_hugetlb_one : try_to_unmap_one,
+				try_to_unmap_poisoned_hugetlb_one : try_to_unmap_one,
 		.arg = (void *)flags,
 		.done = folio_not_mapped,
 		.anon_lock = folio_lock_anon_vma_read,
_


      parent reply	other threads:[~2026-07-30 19:26 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-30  9:45 Dev Jain
2026-07-30  9:45 ` [PATCH v4 1/5] mm/rmap: convert page -> folio for hwpoison checks Dev Jain
2026-07-31  4:21   ` Anshuman Khandual
2026-07-30  9:45 ` [PATCH v4 2/5] mm/rmap: Add try_to_unmap_poisoned_hugetlb_one Dev Jain
2026-07-30  9:45 ` [PATCH v4 3/5] mm/rmap: refactor some code around lazyfree folio unmapping Dev Jain
2026-07-30  9:45 ` [PATCH v4 4/5] mm/rmap: refactor anon folio unmap in try_to_unmap_one Dev Jain
2026-07-30  9:45 ` [PATCH v4 5/5] mm/rmap: add anon folio unmap dispatcher Dev Jain
2026-07-30 19:26 ` Andrew Morton [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=20260730122602.587dc6cfea1859059e29ac6c@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=anshuman.khandual@arm.com \
    --cc=david@kernel.org \
    --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

all inboxes | Powered by JetHome®