From: Zou Nan hai <nanhai.zou@intel.com>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Linux-IA64 <linux-ia64@vger.kernel.org>,
Luck@vger.kernel.org, Tony <tony.luck@intel.com>,
Chen@vger.kernel.org, Kenneth W <kenneth.w.chen@intel.com>
Subject: Re: [PATCH 2/8] IA64 various hugepage size - Add the is_valid_hpage_size function
Date: 14 Apr 2006 08:34:42 +0800 [thread overview]
Message-ID: <1144974881.5817.59.camel@linux-znh> (raw)
In-Reply-To: <1144974667.5817.51.camel@linux-znh>
Add a function is_valid_hpage_size
Signed-off-by: Zou Nan hai <nanhai.zou@intel.com>
diff -Nraup a/arch/ia64/mm/hugetlbpage.c b/arch/ia64/mm/hugetlbpage.c
--- a/arch/ia64/mm/hugetlbpage.c 2006-04-11 08:52:02.000000000 +0800
+++ b/arch/ia64/mm/hugetlbpage.c 2006-04-11 09:00:37.000000000 +0800
@@ -159,28 +159,15 @@ unsigned long hugetlb_get_unmapped_area(
static int __init hugetlb_setup_sz(char *str)
{
- u64 tr_pages;
unsigned long long size;
- if (ia64_pal_vm_page_size(&tr_pages, NULL) != 0)
- /*
- * shouldn't happen, but just in case.
- */
- tr_pages = 0x15557000UL;
-
size = memparse(str, &str);
- if (*str || (size & (size-1)) || !(tr_pages & size) ||
- size <= PAGE_SIZE ||
- size >= (1UL << PAGE_SHIFT << MAX_ORDER)) {
+ if (*str || !is_valid_hpage_size(size)) {
printk(KERN_WARNING "Invalid huge page size specified\n");
return 1;
}
hpage_shift = __ffs(size);
- /*
- * boot cpu already executed ia64_mmu_init, and has HPAGE_SHIFT_DEFAULT
- * override here with new page shift.
- */
ia64_set_rr(HPAGE_REGION_BASE, hpage_shift << 2);
return 1;
}
@@ -191,3 +178,18 @@ void hugepage_size_init(struct mm_struct
mm->hugepage_shift = hpage_shift;
}
+int is_valid_hpage_size(unsigned long long size)
+{
+ u64 tr_pages;
+ if (ia64_pal_vm_page_size(&tr_pages, NULL) != 0)
+ /*
+ * shouldn't happen, but just in case.
+ */
+ tr_pages = 0x15557000UL;
+ if((size & (size-1)) || !(tr_pages & size) ||
+ size <= PAGE_SIZE ||
+ size >= (1UL << PAGE_SHIFT << MAX_ORDER))
+ return 0;
+ return 1;
+}
+
diff -Nraup a/include/linux/mm.h b/include/linux/mm.h
--- a/include/linux/mm.h 2006-04-11 08:52:00.000000000 +0800
+++ b/include/linux/mm.h 2006-04-11 09:17:36.000000000 +0800
@@ -1061,8 +1061,13 @@ extern int randomize_va_space;
#ifndef ARCH_HAS_VARIABLE_HUGEPAGE_SIZE
#define hugepage_size_init(mm)
+static inline int is_valid_hpage_size(unsigned long long size)
+{
+ return 1;
+}
#else
extern void hugepage_size_init(struct mm_struct *mm);
+extern int is_valid_hpage_size(unsigned long long size);
#endif
#endif /* __KERNEL__ */
next prev parent reply other threads:[~2006-04-14 2:17 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-04-14 0:26 [PATCH 0/8] IA64 various hugepage size - Overview Zou Nan hai
2006-04-14 0:31 ` [PATCH 1/8] IA64 various hugepage size - Add a variable to mm structure Zou Nan hai
2006-04-14 0:34 ` Zou Nan hai [this message]
2006-04-14 0:41 ` [PATCH 3/8] IA64 various hugepage size - Add a mount option to hugetlbfs Zou Nan hai
2006-04-14 0:45 ` [PATCH 4/8] IA64 various hugepage size - modify HPAGE related macros Zou Nan hai
2006-04-14 0:49 ` [PATCH 5/8] IA64 various hugepage size - mount more hugetlb fs for SHM Zou Nan hai
2006-04-14 0:52 ` [PATCH 6/8] IA64 various hugepage size - introduce prctl options to set/get hugepage size Zou Nan hai
2006-04-14 0:57 ` [PATCH 7/8] IA64 various hugepage size - Add proc control to reserve and free Zou Nan hai
2006-04-14 1:00 ` [PATCH 8/8] IA64 various hugepage size - Modify kernel document Zou Nan hai
2006-04-14 3:12 ` Randy.Dunlap
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1144974881.5817.59.camel@linux-znh \
--to=nanhai.zou@intel.com \
--cc=Chen@vger.kernel.org \
--cc=Luck@vger.kernel.org \
--cc=kenneth.w.chen@intel.com \
--cc=linux-ia64@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tony.luck@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox