On Mon, Mar 23, 2009 at 11:12:47PM -0700, Avantika Mathur wrote:
> Growing the hugepage pool with --pool-pages-min can fail due to the
> fragmentation within the system but one failure is not a guarantee of
> future failure, particularly if a very large amount of memory has to be
> reclaimed to satisfy the allocation. This patch adds a --hard flag to
> retry allocations multiple times. It initially tries to resize the pool
> up to 5 times. It continues to try if progress is being made towards 
> the resize.
> 

I made a mistake in suggesting how to allow --hard to be specified
anywhere. --pool-pages-min can be specified multiple times for different
pools. My bad, so here is a patch on top of yours.

From: Mel Gorman <m...@csn.ul.ie>
Subject: [PATCH] Allow --pool-pages-min to be specified multiple times after 
--hard implementation

--pool-pages-min can be specified multiple times for different pools.
With the reshuffle for --hard, only the last --pool-pages-min would be
processed. This patch stores the values for --pool-pages-min in an array
and processes them when other arguments have already been handled.

Signed-off-by: Mel Gorman <m...@csn.ul.ie>

diff --git a/hugeadm.c b/hugeadm.c
index de30979..b82a534 100644
--- a/hugeadm.c
+++ b/hugeadm.c
@@ -595,8 +595,8 @@ int main(int argc, char** argv)
 
        char opts[] = "+hd";
        char base[PATH_MAX];
-       char * opt_min_adj = NULL;
-       int ret = 0, index = 0;
+       char *opt_min_adj[MAX_POOLS];
+       int ret = 0, index = 0, minadj_count = 0;
        struct option long_opts[] = {
                {"help",       no_argument, NULL, 'h'},
 
@@ -663,7 +663,7 @@ int main(int argc, char** argv)
                        break;
 
                case LONG_POOL_MIN_ADJ:
-                       opt_min_adj = optarg;
+                       opt_min_adj[minadj_count++] = optarg;
                        break;
 
                case LONG_POOL_MAX_ADJ:
@@ -712,11 +712,11 @@ int main(int argc, char** argv)
                        ops++;
        }
 
-       if (opt_min_adj != NULL) {
+       while (--minadj_count >= 0) {
                if (! kernel_has_overcommit())
-                       pool_adjust(opt_min_adj, POOL_BOTH);
+                       pool_adjust(opt_min_adj[minadj_count], POOL_BOTH);
                else
-                       pool_adjust(opt_min_adj, POOL_MIN);
+                       pool_adjust(opt_min_adj[minadj_count], POOL_MIN);
        }
 
        index = optind;

------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
Libhugetlbfs-devel mailing list
Libhugetlbfs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libhugetlbfs-devel

Reply via email to