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 1/8] IA64 various hugepage size - Add a variable to mm structure
Date: 14 Apr 2006 08:31:07 +0800 [thread overview]
Message-ID: <1144974667.5817.51.camel@linux-znh> (raw)
In-Reply-To: <1144974367.5817.39.camel@linux-znh>
Add a hugepage_shift member to struct mm to make huge page size
a per mm structure.
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 07:42:09.000000000 +0800
+++ b/arch/ia64/mm/hugetlbpage.c 2006-04-11 08:31:20.000000000 +0800
@@ -185,3 +185,9 @@ static int __init hugetlb_setup_sz(char
return 1;
}
__setup("hugepagesz=", hugetlb_setup_sz);
+
+void hugepage_size_init(struct mm_struct *mm)
+{
+ mm->hugepage_shift = hpage_shift;
+}
+
diff -Nraup a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c
--- a/arch/ia64/mm/init.c 2006-04-11 07:42:09.000000000 +0800
+++ b/arch/ia64/mm/init.c 2006-04-11 08:22:24.000000000 +0800
@@ -408,11 +408,6 @@ ia64_mmu_init (void *my_cpu_data)
ia64_set_pta(pta | (0 << 8) | (vmlpt_bits << 2) | VHPT_ENABLE_BIT);
ia64_tlb_init();
-
-#ifdef CONFIG_HUGETLB_PAGE
- ia64_set_rr(HPAGE_REGION_BASE, HPAGE_SHIFT << 2);
- ia64_srlz_d();
-#endif
}
#ifdef CONFIG_VIRTUAL_MEM_MAP
diff -Nraup a/include/asm-ia64/mmu_context.h b/include/asm-ia64/mmu_context.h
--- a/include/asm-ia64/mmu_context.h 2006-03-20 13:53:29.000000000 +0800
+++ b/include/asm-ia64/mmu_context.h 2006-04-11 08:29:03.000000000 +0800
@@ -127,13 +127,12 @@ destroy_context (struct mm_struct *mm)
}
static inline void
-reload_context (nv_mm_context_t context)
+reload_context (struct mm_struct *mm, nv_mm_context_t context)
{
unsigned long rid;
unsigned long rid_incr = 0;
- unsigned long rr0, rr1, rr2, rr3, rr4, old_rr4;
+ unsigned long rr0, rr1, rr2, rr3, rr4;
- old_rr4 = ia64_get_rr(RGN_BASE(RGN_HPAGE));
rid = context << 3; /* make space for encoding the region number */
rid_incr = 1 << 8;
@@ -144,7 +143,10 @@ reload_context (nv_mm_context_t context)
rr3 = rr0 + 3*rid_incr;
rr4 = rr0 + 4*rid_incr;
#ifdef CONFIG_HUGETLB_PAGE
- rr4 = (rr4 & (~(0xfcUL))) | (old_rr4 & 0xfc);
+ {
+ unsigned long ps = mm->hugepage_shift << 2;
+ rr4 = ((rr4 & (~(0xfcUL))) | ps);
+ }
# if RGN_HPAGE != 4
# error "reload_context assumes RGN_HPAGE is 4"
@@ -171,7 +173,7 @@ activate_context (struct mm_struct *mm)
context = get_mmu_context(mm);
if (!cpu_isset(smp_processor_id(), mm->cpu_vm_mask))
cpu_set(smp_processor_id(), mm->cpu_vm_mask);
- reload_context(context);
+ reload_context(mm, context);
/*
* in the unlikely event of a TLB-flush by another thread,
* redo the load.
diff -Nraup a/include/asm-ia64/page.h b/include/asm-ia64/page.h
--- a/include/asm-ia64/page.h 2006-04-11 07:42:12.000000000 +0800
+++ b/include/asm-ia64/page.h 2006-04-11 08:18:59.000000000 +0800
@@ -59,6 +59,7 @@
# define ARCH_HAS_HUGEPAGE_ONLY_RANGE
# define ARCH_HAS_PREPARE_HUGEPAGE_RANGE
# define ARCH_HAS_HUGETLB_FREE_PGD_RANGE
+# define ARCH_HAS_VARIABLE_HUGEPAGE_SIZE
#endif /* CONFIG_HUGETLB_PAGE */
#ifdef __ASSEMBLY__
diff -Nraup a/include/linux/mm.h b/include/linux/mm.h
--- a/include/linux/mm.h 2006-04-11 07:42:12.000000000 +0800
+++ b/include/linux/mm.h 2006-04-11 08:24:09.000000000 +0800
@@ -1059,5 +1059,11 @@ void drop_slab(void);
extern int randomize_va_space;
#endif
+#ifndef ARCH_HAS_VARIABLE_HUGEPAGE_SIZE
+#define hugepage_size_init(mm)
+#else
+extern void hugepage_size_init(struct mm_struct *mm);
+#endif
+
#endif /* __KERNEL__ */
#endif /* _LINUX_MM_H */
diff -Nraup a/include/linux/sched.h b/include/linux/sched.h
--- a/include/linux/sched.h 2006-04-11 07:42:12.000000000 +0800
+++ b/include/linux/sched.h 2006-04-11 08:17:31.000000000 +0800
@@ -350,6 +350,9 @@ struct mm_struct {
/* aio bits */
rwlock_t ioctx_list_lock;
struct kioctx *ioctx_list;
+#ifdef ARCH_HAS_VARIABLE_HUGEPAGE_SIZE
+ unsigned int hugepage_shift;
+#endif
};
struct sighand_struct {
diff -Nraup a/kernel/fork.c b/kernel/fork.c
--- a/kernel/fork.c 2006-04-11 07:42:12.000000000 +0800
+++ b/kernel/fork.c 2006-04-11 08:25:32.000000000 +0800
@@ -333,6 +333,7 @@ static struct mm_struct * mm_init(struct
mm->ioctx_list = NULL;
mm->free_area_cache = TASK_UNMAPPED_BASE;
mm->cached_hole_size = ~0UL;
+ hugepage_size_init(mm);
if (likely(!mm_alloc_pgd(mm))) {
mm->def_flags = 0;
next prev parent reply other threads:[~2006-04-14 2:13 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 ` Zou Nan hai [this message]
2006-04-14 0:34 ` [PATCH 2/8] IA64 various hugepage size - Add the is_valid_hpage_size function Zou Nan hai
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=1144974667.5817.51.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