Thread (13 messages) 13 messages, 3 authors, 16h ago

Re: [RFC PATCH 4/4] mm/percpu: stop unmapping the CPU that failed to map

flat view

From: Suren Baghdasaryan <surenb@google.com>
Date: 2026-10-13 11:47:00
Also in: linux-mm, lkml

On Fri, Oct 9, 2026 at 10:36 AM Hao Ge [off-list ref] wrote:
__pcpu_map_pages() clears the PTEs it installed when it fails, so
pcpu_map_pages() only has to tear down the CPUs it mapped before
the failing one.

Signed-off-by: Hao Ge <hao.ge@linux.dev>
Reviewed-by: Suren Baghdasaryan <surenb@google.com>

quoted hunk ↗ jump to hunk
---
 mm/percpu-vm.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/mm/percpu-vm.c b/mm/percpu-vm.c
index 509d8901835c..59d3a336a6bd 100644
--- a/mm/percpu-vm.c
+++ b/mm/percpu-vm.c
@@ -252,10 +252,11 @@ static int pcpu_map_pages(struct pcpu_chunk *chunk, struct page **pages,
        return 0;
 err:
        for_each_possible_cpu(tcpu) {
-               __pcpu_unmap_pages(pcpu_chunk_addr(chunk, tcpu, page_start),
-                                  page_end - page_start);
+               /* The failing CPU's partial mapping undoes itself */
                if (tcpu == cpu)
                        break;
+               __pcpu_unmap_pages(pcpu_chunk_addr(chunk, tcpu, page_start),
+                                  page_end - page_start);
        }
        pcpu_post_unmap_tlb_flush(chunk, page_start, page_end);
        return err;
--
2.25.1
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help