All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] vmalloc: Free pages as a batch
@ 2020-09-21 22:46 Matthew Wilcox (Oracle)
  2020-09-21 22:46 ` [PATCH 2/2] vfree: Update documentation Matthew Wilcox (Oracle)
  2020-09-23  8:35 ` [PATCH 1/2] vmalloc: Free pages as a batch Michal Hocko
  0 siblings, 2 replies; 9+ messages in thread
From: Matthew Wilcox (Oracle) @ 2020-09-21 22:46 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Matthew Wilcox (Oracle), linux-mm, linux-kernel, hch, Uladzislau Rezki

Use release_pages() to free the pages allocated by vmalloc().  This is
slightly more efficient in terms of disabling and enabling IRQs once
per batch instead of once per page.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 mm/vmalloc.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index be4724b916b3..3893fc8915c4 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -2263,16 +2263,8 @@ static void __vunmap(const void *addr, int deallocate_pages)
 	vm_remove_mappings(area, deallocate_pages);
 
 	if (deallocate_pages) {
-		int i;
-
-		for (i = 0; i < area->nr_pages; i++) {
-			struct page *page = area->pages[i];
-
-			BUG_ON(!page);
-			__free_pages(page, 0);
-		}
+		release_pages(area->pages, area->nr_pages);
 		atomic_long_sub(area->nr_pages, &nr_vmalloc_pages);
-
 		kvfree(area->pages);
 	}
 
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2020-09-23  8:35 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-21 22:46 [PATCH 1/2] vmalloc: Free pages as a batch Matthew Wilcox (Oracle)
2020-09-21 22:46 ` [PATCH 2/2] vfree: Update documentation Matthew Wilcox (Oracle)
2020-09-22 14:35   ` Christoph Hellwig
2020-09-22 15:06     ` Matthew Wilcox
2020-09-22 15:09       ` Christoph Hellwig
2020-09-22 15:22         ` Matthew Wilcox
2020-09-22 15:31           ` Christoph Hellwig
2020-09-22 16:42             ` Matthew Wilcox
2020-09-23  8:35 ` [PATCH 1/2] vmalloc: Free pages as a batch Michal Hocko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.