diff options
Diffstat (limited to 'mm')
-rw-r--r-- | mm/hugetlb.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 107c1ce223cb..2a2f6e869401 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c | |||
@@ -34,6 +34,7 @@ struct hstate hstates[HUGE_MAX_HSTATE]; | |||
34 | /* for command line parsing */ | 34 | /* for command line parsing */ |
35 | static struct hstate * __initdata parsed_hstate; | 35 | static struct hstate * __initdata parsed_hstate; |
36 | static unsigned long __initdata default_hstate_max_huge_pages; | 36 | static unsigned long __initdata default_hstate_max_huge_pages; |
37 | static unsigned long __initdata default_hstate_size; | ||
37 | 38 | ||
38 | #define for_each_hstate(h) \ | 39 | #define for_each_hstate(h) \ |
39 | for ((h) = hstates; (h) < &hstates[max_hstate]; (h)++) | 40 | for ((h) = hstates; (h) < &hstates[max_hstate]; (h)++) |
@@ -1288,11 +1289,14 @@ static int __init hugetlb_init(void) | |||
1288 | { | 1289 | { |
1289 | BUILD_BUG_ON(HPAGE_SHIFT == 0); | 1290 | BUILD_BUG_ON(HPAGE_SHIFT == 0); |
1290 | 1291 | ||
1291 | if (!size_to_hstate(HPAGE_SIZE)) { | 1292 | if (!size_to_hstate(default_hstate_size)) { |
1292 | hugetlb_add_hstate(HUGETLB_PAGE_ORDER); | 1293 | default_hstate_size = HPAGE_SIZE; |
1293 | parsed_hstate->max_huge_pages = default_hstate_max_huge_pages; | 1294 | if (!size_to_hstate(default_hstate_size)) |
1295 | hugetlb_add_hstate(HUGETLB_PAGE_ORDER); | ||
1294 | } | 1296 | } |
1295 | default_hstate_idx = size_to_hstate(HPAGE_SIZE) - hstates; | 1297 | default_hstate_idx = size_to_hstate(default_hstate_size) - hstates; |
1298 | if (default_hstate_max_huge_pages) | ||
1299 | default_hstate.max_huge_pages = default_hstate_max_huge_pages; | ||
1296 | 1300 | ||
1297 | hugetlb_init_hstates(); | 1301 | hugetlb_init_hstates(); |
1298 | 1302 | ||
@@ -1332,7 +1336,7 @@ void __init hugetlb_add_hstate(unsigned order) | |||
1332 | parsed_hstate = h; | 1336 | parsed_hstate = h; |
1333 | } | 1337 | } |
1334 | 1338 | ||
1335 | static int __init hugetlb_setup(char *s) | 1339 | static int __init hugetlb_nrpages_setup(char *s) |
1336 | { | 1340 | { |
1337 | unsigned long *mhp; | 1341 | unsigned long *mhp; |
1338 | static unsigned long *last_mhp; | 1342 | static unsigned long *last_mhp; |
@@ -1367,7 +1371,14 @@ static int __init hugetlb_setup(char *s) | |||
1367 | 1371 | ||
1368 | return 1; | 1372 | return 1; |
1369 | } | 1373 | } |
1370 | __setup("hugepages=", hugetlb_setup); | 1374 | __setup("hugepages=", hugetlb_nrpages_setup); |
1375 | |||
1376 | static int __init hugetlb_default_setup(char *s) | ||
1377 | { | ||
1378 | default_hstate_size = memparse(s, &s); | ||
1379 | return 1; | ||
1380 | } | ||
1381 | __setup("default_hugepagesz=", hugetlb_default_setup); | ||
1371 | 1382 | ||
1372 | static unsigned int cpuset_mems_nr(unsigned int *array) | 1383 | static unsigned int cpuset_mems_nr(unsigned int *array) |
1373 | { | 1384 | { |