Re: [RFC] memory hotremove patch take 2 [01/10] (counter of removable page)

2007-05-10 Thread KAMEZAWA Hiroyuki
On Thu, 10 May 2007 11:00:31 -0700 (PDT)
Christoph Lameter <[EMAIL PROTECTED]> wrote:

> On Wed, 9 May 2007, Yasunori Goto wrote:
> 
> >  
> > +unsigned int nr_free_movable_pages(void)
> > +{
> > +   unsigned long nr_pages = 0;
> > +   struct zone *zone;
> > +   int nid;
> > +
> > +   for_each_online_node(nid) {
> > +   zone = &(NODE_DATA(nid)->node_zones[ZONE_MOVABLE]);
> > +   nr_pages += zone_page_state(zone, NR_FREE_PAGES);
> > +   }
> > +   return nr_pages;
> > +}
> 
> 
> H... This is redoing what the vm counters already provide
> 
> Could you add
> 
> NR_MOVABLE_PAGES etc.
> 
> instead and then let the ZVC counter logic take care of the rest?
> 
Okay, we'll try ZVC.

Thanks,
-Kame

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC] memory hotremove patch take 2 [01/10] (counter of removable page)

2007-05-10 Thread KAMEZAWA Hiroyuki
On 10 May 2007 15:44:08 +0200
Andi Kleen <[EMAIL PROTECTED]> wrote:

> Yasunori Goto <[EMAIL PROTECTED]> writes:
> 
> 
> (not a full review, just something I noticed)
> > @@ -352,6 +352,8 @@ struct sysinfo {
> > unsigned short pad; /* explicit padding for m68k */
> > unsigned long totalhigh;/* Total high memory size */
> > unsigned long freehigh; /* Available high memory size */
> > +   unsigned long movable;  /* pages used only for data */
> > +   unsigned long free_movable; /* Avaiable pages in movable */
> 
> You can't just change that structure, it is exported to user space.
> 
Okay. We'll drop this.

Thanks,
-Kame

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC] memory hotremove patch take 2 [01/10] (counter of removable page)

2007-05-10 Thread Christoph Lameter
On Wed, 9 May 2007, Yasunori Goto wrote:

>  
> +unsigned int nr_free_movable_pages(void)
> +{
> + unsigned long nr_pages = 0;
> + struct zone *zone;
> + int nid;
> +
> + for_each_online_node(nid) {
> + zone = &(NODE_DATA(nid)->node_zones[ZONE_MOVABLE]);
> + nr_pages += zone_page_state(zone, NR_FREE_PAGES);
> + }
> + return nr_pages;
> +}


H... This is redoing what the vm counters already provide

Could you add

NR_MOVABLE_PAGES etc.

instead and then let the ZVC counter logic take care of the rest?

With a ZVC you will have the numbers in each zone and also in 
/proc/vmstat.

(Additional ulterior motive: If we ever get away from ZONE_MOVABLE and 
make movable a portion of each zone then this will still work)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC] memory hotremove patch take 2 [01/10] (counter of removable page)

2007-05-10 Thread Mel Gorman

On Wed, 9 May 2007, Yasunori Goto wrote:


Show #of Movable pages and vmstat.

Signed-Off-By: KAMEZAWA Hiroyuki <[EMAIL PROTECTED]>
Signed-off-by: Yasunori Goto <[EMAIL PROTECTED]>

arch/ia64/mm/init.c|2 ++
drivers/base/node.c|4 
fs/proc/proc_misc.c|4 
include/linux/kernel.h |2 ++
include/linux/swap.h   |1 +
mm/page_alloc.c|   22 ++
6 files changed, 35 insertions(+)

Index: current_test/mm/page_alloc.c
===
--- current_test.orig/mm/page_alloc.c   2007-05-08 15:06:50.0 +0900
+++ current_test/mm/page_alloc.c2007-05-08 15:08:36.0 +0900
@@ -58,6 +58,7 @@ unsigned long totalram_pages __read_most
unsigned long totalreserve_pages __read_mostly;
long nr_swap_pages;
int percpu_pagelist_fraction;
+unsigned long total_movable_pages __read_mostly;



Is it really necessary to have this as a separate value? It could be 
calculated at the same time as nr_free_movable_pages() seeing as that is 
called for meminfo anyway if the read was protected with 
zone_span_seqbegin()+zone_span_seqretry().



static void __free_pages_ok(struct page *page, unsigned int order);

@@ -1827,6 +1828,18 @@ static unsigned int nr_free_zone_pages(i
return sum;
}

+unsigned int nr_free_movable_pages(void)
+{
+   unsigned long nr_pages = 0;
+   struct zone *zone;
+   int nid;
+
+   for_each_online_node(nid) {
+   zone = &(NODE_DATA(nid)->node_zones[ZONE_MOVABLE]);
+   nr_pages += zone_page_state(zone, NR_FREE_PAGES);
+   }
+   return nr_pages;
+}
/*
 * Amount of free RAM allocatable within ZONE_DMA and ZONE_NORMAL
 */
@@ -1889,6 +1902,8 @@ void si_meminfo(struct sysinfo *val)
val->totalhigh = totalhigh_pages;
val->freehigh = nr_free_highpages();
val->mem_unit = PAGE_SIZE;
+   val->movable = total_movable_pages;
+   val->free_movable = nr_free_movable_pages();
}

EXPORT_SYMBOL(si_meminfo);
@@ -1908,6 +1923,11 @@ void si_meminfo_node(struct sysinfo *val
val->totalhigh = 0;
val->freehigh = 0;
#endif
+
+   val->movable = pgdat->node_zones[ZONE_MOVABLE].present_pages;


I think this has to be protected with zone_span_seqbegin()


+   val->free_movable = zone_page_state(&pgdat->node_zones[ZONE_MOVABLE],
+   NR_FREE_PAGES);
+
val->mem_unit = PAGE_SIZE;
}
#endif
@@ -3216,6 +3236,8 @@ static void __meminit free_area_init_cor

zone->spanned_pages = size;
zone->present_pages = realsize;
+   if (j == ZONE_MOVABLE)
+   total_movable_pages += realsize;


If total_movable_pages is calculated at the same time as free pages, 
this could go away. Similar for online_page() later



#ifdef CONFIG_NUMA
zone->node = nid;
zone->min_unmapped_pages = (realsize*sysctl_min_unmapped_ratio)
Index: current_test/include/linux/kernel.h
===
--- current_test.orig/include/linux/kernel.h2007-05-08 15:06:49.0 
+0900
+++ current_test/include/linux/kernel.h 2007-05-08 15:07:20.0 +0900
@@ -352,6 +352,8 @@ struct sysinfo {
unsigned short pad; /* explicit padding for m68k */
unsigned long totalhigh;/* Total high memory size */
unsigned long freehigh; /* Available high memory size */
+   unsigned long movable;  /* pages used only for data */
+   unsigned long free_movable; /* Avaiable pages in movable */
unsigned int mem_unit;  /* Memory unit size in bytes */
char _f[20-2*sizeof(long)-sizeof(int)]; /* Padding: libc5 uses this.. */
};
Index: current_test/fs/proc/proc_misc.c
===
--- current_test.orig/fs/proc/proc_misc.c   2007-05-08 15:06:48.0 
+0900
+++ current_test/fs/proc/proc_misc.c2007-05-08 15:07:20.0 +0900
@@ -161,6 +161,8 @@ static int meminfo_read_proc(char *page,
"LowTotal: %8lu kB\n"
"LowFree:  %8lu kB\n"
#endif
+   "MovableTotal: %8lu kB\n"
+   "MovableFree:  %8lu kB\n"
"SwapTotal:%8lu kB\n"
"SwapFree: %8lu kB\n"
"Dirty:%8lu kB\n"
@@ -191,6 +193,8 @@ static int meminfo_read_proc(char *page,
K(i.totalram-i.totalhigh),
K(i.freeram-i.freehigh),
#endif
+   K(i.movable),
+   K(i.free_movable),
K(i.totalswap),
K(i.freeswap),
K(global_page_state(NR_FILE_DIRTY)),
Index: current_test/drivers/base/node.c
===
--- current_test.orig/drivers/base/node.c   2007-05-08 15:06:10.0 
+0900
+++ current_test/drivers/base/node.c2007-05-08

Re: [RFC] memory hotremove patch take 2 [01/10] (counter of removable page)

2007-05-10 Thread Andi Kleen
Yasunori Goto <[EMAIL PROTECTED]> writes:


(not a full review, just something I noticed)
> @@ -352,6 +352,8 @@ struct sysinfo {
>   unsigned short pad; /* explicit padding for m68k */
>   unsigned long totalhigh;/* Total high memory size */
>   unsigned long freehigh; /* Available high memory size */
> + unsigned long movable;  /* pages used only for data */
> + unsigned long free_movable; /* Avaiable pages in movable */

You can't just change that structure, it is exported to user space.

-Andi
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[RFC] memory hotremove patch take 2 [01/10] (counter of removable page)

2007-05-08 Thread Yasunori Goto
Show #of Movable pages and vmstat.

Signed-Off-By: KAMEZAWA Hiroyuki <[EMAIL PROTECTED]>
Signed-off-by: Yasunori Goto <[EMAIL PROTECTED]>

 arch/ia64/mm/init.c|2 ++
 drivers/base/node.c|4 
 fs/proc/proc_misc.c|4 
 include/linux/kernel.h |2 ++
 include/linux/swap.h   |1 +
 mm/page_alloc.c|   22 ++
 6 files changed, 35 insertions(+)

Index: current_test/mm/page_alloc.c
===
--- current_test.orig/mm/page_alloc.c   2007-05-08 15:06:50.0 +0900
+++ current_test/mm/page_alloc.c2007-05-08 15:08:36.0 +0900
@@ -58,6 +58,7 @@ unsigned long totalram_pages __read_most
 unsigned long totalreserve_pages __read_mostly;
 long nr_swap_pages;
 int percpu_pagelist_fraction;
+unsigned long total_movable_pages __read_mostly;
 
 static void __free_pages_ok(struct page *page, unsigned int order);
 
@@ -1827,6 +1828,18 @@ static unsigned int nr_free_zone_pages(i
return sum;
 }
 
+unsigned int nr_free_movable_pages(void)
+{
+   unsigned long nr_pages = 0;
+   struct zone *zone;
+   int nid;
+
+   for_each_online_node(nid) {
+   zone = &(NODE_DATA(nid)->node_zones[ZONE_MOVABLE]);
+   nr_pages += zone_page_state(zone, NR_FREE_PAGES);
+   }
+   return nr_pages;
+}
 /*
  * Amount of free RAM allocatable within ZONE_DMA and ZONE_NORMAL
  */
@@ -1889,6 +1902,8 @@ void si_meminfo(struct sysinfo *val)
val->totalhigh = totalhigh_pages;
val->freehigh = nr_free_highpages();
val->mem_unit = PAGE_SIZE;
+   val->movable = total_movable_pages;
+   val->free_movable = nr_free_movable_pages();
 }
 
 EXPORT_SYMBOL(si_meminfo);
@@ -1908,6 +1923,11 @@ void si_meminfo_node(struct sysinfo *val
val->totalhigh = 0;
val->freehigh = 0;
 #endif
+
+   val->movable = pgdat->node_zones[ZONE_MOVABLE].present_pages;
+   val->free_movable = zone_page_state(&pgdat->node_zones[ZONE_MOVABLE],
+   NR_FREE_PAGES);
+
val->mem_unit = PAGE_SIZE;
 }
 #endif
@@ -3216,6 +3236,8 @@ static void __meminit free_area_init_cor
 
zone->spanned_pages = size;
zone->present_pages = realsize;
+   if (j == ZONE_MOVABLE)
+   total_movable_pages += realsize;
 #ifdef CONFIG_NUMA
zone->node = nid;
zone->min_unmapped_pages = (realsize*sysctl_min_unmapped_ratio)
Index: current_test/include/linux/kernel.h
===
--- current_test.orig/include/linux/kernel.h2007-05-08 15:06:49.0 
+0900
+++ current_test/include/linux/kernel.h 2007-05-08 15:07:20.0 +0900
@@ -352,6 +352,8 @@ struct sysinfo {
unsigned short pad; /* explicit padding for m68k */
unsigned long totalhigh;/* Total high memory size */
unsigned long freehigh; /* Available high memory size */
+   unsigned long movable;  /* pages used only for data */
+   unsigned long free_movable; /* Avaiable pages in movable */
unsigned int mem_unit;  /* Memory unit size in bytes */
char _f[20-2*sizeof(long)-sizeof(int)]; /* Padding: libc5 uses this.. */
 };
Index: current_test/fs/proc/proc_misc.c
===
--- current_test.orig/fs/proc/proc_misc.c   2007-05-08 15:06:48.0 
+0900
+++ current_test/fs/proc/proc_misc.c2007-05-08 15:07:20.0 +0900
@@ -161,6 +161,8 @@ static int meminfo_read_proc(char *page,
"LowTotal: %8lu kB\n"
"LowFree:  %8lu kB\n"
 #endif
+   "MovableTotal: %8lu kB\n"
+   "MovableFree:  %8lu kB\n"
"SwapTotal:%8lu kB\n"
"SwapFree: %8lu kB\n"
"Dirty:%8lu kB\n"
@@ -191,6 +193,8 @@ static int meminfo_read_proc(char *page,
K(i.totalram-i.totalhigh),
K(i.freeram-i.freehigh),
 #endif
+   K(i.movable),
+   K(i.free_movable),
K(i.totalswap),
K(i.freeswap),
K(global_page_state(NR_FILE_DIRTY)),
Index: current_test/drivers/base/node.c
===
--- current_test.orig/drivers/base/node.c   2007-05-08 15:06:10.0 
+0900
+++ current_test/drivers/base/node.c2007-05-08 15:07:20.0 +0900
@@ -55,6 +55,8 @@ static ssize_t node_read_meminfo(struct 
   "Node %d LowTotal: %8lu kB\n"
   "Node %d LowFree:  %8lu kB\n"
 #endif
+  "Node %d MovableTotal: %8lu kB\n"
+  "Node %d MovableFree:  %8lu kB\n"
   "Node %d Dirty:%8lu kB\n"
   "Node %d Writeback:%8lu kB\n"