public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Amerigo Wang <xiyou.wangcong@gmail.com>
To: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"akpm@linux-foundation.org" <akpm@linux-foundation.org>
Subject: Re: [PATCH 2/4] kcore: add kclist type
Date: Wed, 22 Jul 2009 14:00:47 +0800	[thread overview]
Message-ID: <20090722060047.GC6281@cr0.nay.redhat.com> (raw)
In-Reply-To: <20090722140813.e8f04793.kamezawa.hiroyu@jp.fujitsu.com>

On Wed, Jul 22, 2009 at 02:08:13PM +0900, KAMEZAWA Hiroyuki wrote:
>From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
>
>Now, kclist_add() only eats start address and size as its arguments.
>Considering to make kclist dynamically reconfigulable, it's necessary
>to know which kclists are for System RAM and whic is not.
>
>This patch add kclist types as
>  KCORE_RAM
>  KCORE_VMALLOC
>  KCORE_TEXT
>  KCORE_OTHER
>
>region for KCORE_RAM will be dynamically updated at memory hotplug.


The idea is good, but will it be used in any of your latter patches?
I don't see it, can you point it out?

Thanks.

Reviewed-by: WANG Cong <xiyou.wangcong@gmail.com>


>
>Chnagelog v1->v2
> - no changes.
>
>Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
>---
> arch/ia64/mm/init.c       |    7 ++++---
> arch/mips/mm/init.c       |    7 ++++---
> arch/powerpc/mm/init_32.c |    4 ++--
> arch/powerpc/mm/init_64.c |    5 +++--
> arch/sh/mm/init.c         |    4 ++--
> arch/x86/mm/init_32.c     |    4 ++--
> arch/x86/mm/init_64.c     |   11 ++++++-----
> fs/proc/kcore.c           |    3 ++-
> include/linux/proc_fs.h   |   13 +++++++++++--
> 9 files changed, 36 insertions(+), 22 deletions(-)
>
>Index: mmotm-2.6.31-Jul16/include/linux/proc_fs.h
>===================================================================
>--- mmotm-2.6.31-Jul16.orig/include/linux/proc_fs.h
>+++ mmotm-2.6.31-Jul16/include/linux/proc_fs.h
>@@ -78,10 +78,18 @@ struct proc_dir_entry {
> 	struct list_head pde_openers;	/* who did ->open, but not ->release */
> };
> 
>+enum kcore_type {
>+	KCORE_TEXT,
>+	KCORE_VMALLOC,
>+	KCORE_RAM,
>+	KCORE_OTHER,
>+};
>+
> struct kcore_list {
> 	struct list_head list;
> 	unsigned long addr;
> 	size_t size;
>+	int type;
> };
> 
> struct vmcore {
>@@ -233,11 +241,12 @@ static inline void dup_mm_exe_file(struc
> #endif /* CONFIG_PROC_FS */
> 
> #if !defined(CONFIG_PROC_KCORE)
>-static inline void kclist_add(struct kcore_list *new, void *addr, size_t size)
>+static inline void
>+kclist_add(struct kcore_list *new, void *addr, size_t size, int type)
> {
> }
> #else
>-extern void kclist_add(struct kcore_list *, void *, size_t);
>+extern void kclist_add(struct kcore_list *, void *, size_t, int type);
> #endif
> 
> union proc_op {
>Index: mmotm-2.6.31-Jul16/arch/ia64/mm/init.c
>===================================================================
>--- mmotm-2.6.31-Jul16.orig/arch/ia64/mm/init.c
>+++ mmotm-2.6.31-Jul16/arch/ia64/mm/init.c
>@@ -639,9 +639,10 @@ mem_init (void)
> 
> 	high_memory = __va(max_low_pfn * PAGE_SIZE);
> 
>-	kclist_add(&kcore_mem, __va(0), max_low_pfn * PAGE_SIZE);
>-	kclist_add(&kcore_vmem, (void *)VMALLOC_START, VMALLOC_END-VMALLOC_START);
>-	kclist_add(&kcore_kernel, _stext, _end - _stext);
>+	kclist_add(&kcore_mem, __va(0), max_low_pfn * PAGE_SIZE, KCORE_RAM);
>+	kclist_add(&kcore_vmem, (void *)VMALLOC_START,
>+			VMALLOC_END-VMALLOC_START, KCORE_VMALLOC);
>+	kclist_add(&kcore_kernel, _stext, _end - _stext, KCORE_TEXT);
> 
> 	for_each_online_pgdat(pgdat)
> 		if (pgdat->bdata->node_bootmem_map)
>Index: mmotm-2.6.31-Jul16/arch/mips/mm/init.c
>===================================================================
>--- mmotm-2.6.31-Jul16.orig/arch/mips/mm/init.c
>+++ mmotm-2.6.31-Jul16/arch/mips/mm/init.c
>@@ -409,11 +409,12 @@ void __init mem_init(void)
> 	if ((unsigned long) &_text > (unsigned long) CKSEG0)
> 		/* The -4 is a hack so that user tools don't have to handle
> 		   the overflow.  */
>-		kclist_add(&kcore_kseg0, (void *) CKSEG0, 0x80000000 - 4);
>+		kclist_add(&kcore_kseg0, (void *) CKSEG0,
>+				0x80000000 - 4, KCORE_TEXT);
> #endif
>-	kclist_add(&kcore_mem, __va(0), max_low_pfn << PAGE_SHIFT);
>+	kclist_add(&kcore_mem, __va(0), max_low_pfn << PAGE_SHIFT, KCORE_RAM);
> 	kclist_add(&kcore_vmalloc, (void *)VMALLOC_START,
>-		   VMALLOC_END-VMALLOC_START);
>+		   VMALLOC_END-VMALLOC_START, KCORE_VMALLOC);
> 
> 	printk(KERN_INFO "Memory: %luk/%luk available (%ldk kernel code, "
> 	       "%ldk reserved, %ldk data, %ldk init, %ldk highmem)\n",
>Index: mmotm-2.6.31-Jul16/arch/powerpc/mm/init_32.c
>===================================================================
>--- mmotm-2.6.31-Jul16.orig/arch/powerpc/mm/init_32.c
>+++ mmotm-2.6.31-Jul16/arch/powerpc/mm/init_32.c
>@@ -270,11 +270,11 @@ static int __init setup_kcore(void)
> 						size);
> 		}
> 
>-		kclist_add(kcore_mem, __va(base), size);
>+		kclist_add(kcore_mem, __va(base), size, KCORE_RAM);
> 	}
> 
> 	kclist_add(&kcore_vmem, (void *)VMALLOC_START,
>-		VMALLOC_END-VMALLOC_START);
>+		VMALLOC_END-VMALLOC_START, KCORE_VMALLOC);
> 
> 	return 0;
> }
>Index: mmotm-2.6.31-Jul16/arch/powerpc/mm/init_64.c
>===================================================================
>--- mmotm-2.6.31-Jul16.orig/arch/powerpc/mm/init_64.c
>+++ mmotm-2.6.31-Jul16/arch/powerpc/mm/init_64.c
>@@ -128,10 +128,11 @@ static int __init setup_kcore(void)
> 		if (!kcore_mem)
> 			panic("%s: kmalloc failed\n", __func__);
> 
>-		kclist_add(kcore_mem, __va(base), size);
>+		kclist_add(kcore_mem, __va(base), size, KCORE_RAM);
> 	}
> 
>-	kclist_add(&kcore_vmem, (void *)VMALLOC_START, VMALLOC_END-VMALLOC_START);
>+	kclist_add(&kcore_vmem, (void *)VMALLOC_START,
>+		VMALLOC_END-VMALLOC_START, KCORE_VMALLOC);
> 
> 	return 0;
> }
>Index: mmotm-2.6.31-Jul16/arch/sh/mm/init.c
>===================================================================
>--- mmotm-2.6.31-Jul16.orig/arch/sh/mm/init.c
>+++ mmotm-2.6.31-Jul16/arch/sh/mm/init.c
>@@ -218,9 +218,9 @@ void __init mem_init(void)
> 	datasize =  (unsigned long) &_edata - (unsigned long) &_etext;
> 	initsize =  (unsigned long) &__init_end - (unsigned long) &__init_begin;
> 
>-	kclist_add(&kcore_mem, __va(0), max_low_pfn << PAGE_SHIFT);
>+	kclist_add(&kcore_mem, __va(0), max_low_pfn << PAGE_SHIFT, KCORE_RAM);
> 	kclist_add(&kcore_vmalloc, (void *)VMALLOC_START,
>-		   VMALLOC_END - VMALLOC_START);
>+		   VMALLOC_END - VMALLOC_START, KCORE_VMALLOC);
> 
> 	printk(KERN_INFO "Memory: %luk/%luk available (%dk kernel code, "
> 	       "%dk data, %dk init)\n",
>Index: mmotm-2.6.31-Jul16/arch/x86/mm/init_32.c
>===================================================================
>--- mmotm-2.6.31-Jul16.orig/arch/x86/mm/init_32.c
>+++ mmotm-2.6.31-Jul16/arch/x86/mm/init_32.c
>@@ -886,9 +886,9 @@ void __init mem_init(void)
> 	datasize =  (unsigned long) &_edata - (unsigned long) &_etext;
> 	initsize =  (unsigned long) &__init_end - (unsigned long) &__init_begin;
> 
>-	kclist_add(&kcore_mem, __va(0), max_low_pfn << PAGE_SHIFT);
>+	kclist_add(&kcore_mem, __va(0), max_low_pfn << PAGE_SHIFT, KCORE_RAM);
> 	kclist_add(&kcore_vmalloc, (void *)VMALLOC_START,
>-		   VMALLOC_END-VMALLOC_START);
>+		   VMALLOC_END-VMALLOC_START, KCORE_VMALLOC);
> 
> 	printk(KERN_INFO "Memory: %luk/%luk available (%dk kernel code, "
> 			"%dk reserved, %dk data, %dk init, %ldk highmem)\n",
>Index: mmotm-2.6.31-Jul16/arch/x86/mm/init_64.c
>===================================================================
>--- mmotm-2.6.31-Jul16.orig/arch/x86/mm/init_64.c
>+++ mmotm-2.6.31-Jul16/arch/x86/mm/init_64.c
>@@ -677,13 +677,14 @@ void __init mem_init(void)
> 	initsize =  (unsigned long) &__init_end - (unsigned long) &__init_begin;
> 
> 	/* Register memory areas for /proc/kcore */
>-	kclist_add(&kcore_mem, __va(0), max_low_pfn << PAGE_SHIFT);
>+	kclist_add(&kcore_mem, __va(0), max_low_pfn << PAGE_SHIFT, KCORE_RAM);
> 	kclist_add(&kcore_vmalloc, (void *)VMALLOC_START,
>-		   VMALLOC_END-VMALLOC_START);
>-	kclist_add(&kcore_kernel, &_stext, _end - _stext);
>-	kclist_add(&kcore_modules, (void *)MODULES_VADDR, MODULES_LEN);
>+		   VMALLOC_END-VMALLOC_START, KCORE_VMALLOC);
>+	kclist_add(&kcore_kernel, &_stext, _end - _stext, KCORE_TEXT);
>+	kclist_add(&kcore_modules, (void *)MODULES_VADDR, MODULES_LEN,
>+			KCORE_OTHER);
> 	kclist_add(&kcore_vsyscall, (void *)VSYSCALL_START,
>-				 VSYSCALL_END - VSYSCALL_START);
>+			 VSYSCALL_END - VSYSCALL_START, KCORE_OTHER);
> 
> 	printk(KERN_INFO "Memory: %luk/%luk available (%ldk kernel code, "
> 			 "%ldk absent, %ldk reserved, %ldk data, %ldk init)\n",
>Index: mmotm-2.6.31-Jul16/fs/proc/kcore.c
>===================================================================
>--- mmotm-2.6.31-Jul16.orig/fs/proc/kcore.c
>+++ mmotm-2.6.31-Jul16/fs/proc/kcore.c
>@@ -62,10 +62,11 @@ static LIST_HEAD(kclist_head);
> static DEFINE_RWLOCK(kclist_lock);
> 
> void
>-kclist_add(struct kcore_list *new, void *addr, size_t size)
>+kclist_add(struct kcore_list *new, void *addr, size_t size, int type)
> {
> 	new->addr = (unsigned long)addr;
> 	new->size = size;
>+	new->type = type;
> 
> 	write_lock(&kclist_lock);
> 	list_add_tail(&new->list, &kclist_head);
>
>--
>To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
>the body of a message to majordomo@vger.kernel.org
>More majordomo info at  http://vger.kernel.org/majordomo-info.html
>Please read the FAQ at  http://www.tux.org/lkml/

  reply	other threads:[~2009-07-22  5:58 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-22  5:06 [PATCH 0/4] kcore: cleanup and fix bahavior to find physcal memory range v2 KAMEZAWA Hiroyuki
2009-07-22  5:07 ` [PATCH 1/4] kcore: clean up to use generic list ops KAMEZAWA Hiroyuki
2009-07-22  5:53   ` Amerigo Wang
2009-07-22  5:08 ` [PATCH 2/4] kcore: add kclist type KAMEZAWA Hiroyuki
2009-07-22  6:00   ` Amerigo Wang [this message]
2009-07-22  6:05     ` KAMEZAWA Hiroyuki
2009-07-22  5:10 ` [PATCH 3/4] kcore: build physical memory direct map information in proper way KAMEZAWA Hiroyuki
2009-07-22  6:09   ` Amerigo Wang
2009-07-22  6:08     ` KAMEZAWA Hiroyuki
2009-07-22  5:12 ` [PATCH 4/4] kcore: remove noise from walk_memory_resource KAMEZAWA Hiroyuki
2009-07-22  6:21   ` Amerigo Wang
2009-07-22  6:22     ` KAMEZAWA Hiroyuki
2009-07-22  6:29       ` Amerigo Wang
2009-07-22  5:52 ` [PATCH 0/4] kcore: cleanup and fix bahavior to find physcal memory range v2 Amerigo Wang

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=20090722060047.GC6281@cr0.nay.redhat.com \
    --to=xiyou.wangcong@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    /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