Skip to contentSkip to conversation

hugetlb: override default huge page size non-const fix

PATCH In review Nick Piggin 2 participants 2 messages Jul 23, 2008 – Jul 24, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hugetlb: override default huge page size non-const fix

Hi,

I revisited the multi-size hugetlb patches, and realised I forgot one small outstanding issue. Your hugetlb-override-default-huge-page-size-ia64-build.patch
fix basically disallows overriding of the default hugetlb size, because we always set the default back to HPAGE_SIZE.

A better fix I think is just to initialize the default_hstate_size to an invalid value, which the init code checks for and reverts to HPAGE_SIZE anyway. So please replace that patch with this one.

Overriding of the default hugepage size is not of major importance, but it can allow legacy code (providing it is well written), including the hugetlb regression suite to be run with different hugepage sizes (so actually it is quite important for developers at least).

I don't have access to such a machine, but I hope (with this patch), the powerpc developers can run the libhugetlb regression suite one last time against a range of page sizes and ensure the results look reasonable.

Thanks,
Nick

--

If HPAGE_SIZE is not constant (eg. on ia64), then the initialiser does not work. Fix this by making default_hstate_size == 0, then if it isn't set from the cmdline, hugetlb_init will still do the right thing and set up the default hstate as (the now initialized) HPAGE_SIZE.

---

mm/hugetlb.c +1 -1
Index: linux-2.6/mm/hugetlb.c
===================================================================
@@ -34,7 +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 = HPAGE_SIZE;
+static unsigned long __initdata default_hstate_size = 0;
 
 #define for_each_hstate(h) \
 	for ((h) = hstates; (h) < &hstates[max_hstate]; (h)++)

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#1 lore raw
Quoted 12 lines · Nick Piggin

Hi,

I revisited the multi-size hugetlb patches, and realised I forgot one small outstanding issue. Your hugetlb-override-default-huge-page-size-ia64-build.patch
fix basically disallows overriding of the default hugetlb size, because we always set the default back to HPAGE_SIZE.

A better fix I think is just to initialize the default_hstate_size to an invalid value, which the init code checks for and reverts to HPAGE_SIZE anyway. So please replace that patch with this one.

Quoted 9 lines

Overriding of the default hugepage size is not of major importance, but it can allow legacy code (providing it is well written), including the hugetlb regression suite to be run with different hugepage sizes (so actually it is quite important for developers at least).

I don't have access to such a machine, but I hope (with this patch), the powerpc developers can run the libhugetlb regression suite one last time against a range of page sizes and ensure the results look reasonable.

I am a little slow here, but I was able to boot with default_hugepagesz=64K and 16G on Power and it set the default huge page size to the given size.

Jon

Quoted 18 lines

Thanks,
Nick

--

If HPAGE_SIZE is not constant (eg. on ia64), then the initialiser does not work. Fix this by making default_hstate_size == 0, then if it isn't set from the cmdline, hugetlb_init will still do the right thing and set up the default hstate as (the now initialized) HPAGE_SIZE.

---
Index: linux-2.6/mm/hugetlb.c
===================================================================

mm/hugetlb.c struct hstate hstates[HUGE_MAX_HSTATE]; · line 40

Quoted 8 lines
mm/hugetlb.c +1 -1
@@ -34,7 +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 = HPAGE_SIZE;
+static unsigned long __initdata default_hstate_size = 0;
 
 #define for_each_hstate(h) \
 	for ((h) = hstates; (h) < &hstates[max_hstate]; (h)++)

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>