Linux Headquarters
[ Register ]
[ About us ] [ Home Page ]

Advertisement
[ Kernel ] [ Documentation ] [ Links ] [ Books ]

Advertisement

Kernel v2.6.25-rc7-git5 /mm/hugetlb.c

Filename:/mm/hugetlb.c
Lines Added:14
Lines Deleted:3
Also changed in: (Previous) 2.6.25-rc7-git4  2.6.25-rc7-git3  2.6.25-rc7-git2  2.6.25-rc7  2.6.25-rc6  2.6.25-rc5-git7 
(Following) 2.6.25-rc7-git6  2.6.25-rc8  2.6.25-rc9  2.6.25  2.6.25-git12  2.6.25-git13 

Location
[  2.6.25-rc7-git5
  [  mm
     o  hugetlb.c

Patch

diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 74c1b6b..51c9e2c 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -401,12 +401,20 @@ static void return_unused_surplus_pages(unsigned long unused_resv_pages)
    struct page *page;
    unsigned long nr_pages;
 
+   /*
+    * We want to release as many surplus pages as possible, spread
+    * evenly across all nodes. Iterate across all nodes until we
+    * can no longer free unreserved surplus pages. This occurs when
+    * the nodes with surplus pages have no free pages.
+    */
+   unsigned long remaining_iterations = num_online_nodes();
+
    /* Uncommit the reservation */
    resv_huge_pages -= unused_resv_pages;
 
    nr_pages = min(unused_resv_pages, surplus_huge_pages);
 
-   while (nr_pages) {
+   while (remaining_iterations-- && nr_pages) {
       nid = next_node(nid, node_online_map);
       if (nid == MAX_NUMNODES)
          nid = first_node(node_online_map);
@@ -424,6 +432,7 @@ static void return_unused_surplus_pages(unsigned long unused_resv_pages)
          surplus_huge_pages--;
          surplus_huge_pages_node[nid]--;
          nr_pages--;
+         remaining_iterations = num_online_nodes();
       }
    }
 }
@@ -671,9 +680,11 @@ int hugetlb_report_node_meminfo(int nid, char *buf)
 {
    return sprintf(buf,
       "Node %d HugePages_Total: %5u\n"
-      "Node %d HugePages_Free:  %5u\n",
+      "Node %d HugePages_Free:  %5u\n"
+      "Node %d HugePages_Surp:  %5u\n",
       nid, nr_huge_pages_node[nid],
-      nid, free_huge_pages_node[nid]);
+      nid, free_huge_pages_node[nid],
+      nid, surplus_huge_pages_node[nid]);
 }
 
 /* Return the number pages of memory we physically have, in PAGE_SIZE units. */


Comments: webmaster (at) linuxhq.com.
Advertising: banners (at) linuxhq.com.
Compilation ©1998-2008 Linux Headquarters, Inc.