]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
hugetlb: override default huge page size
authorNick Piggin <npiggin@suse.de>
Thu, 24 Jul 2008 04:27:52 +0000 (21:27 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 24 Jul 2008 17:47:19 +0000 (10:47 -0700)
Allow configurations with the default huge page size which is different to
the traditional HPAGE_SIZE size.  The default huge page size is the one
represented in the legacy /proc ABIs, SHM, and which is defaulted to when
mounting hugetlbfs filesystems.

This is implemented with a new kernel option default_hugepagesz=, which
defaults to HPAGE_SIZE if not specified.

Signed-off-by: Nick Piggin <npiggin@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Documentation/kernel-parameters.txt
mm/hugetlb.c

index d55fd88fd0a94c0c469c7aecb98debf3cb90523f..30278e9e5211759cb95c5ecdfeca4be4b7413736 100644 (file)
@@ -783,6 +783,13 @@ and is between 256 and 4096 characters. It is defined in the file
                        CPU supports the "pdpe1gb" cpuinfo flag)
                        Note that 1GB pages can only be allocated at boot time
                        using hugepages= and not freed afterwards.
+       default_hugepagesz=
+                       [same as hugepagesz=] The size of the default
+                       HugeTLB page size. This is the size represented by
+                       the legacy /proc/ hugepages APIs, used for SHM, and
+                       default size when mounting hugetlbfs filesystems.
+                       Defaults to the default architecture's huge page size
+                       if not specified.
 
        i8042.direct    [HW] Put keyboard port into non-translated mode
        i8042.dumbkbd   [HW] Pretend that controller can only read data from
index 107c1ce223cbd44bc0392c6c8a4c6c6fb4438193..2a2f6e869401c8cbcd1b7f0a4763a047a0194f88 100644 (file)
@@ -34,6 +34,7 @@ struct hstate hstates[HUGE_MAX_HSTATE];
 /* for command line parsing */
 static struct hstate * __initdata parsed_hstate;
 static unsigned long __initdata default_hstate_max_huge_pages;
+static unsigned long __initdata default_hstate_size;
 
 #define for_each_hstate(h) \
        for ((h) = hstates; (h) < &hstates[max_hstate]; (h)++)
@@ -1288,11 +1289,14 @@ static int __init hugetlb_init(void)
 {
        BUILD_BUG_ON(HPAGE_SHIFT == 0);
 
-       if (!size_to_hstate(HPAGE_SIZE)) {
-               hugetlb_add_hstate(HUGETLB_PAGE_ORDER);
-               parsed_hstate->max_huge_pages = default_hstate_max_huge_pages;
+       if (!size_to_hstate(default_hstate_size)) {
+               default_hstate_size = HPAGE_SIZE;
+               if (!size_to_hstate(default_hstate_size))
+                       hugetlb_add_hstate(HUGETLB_PAGE_ORDER);
        }
-       default_hstate_idx = size_to_hstate(HPAGE_SIZE) - hstates;
+       default_hstate_idx = size_to_hstate(default_hstate_size) - hstates;
+       if (default_hstate_max_huge_pages)
+               default_hstate.max_huge_pages = default_hstate_max_huge_pages;
 
        hugetlb_init_hstates();
 
@@ -1332,7 +1336,7 @@ void __init hugetlb_add_hstate(unsigned order)
        parsed_hstate = h;
 }
 
-static int __init hugetlb_setup(char *s)
+static int __init hugetlb_nrpages_setup(char *s)
 {
        unsigned long *mhp;
        static unsigned long *last_mhp;
@@ -1367,7 +1371,14 @@ static int __init hugetlb_setup(char *s)
 
        return 1;
 }
-__setup("hugepages=", hugetlb_setup);
+__setup("hugepages=", hugetlb_nrpages_setup);
+
+static int __init hugetlb_default_setup(char *s)
+{
+       default_hstate_size = memparse(s, &s);
+       return 1;
+}
+__setup("default_hugepagesz=", hugetlb_default_setup);
 
 static unsigned int cpuset_mems_nr(unsigned int *array)
 {