[PATCH] [4/18] Add basic support for more than one hstate in hugetlbfs

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Andi Kleen
Date: Sunday, March 16, 2008 - 6:58 pm

Signed-off-by: Andi Kleen <ak@suse.de>

---
 mm/hugetlb.c |   15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

Index: linux/mm/hugetlb.c
===================================================================
--- linux.orig/mm/hugetlb.c
+++ linux/mm/hugetlb.c
@@ -550,26 +550,33 @@ static unsigned int cpuset_mems_nr(unsig
 
 #ifdef CONFIG_SYSCTL
 #ifdef CONFIG_HIGHMEM
-static void try_to_free_low(unsigned long count)
+static void do_try_to_free_low(struct hstate *h, unsigned long count)
 {
-	struct hstate *h = &global_hstate;
 	int i;
 
 	for (i = 0; i < MAX_NUMNODES; ++i) {
 		struct page *page, *next;
 		struct list_head *freel = &h->hugepage_freelists[i];
 		list_for_each_entry_safe(page, next, freel, lru) {
-			if (count >= nr_huge_pages)
+			if (count >= h->nr_huge_pages)
 				return;
 			if (PageHighMem(page))
 				continue;
 			list_del(&page->lru);
-			update_and_free_page(page);
+			update_and_free_page(h, page);
 			h->free_huge_pages--;
 			h->free_huge_pages_node[page_to_nid(page)]--;
 		}
 	}
 }
+
+static void try_to_free_low(unsigned long count)
+{
+	struct hstate *h;
+	for_each_hstate (h) {
+		do_try_to_free_low(h, count);
+	}
+}
 #else
 static inline void try_to_free_low(unsigned long count)
 {
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] [0/18] GB pages hugetlb support, Andi Kleen, (Sun Mar 16, 6:58 pm)
[PATCH] [4/18] Add basic support for more than one hstate ..., Andi Kleen, (Sun Mar 16, 6:58 pm)
[PATCH] [8/18] Add a __alloc_bootmem_node_nopanic, Andi Kleen, (Sun Mar 16, 6:58 pm)
[PATCH] [14/18] Clean up hugetlb boot time printk, Andi Kleen, (Sun Mar 16, 6:58 pm)
[PATCH] [16/18] Add huge pud support to hugetlbfs, Andi Kleen, (Sun Mar 16, 6:58 pm)
[PATCH] [17/18] Add huge pud support to mm/memory.c, Andi Kleen, (Sun Mar 16, 6:58 pm)
Re: [PATCH] [0/18] GB pages hugetlb support, Paul Jackson, (Sun Mar 16, 8:11 pm)
Re: [PATCH] [0/18] GB pages hugetlb support, Paul Jackson, (Sun Mar 16, 10:35 pm)
Re: [PATCH] [0/18] GB pages hugetlb support, Andi Kleen, (Sun Mar 16, 11:58 pm)
Re: [PATCH] [0/18] GB pages hugetlb support, Paul Jackson, (Mon Mar 17, 12:00 am)
Re: [PATCH] [0/18] GB pages hugetlb support, Andi Kleen, (Mon Mar 17, 12:00 am)
Re: [PATCH] [0/18] GB pages hugetlb support, Andi Kleen, (Mon Mar 17, 12:29 am)
Re: [PATCH] [0/18] GB pages hugetlb support, Paul Jackson, (Mon Mar 17, 2:26 am)
Re: [PATCH] [0/18] GB pages hugetlb support, Adam Litke, (Mon Mar 17, 8:05 am)
Re: [PATCH] [0/18] GB pages hugetlb support, Andi Kleen, (Mon Mar 17, 8:33 am)
Re: [PATCH] [0/18] GB pages hugetlb support, Adam Litke, (Mon Mar 17, 8:59 am)