diff options
author | Andi Kleen <ak@suse.de> | 2008-07-24 00:27:51 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-24 13:47:19 -0400 |
commit | b4718e628dbf68a2dee23b5709e2aa3190409c56 (patch) | |
tree | e685b2bd36a0fe731b128d2814996a693561d288 | |
parent | 39c11e6c05b7fedbf7ed4df3908b25f622d56204 (diff) |
x86: add hugepagesz option on 64-bit
Add an hugepagesz=... option similar to IA64, PPC etc. to x86-64.
This finally allows to select GB pages for hugetlbfs in x86 now that all
the infrastructure is in place.
Signed-off-by: Andi Kleen <ak@suse.de>
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>
-rw-r--r-- | Documentation/kernel-parameters.txt | 11 | ||||
-rw-r--r-- | arch/x86/mm/hugetlbpage.c | 17 | ||||
-rw-r--r-- | include/asm-x86/page.h | 2 |
3 files changed, 28 insertions, 2 deletions
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index 5e20ccb5a736..d55fd88fd0a9 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt | |||
@@ -774,8 +774,15 @@ and is between 256 and 4096 characters. It is defined in the file | |||
774 | hisax= [HW,ISDN] | 774 | hisax= [HW,ISDN] |
775 | See Documentation/isdn/README.HiSax. | 775 | See Documentation/isdn/README.HiSax. |
776 | 776 | ||
777 | hugepages= [HW,X86-32,IA-64] Maximal number of HugeTLB pages. | 777 | hugepages= [HW,X86-32,IA-64] HugeTLB pages to allocate at boot. |
778 | hugepagesz= [HW,IA-64,PPC] The size of the HugeTLB pages. | 778 | hugepagesz= [HW,IA-64,PPC,X86-64] The size of the HugeTLB pages. |
779 | On x86 this option can be specified multiple times | ||
780 | interleaved with hugepages= to reserve huge pages | ||
781 | of different sizes. Valid pages sizes on x86-64 | ||
782 | are 2M (when the CPU supports "pse") and 1G (when the | ||
783 | CPU supports the "pdpe1gb" cpuinfo flag) | ||
784 | Note that 1GB pages can only be allocated at boot time | ||
785 | using hugepages= and not freed afterwards. | ||
779 | 786 | ||
780 | i8042.direct [HW] Put keyboard port into non-translated mode | 787 | i8042.direct [HW] Put keyboard port into non-translated mode |
781 | i8042.dumbkbd [HW] Pretend that controller can only read data from | 788 | i8042.dumbkbd [HW] Pretend that controller can only read data from |
diff --git a/arch/x86/mm/hugetlbpage.c b/arch/x86/mm/hugetlbpage.c index b7a65a07af03..8f307d914c2e 100644 --- a/arch/x86/mm/hugetlbpage.c +++ b/arch/x86/mm/hugetlbpage.c | |||
@@ -425,3 +425,20 @@ hugetlb_get_unmapped_area(struct file *file, unsigned long addr, | |||
425 | 425 | ||
426 | #endif /*HAVE_ARCH_HUGETLB_UNMAPPED_AREA*/ | 426 | #endif /*HAVE_ARCH_HUGETLB_UNMAPPED_AREA*/ |
427 | 427 | ||
428 | #ifdef CONFIG_X86_64 | ||
429 | static __init int setup_hugepagesz(char *opt) | ||
430 | { | ||
431 | unsigned long ps = memparse(opt, &opt); | ||
432 | if (ps == PMD_SIZE) { | ||
433 | hugetlb_add_hstate(PMD_SHIFT - PAGE_SHIFT); | ||
434 | } else if (ps == PUD_SIZE && cpu_has_gbpages) { | ||
435 | hugetlb_add_hstate(PUD_SHIFT - PAGE_SHIFT); | ||
436 | } else { | ||
437 | printk(KERN_ERR "hugepagesz: Unsupported page size %lu M\n", | ||
438 | ps >> 20); | ||
439 | return 0; | ||
440 | } | ||
441 | return 1; | ||
442 | } | ||
443 | __setup("hugepagesz=", setup_hugepagesz); | ||
444 | #endif | ||
diff --git a/include/asm-x86/page.h b/include/asm-x86/page.h index 6c846228948d..6e02098b1605 100644 --- a/include/asm-x86/page.h +++ b/include/asm-x86/page.h | |||
@@ -32,6 +32,8 @@ | |||
32 | #define HPAGE_MASK (~(HPAGE_SIZE - 1)) | 32 | #define HPAGE_MASK (~(HPAGE_SIZE - 1)) |
33 | #define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT) | 33 | #define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT) |
34 | 34 | ||
35 | #define HUGE_MAX_HSTATE 2 | ||
36 | |||
35 | /* to align the pointer to the (next) page boundary */ | 37 | /* to align the pointer to the (next) page boundary */ |
36 | #define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK) | 38 | #define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK) |
37 | 39 | ||