linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [RFC] virtual memmap for sparsemem [2/2] for ia64.
@ 2006-10-19  8:23 KAMEZAWA Hiroyuki
  2006-10-19 15:23 ` Andy Whitcroft
  2006-10-19 16:41 ` Christoph Lameter
  0 siblings, 2 replies; 7+ messages in thread
From: KAMEZAWA Hiroyuki @ 2006-10-19  8:23 UTC (permalink / raw)
  To: linux-ia64; +Cc: linux-mm

vmemap_sparsemem support for ia64.
The same logic as CONFIG_VIRTUAL_MEMMAP is used for allocating virtual address range
for virtual memmap.

Signed-Off-By: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>


 arch/ia64/Kconfig          |    4 ++++
 arch/ia64/mm/discontig.c   |    5 ++++-
 arch/ia64/mm/init.c        |    4 +++-
 include/asm-ia64/pgtable.h |    2 +-
 4 files changed, 12 insertions(+), 3 deletions(-)

Index: linux-2.6.19-rc2/arch/ia64/mm/discontig.c
===================================================================
--- linux-2.6.19-rc2.orig/arch/ia64/mm/discontig.c	2006-10-19 09:12:06.000000000 +0900
+++ linux-2.6.19-rc2/arch/ia64/mm/discontig.c	2006-10-19 17:04:31.000000000 +0900
@@ -685,7 +685,10 @@
 	unsigned long max_zone_pfns[MAX_NR_ZONES];
 
 	max_dma = virt_to_phys((void *) MAX_DMA_ADDRESS) >> PAGE_SHIFT;
-
+#ifdef CONFIG_VMEMMAP_SPARSEMEM
+	vmalloc_end -= NR_MEM_SECTIONS * PAGES_PER_SECTION * sizeof(struct page);
+	init_vmemmap_sparsemem(vmalloc_end);
+#endif
 	arch_sparse_init();
 
 	efi_memmap_walk(filter_rsvd_memory, count_node_pages);
Index: linux-2.6.19-rc2/arch/ia64/Kconfig
===================================================================
--- linux-2.6.19-rc2.orig/arch/ia64/Kconfig	2006-10-19 09:12:06.000000000 +0900
+++ linux-2.6.19-rc2/arch/ia64/Kconfig	2006-10-19 17:04:31.000000000 +0900
@@ -333,6 +333,10 @@
 	def_bool y
 	depends on ARCH_DISCONTIGMEM_ENABLE
 
+config ARCH_VMEMMAP_SPARSEMEM_SUPPORT
+	def_bool y
+	depends on PGTABLE_4 && ARCH_SPARSEMEM_ENABLE
+
 config ARCH_DISCONTIGMEM_DEFAULT
 	def_bool y if (IA64_SGI_SN2 || IA64_GENERIC || IA64_HP_ZX1 || IA64_HP_ZX1_SWIOTLB)
 	depends on ARCH_DISCONTIGMEM_ENABLE
Index: linux-2.6.19-rc2/arch/ia64/mm/init.c
===================================================================
--- linux-2.6.19-rc2.orig/arch/ia64/mm/init.c	2006-10-19 09:12:06.000000000 +0900
+++ linux-2.6.19-rc2/arch/ia64/mm/init.c	2006-10-19 17:04:31.000000000 +0900
@@ -45,9 +45,11 @@
 
 unsigned long MAX_DMA_ADDRESS = PAGE_OFFSET + 0x100000000UL;
 
-#ifdef CONFIG_VIRTUAL_MEM_MAP
+#if defined(CONFIG_VIRTUAL_MEM_MAP) || defined(CONFIG_VMEMMAP_SPARSEMEM)
 unsigned long vmalloc_end = VMALLOC_END_INIT;
 EXPORT_SYMBOL(vmalloc_end);
+#endif
+#ifdef CONFIG_VIRTUAL_MEM_MAP
 struct page *vmem_map;
 EXPORT_SYMBOL(vmem_map);
 #endif
Index: linux-2.6.19-rc2/include/asm-ia64/pgtable.h
===================================================================
--- linux-2.6.19-rc2.orig/include/asm-ia64/pgtable.h	2006-10-19 09:12:06.000000000 +0900
+++ linux-2.6.19-rc2/include/asm-ia64/pgtable.h	2006-10-19 17:04:31.000000000 +0900
@@ -231,7 +231,7 @@
 #define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval)
 
 #define VMALLOC_START		(RGN_BASE(RGN_GATE) + 0x200000000UL)
-#ifdef CONFIG_VIRTUAL_MEM_MAP
+#if defined(CONFIG_VIRTUAL_MEM_MAP) || defined(CONFIG_VMEMMAP_SPARSEMEM)
 # define VMALLOC_END_INIT	(RGN_BASE(RGN_GATE) + (1UL << (4*PAGE_SHIFT - 9)))
 # define VMALLOC_END		vmalloc_end
   extern unsigned long vmalloc_end;

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFC] virtual memmap for sparsemem [2/2] for ia64.
  2006-10-19  8:23 [RFC] virtual memmap for sparsemem [2/2] for ia64 KAMEZAWA Hiroyuki
@ 2006-10-19 15:23 ` Andy Whitcroft
  2006-10-20  1:20   ` KAMEZAWA Hiroyuki
  2006-10-19 16:41 ` Christoph Lameter
  1 sibling, 1 reply; 7+ messages in thread
From: Andy Whitcroft @ 2006-10-19 15:23 UTC (permalink / raw)
  To: KAMEZAWA Hiroyuki; +Cc: linux-ia64, linux-mm

KAMEZAWA Hiroyuki wrote:
> vmemap_sparsemem support for ia64.
> The same logic as CONFIG_VIRTUAL_MEMMAP is used for allocating virtual address range
> for virtual memmap.
> 
> Signed-Off-By: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> 
> 
>  arch/ia64/Kconfig          |    4 ++++
>  arch/ia64/mm/discontig.c   |    5 ++++-
>  arch/ia64/mm/init.c        |    4 +++-
>  include/asm-ia64/pgtable.h |    2 +-
>  4 files changed, 12 insertions(+), 3 deletions(-)
> 
> Index: linux-2.6.19-rc2/arch/ia64/mm/discontig.c
> ===================================================================
> --- linux-2.6.19-rc2.orig/arch/ia64/mm/discontig.c	2006-10-19 09:12:06.000000000 +0900
> +++ linux-2.6.19-rc2/arch/ia64/mm/discontig.c	2006-10-19 17:04:31.000000000 +0900
> @@ -685,7 +685,10 @@
>  	unsigned long max_zone_pfns[MAX_NR_ZONES];
>  
>  	max_dma = virt_to_phys((void *) MAX_DMA_ADDRESS) >> PAGE_SHIFT;
> -
> +#ifdef CONFIG_VMEMMAP_SPARSEMEM
> +	vmalloc_end -= NR_MEM_SECTIONS * PAGES_PER_SECTION * sizeof(struct page);
> +	init_vmemmap_sparsemem(vmalloc_end);
> +#endif

I thought I saw that this macro was defined to nothing when
SPARSEMEM_VMEMMAP was undefined, so I'd expect you not to need the
#ifdef round it here.  If its not defined when SPARSEMEM isn't defined
then we should probabally change things so it is.  We do that for the
sparse_init() and sparse_index_init() in linux/mmzone.h, so it would
seem reasonable to do the same for this.

>  	arch_sparse_init();
>  
>  	efi_memmap_walk(filter_rsvd_memory, count_node_pages);
> Index: linux-2.6.19-rc2/arch/ia64/Kconfig
> ===================================================================
> --- linux-2.6.19-rc2.orig/arch/ia64/Kconfig	2006-10-19 09:12:06.000000000 +0900
> +++ linux-2.6.19-rc2/arch/ia64/Kconfig	2006-10-19 17:04:31.000000000 +0900
> @@ -333,6 +333,10 @@
>  	def_bool y
>  	depends on ARCH_DISCONTIGMEM_ENABLE
>  
> +config ARCH_VMEMMAP_SPARSEMEM_SUPPORT
> +	def_bool y
> +	depends on PGTABLE_4 && ARCH_SPARSEMEM_ENABLE
> +
>  config ARCH_DISCONTIGMEM_DEFAULT
>  	def_bool y if (IA64_SGI_SN2 || IA64_GENERIC || IA64_HP_ZX1 || IA64_HP_ZX1_SWIOTLB)
>  	depends on ARCH_DISCONTIGMEM_ENABLE
> Index: linux-2.6.19-rc2/arch/ia64/mm/init.c
> ===================================================================
> --- linux-2.6.19-rc2.orig/arch/ia64/mm/init.c	2006-10-19 09:12:06.000000000 +0900
> +++ linux-2.6.19-rc2/arch/ia64/mm/init.c	2006-10-19 17:04:31.000000000 +0900
> @@ -45,9 +45,11 @@
>  
>  unsigned long MAX_DMA_ADDRESS = PAGE_OFFSET + 0x100000000UL;
>  
> -#ifdef CONFIG_VIRTUAL_MEM_MAP
> +#if defined(CONFIG_VIRTUAL_MEM_MAP) || defined(CONFIG_VMEMMAP_SPARSEMEM)
>  unsigned long vmalloc_end = VMALLOC_END_INIT;
>  EXPORT_SYMBOL(vmalloc_end);
> +#endif
> +#ifdef CONFIG_VIRTUAL_MEM_MAP
>  struct page *vmem_map;
>  EXPORT_SYMBOL(vmem_map);
>  #endif
> Index: linux-2.6.19-rc2/include/asm-ia64/pgtable.h
> ===================================================================
> --- linux-2.6.19-rc2.orig/include/asm-ia64/pgtable.h	2006-10-19 09:12:06.000000000 +0900
> +++ linux-2.6.19-rc2/include/asm-ia64/pgtable.h	2006-10-19 17:04:31.000000000 +0900
> @@ -231,7 +231,7 @@
>  #define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval)
>  
>  #define VMALLOC_START		(RGN_BASE(RGN_GATE) + 0x200000000UL)
> -#ifdef CONFIG_VIRTUAL_MEM_MAP
> +#if defined(CONFIG_VIRTUAL_MEM_MAP) || defined(CONFIG_VMEMMAP_SPARSEMEM)
>  # define VMALLOC_END_INIT	(RGN_BASE(RGN_GATE) + (1UL << (4*PAGE_SHIFT - 9)))
>  # define VMALLOC_END		vmalloc_end
>    extern unsigned long vmalloc_end;

Well I have to say its nice to find there is basically zero architecture
specific code here.  You call init_vmemmap_sparsmem() (or whatever it
gets renamed to) with the base address, and thats it.

-apw

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFC] virtual memmap for sparsemem [2/2] for ia64.
  2006-10-19  8:23 [RFC] virtual memmap for sparsemem [2/2] for ia64 KAMEZAWA Hiroyuki
  2006-10-19 15:23 ` Andy Whitcroft
@ 2006-10-19 16:41 ` Christoph Lameter
  2006-10-20  1:35   ` KAMEZAWA Hiroyuki
  1 sibling, 1 reply; 7+ messages in thread
From: Christoph Lameter @ 2006-10-19 16:41 UTC (permalink / raw)
  To: KAMEZAWA Hiroyuki; +Cc: linux-ia64, linux-mm

On Thu, 19 Oct 2006, KAMEZAWA Hiroyuki wrote:

> +config ARCH_VMEMMAP_SPARSEMEM_SUPPORT
> +	def_bool y
> +	depends on PGTABLE_4 && ARCH_SPARSEMEM_ENABLE

Why do you need to depend on 4 level page tables?

> +#if defined(CONFIG_VIRTUAL_MEM_MAP) || defined(CONFIG_VMEMMAP_SPARSEMEM)
>  unsigned long vmalloc_end = VMALLOC_END_INIT;

I'd rather stop tinkering around with vmalloc_end. See my patches that I 
posted last week to realize virtual memmap.

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFC] virtual memmap for sparsemem [2/2] for ia64.
  2006-10-19 15:23 ` Andy Whitcroft
@ 2006-10-20  1:20   ` KAMEZAWA Hiroyuki
  0 siblings, 0 replies; 7+ messages in thread
From: KAMEZAWA Hiroyuki @ 2006-10-20  1:20 UTC (permalink / raw)
  To: Andy Whitcroft; +Cc: linux-ia64, linux-mm

On Thu, 19 Oct 2006 16:23:07 +0100
Andy Whitcroft <apw@shadowen.org> wrote:

>
> > +#ifdef CONFIG_VMEMMAP_SPARSEMEM
> > +	vmalloc_end -= NR_MEM_SECTIONS * PAGES_PER_SECTION * sizeof(struct page);
> > +	init_vmemmap_sparsemem(vmalloc_end);
> > +#endif
> 
> I thought I saw that this macro was defined to nothing when
> SPARSEMEM_VMEMMAP was undefined, so I'd expect you not to need the
> #ifdef round it here.  If its not defined when SPARSEMEM isn't defined
> then we should probabally change things so it is.  We do that for the
> sparse_init() and sparse_index_init() in linux/mmzone.h, so it would
> seem reasonable to do the same for this.
> 
Okay, I'll check it.

-Kame

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFC] virtual memmap for sparsemem [2/2] for ia64.
  2006-10-19 16:41 ` Christoph Lameter
@ 2006-10-20  1:35   ` KAMEZAWA Hiroyuki
  2006-10-20  1:45     ` Christoph Lameter
  0 siblings, 1 reply; 7+ messages in thread
From: KAMEZAWA Hiroyuki @ 2006-10-20  1:35 UTC (permalink / raw)
  To: Christoph Lameter; +Cc: linux-ia64, linux-mm

On Thu, 19 Oct 2006 09:41:19 -0700 (PDT)
Christoph Lameter <clameter@sgi.com> wrote:

> On Thu, 19 Oct 2006, KAMEZAWA Hiroyuki wrote:
> 
> > +config ARCH_VMEMMAP_SPARSEMEM_SUPPORT
> > +	def_bool y
> > +	depends on PGTABLE_4 && ARCH_SPARSEMEM_ENABLE
> 
> Why do you need to depend on 4 level page tables?
> 
It's based on how big page-table can map. (I'm sorry if my calculation is wrong..)

Maximun phyisical address size of Itanium2 looks 50bits. Then, we need
sizeof (struct page) * (50 - PAGE_SHIFT) size of virtual address space.

#define PTRS_PER_PTD_SHIFT      (PAGE_SHIFT-3)
#define PTRS_PER_PTE    (__IA64_UL(1) << (PTRS_PER_PTD_SHIFT))
#define PMD_SHIFT       (PAGE_SHIFT + (PTRS_PER_PTD_SHIFT))
#define PUD_SHIFT       (PMD_SHIFT + (PTRS_PER_PTD_SHIFT))

#ifdef CONFIG_PGTABLE_4
#define PGDIR_SHIFT             (PUD_SHIFT + (PTRS_PER_PTD_SHIFT))
#else
#define PGDIR_SHIFT             (PMD_SHIFT + (PTRS_PER_PTD_SHIFT))
#endif

Then, considering PAGE_SHIFT=14 case, 
4-level-page-table mapsize:(1 << (4 * PAGE_SHIFT - 9) -> (1 << 47)
3-level-page-table mapsize:(1 << (3 * PAGE_SHIFT - 6) -> (1 << 36)

we need 4 level.


> > +#if defined(CONFIG_VIRTUAL_MEM_MAP) || defined(CONFIG_VMEMMAP_SPARSEMEM)
> >  unsigned long vmalloc_end = VMALLOC_END_INIT;
> 
> I'd rather stop tinkering around with vmalloc_end. See my patches that I 
> posted last week to realize virtual memmap.
Okay, I'll look into.

-Kame

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFC] virtual memmap for sparsemem [2/2] for ia64.
  2006-10-20  1:35   ` KAMEZAWA Hiroyuki
@ 2006-10-20  1:45     ` Christoph Lameter
  2006-10-20  2:08       ` KAMEZAWA Hiroyuki
  0 siblings, 1 reply; 7+ messages in thread
From: Christoph Lameter @ 2006-10-20  1:45 UTC (permalink / raw)
  To: KAMEZAWA Hiroyuki; +Cc: linux-ia64, linux-mm

On Fri, 20 Oct 2006, KAMEZAWA Hiroyuki wrote:

> Maximun phyisical address size of Itanium2 looks 50bits. Then, we need
> sizeof (struct page) * (50 - PAGE_SHIFT) size of virtual address space.

Right. That is 4TB which can be a portion of the 128TB VMALLOC space. Have 
you seen my patchset that does the calculation on linux-ia674?

> 
> #ifdef CONFIG_PGTABLE_4
> #define PGDIR_SHIFT             (PUD_SHIFT + (PTRS_PER_PTD_SHIFT))
> #else
> #define PGDIR_SHIFT             (PMD_SHIFT + (PTRS_PER_PTD_SHIFT))
> #endif
> 
> Then, considering PAGE_SHIFT=14 case, 
> 4-level-page-table mapsize:(1 << (4 * PAGE_SHIFT - 9) -> (1 << 47)
> 3-level-page-table mapsize:(1 << (3 * PAGE_SHIFT - 6) -> (1 << 36)

You are missing one PAGE_SHIFT (the page that is referred to !)

3 level is 47. 4 level is 58. 

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFC] virtual memmap for sparsemem [2/2] for ia64.
  2006-10-20  1:45     ` Christoph Lameter
@ 2006-10-20  2:08       ` KAMEZAWA Hiroyuki
  0 siblings, 0 replies; 7+ messages in thread
From: KAMEZAWA Hiroyuki @ 2006-10-20  2:08 UTC (permalink / raw)
  To: Christoph Lameter; +Cc: linux-ia64, linux-mm

On Thu, 19 Oct 2006 18:45:18 -0700 (PDT)
Christoph Lameter <clameter@sgi.com> wrote:

> > Then, considering PAGE_SHIFT=14 case, 
> > 4-level-page-table mapsize:(1 << (4 * PAGE_SHIFT - 9) -> (1 << 47)
> > 3-level-page-table mapsize:(1 << (3 * PAGE_SHIFT - 6) -> (1 << 36)
> 
> You are missing one PAGE_SHIFT (the page that is referred to !)
> 
> 3 level is 47. 4 level is 58. 
> 
(>_<)!!!

Thank you
-Kame

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2006-10-20  2:08 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-10-19  8:23 [RFC] virtual memmap for sparsemem [2/2] for ia64 KAMEZAWA Hiroyuki
2006-10-19 15:23 ` Andy Whitcroft
2006-10-20  1:20   ` KAMEZAWA Hiroyuki
2006-10-19 16:41 ` Christoph Lameter
2006-10-20  1:35   ` KAMEZAWA Hiroyuki
2006-10-20  1:45     ` Christoph Lameter
2006-10-20  2:08       ` KAMEZAWA Hiroyuki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox