* [PATCH 2/2] Add mem_type in /syfs to show memblock migrate type
@ 2007-10-24 16:37 Badari Pulavarty
2007-10-25 10:17 ` Mel Gorman
0 siblings, 1 reply; 15+ messages in thread
From: Badari Pulavarty @ 2007-10-24 16:37 UTC (permalink / raw)
To: KAMEZAWA Hiroyuki, melgor, haveblue; +Cc: linux-mm
Each memory block of the memory has attributes exported to /sysfs.
This patch adds file "mem_type" to show that memory block's migrate type.
This is useful to identify memory blocks for hotplug memory remove.
Signed-off-by: Badari Pulavarty <pbadari@us.ibm.com>
---
drivers/base/memory.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
Index: linux-2.6.23/drivers/base/memory.c
===================================================================
--- linux-2.6.23.orig/drivers/base/memory.c 2007-10-24 09:09:05.000000000 -0700
+++ linux-2.6.23/drivers/base/memory.c 2007-10-24 09:10:05.000000000 -0700
@@ -105,6 +105,26 @@ static ssize_t show_mem_phys_index(struc
}
/*
+ * show memory migrate type
+ */
+static ssize_t show_mem_type(struct sys_device *dev, char *buf)
+{
+ struct page *first_page;
+ int type;
+ struct memory_block *mem =
+ container_of(dev, struct memory_block, sysdev);
+
+ /*
+ * Get the type of the firstpage in the memory block.
+ * For now, assume that entire memory block is of same
+ * type.
+ */
+ first_page = pfn_to_page(section_nr_to_pfn(mem->phys_index));
+ type = get_pageblock_migratetype(first_page);
+ return sprintf(buf, "%s\n", migratetype_names[type]);
+}
+
+/*
* online, offline, going offline, etc.
*/
static ssize_t show_mem_state(struct sys_device *dev, char *buf)
@@ -270,6 +290,7 @@ static ssize_t show_phys_device(struct s
static SYSDEV_ATTR(phys_index, 0444, show_mem_phys_index, NULL);
static SYSDEV_ATTR(state, 0644, show_mem_state, store_mem_state);
static SYSDEV_ATTR(phys_device, 0444, show_phys_device, NULL);
+static SYSDEV_ATTR(mem_type, 0444, show_mem_type, NULL);
#define mem_create_simple_file(mem, attr_name) \
sysdev_create_file(&mem->sysdev, &attr_##attr_name)
@@ -358,6 +379,8 @@ static int add_memory_block(unsigned lon
ret = mem_create_simple_file(mem, state);
if (!ret)
ret = mem_create_simple_file(mem, phys_device);
+ if (!ret)
+ ret = mem_create_simple_file(mem, mem_type);
return ret;
}
@@ -402,6 +425,7 @@ int remove_memory_block(unsigned long no
mem_remove_simple_file(mem, phys_index);
mem_remove_simple_file(mem, state);
mem_remove_simple_file(mem, phys_device);
+ mem_remove_simple_file(mem, mem_type);
unregister_memory(mem, section, NULL);
return 0;
--
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] 15+ messages in thread* Re: [PATCH 2/2] Add mem_type in /syfs to show memblock migrate type
2007-10-24 16:37 [PATCH 2/2] Add mem_type in /syfs to show memblock migrate type Badari Pulavarty
@ 2007-10-25 10:17 ` Mel Gorman
0 siblings, 0 replies; 15+ messages in thread
From: Mel Gorman @ 2007-10-25 10:17 UTC (permalink / raw)
To: Badari Pulavarty; +Cc: KAMEZAWA Hiroyuki, melgor, haveblue, linux-mm
On (24/10/07 09:37), Badari Pulavarty didst pronounce:
> Each memory block of the memory has attributes exported to /sysfs.
> This patch adds file "mem_type" to show that memory block's migrate type.
> This is useful to identify memory blocks for hotplug memory remove.
>
> Signed-off-by: Badari Pulavarty <pbadari@us.ibm.com>
> ---
> drivers/base/memory.c | 24 ++++++++++++++++++++++++
> 1 file changed, 24 insertions(+)
>
> Index: linux-2.6.23/drivers/base/memory.c
> ===================================================================
> --- linux-2.6.23.orig/drivers/base/memory.c 2007-10-24 09:09:05.000000000 -0700
> +++ linux-2.6.23/drivers/base/memory.c 2007-10-24 09:10:05.000000000 -0700
> @@ -105,6 +105,26 @@ static ssize_t show_mem_phys_index(struc
> }
>
> /*
> + * show memory migrate type
> + */
> +static ssize_t show_mem_type(struct sys_device *dev, char *buf)
> +{
> + struct page *first_page;
> + int type;
> + struct memory_block *mem =
> + container_of(dev, struct memory_block, sysdev);
> +
> + /*
> + * Get the type of the firstpage in the memory block.
> + * For now, assume that entire memory block is of same
> + * type.
> + */
> + first_page = pfn_to_page(section_nr_to_pfn(mem->phys_index));
> + type = get_pageblock_migratetype(first_page);
Silly pick-issue but there is a " " there.
> + return sprintf(buf, "%s\n", migratetype_names[type]);
> +}
Ok, it is safe to assume get_pageblock_migratetype() will never return a
stupid value outside the bounds of that array.
> +
> +/*
> * online, offline, going offline, etc.
> */
> static ssize_t show_mem_state(struct sys_device *dev, char *buf)
> @@ -270,6 +290,7 @@ static ssize_t show_phys_device(struct s
> static SYSDEV_ATTR(phys_index, 0444, show_mem_phys_index, NULL);
> static SYSDEV_ATTR(state, 0644, show_mem_state, store_mem_state);
> static SYSDEV_ATTR(phys_device, 0444, show_phys_device, NULL);
> +static SYSDEV_ATTR(mem_type, 0444, show_mem_type, NULL);
>
Sensible permissions.
> #define mem_create_simple_file(mem, attr_name) \
> sysdev_create_file(&mem->sysdev, &attr_##attr_name)
> @@ -358,6 +379,8 @@ static int add_memory_block(unsigned lon
> ret = mem_create_simple_file(mem, state);
> if (!ret)
> ret = mem_create_simple_file(mem, phys_device);
> + if (!ret)
> + ret = mem_create_simple_file(mem, mem_type);
>
> return ret;
> }
> @@ -402,6 +425,7 @@ int remove_memory_block(unsigned long no
> mem_remove_simple_file(mem, phys_index);
> mem_remove_simple_file(mem, state);
> mem_remove_simple_file(mem, phys_device);
> + mem_remove_simple_file(mem, mem_type);
> unregister_memory(mem, section, NULL);
>
> return 0;
>
Other than the possibility of sections having more than one block on x86_64,
this all looks fine. On x86_64 the multiple blocks might be annoying but I
also feel the mem_type information is not much use to that arch so;
Acked-by: Mel Gorman <mel@csn.ul.ie>
--
Mel Gorman
Part-time Phd Student Linux Technology Center
University of Limerick IBM Dublin Software Lab
--
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] 15+ messages in thread
* [PATCH 2/2] Add mem_type in /syfs to show memblock migrate type
@ 2007-10-25 15:55 Badari Pulavarty
2007-10-25 16:07 ` Mel Gorman
2007-10-25 16:52 ` Dave Hansen
0 siblings, 2 replies; 15+ messages in thread
From: Badari Pulavarty @ 2007-10-25 15:55 UTC (permalink / raw)
To: KAMEZAWA Hiroyuki, melgor, haveblue; +Cc: linux-mm
Kame & Mel,
Here is the updated patch, which checks all the pages in the section
to cover all archs. Are you okay with this ?
Thanks,
Badari
Here is the output:
./memory0/mem_type: Multiple
./memory1/mem_type: Multiple
./memory2/mem_type: Movable
./memory3/mem_type: Movable
./memory4/mem_type: Movable
./memory5/mem_type: Movable
./memory6/mem_type: Movable
./memory7/mem_type: Movable
..
Each section of the memory has attributes in /sysfs. This patch adds
file "mem_type" to show that memory section's migrate type. This is useful
to identify section of the memory for hotplug memory remove.
Signed-off-by: Badari Pulavarty <pbadari@us.ibm.com>
drivers/base/memory.c | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
Index: linux-2.6.23/drivers/base/memory.c
===================================================================
--- linux-2.6.23.orig/drivers/base/memory.c 2007-10-23 15:19:14.000000000 -0700
+++ linux-2.6.23/drivers/base/memory.c 2007-10-25 10:34:41.000000000 -0700
@@ -105,6 +105,35 @@ static ssize_t show_mem_phys_index(struc
}
/*
+ * show memory migrate type
+ */
+static ssize_t show_mem_type(struct sys_device *dev, char *buf)
+{
+ struct page *page;
+ int type;
+ int i = pageblock_nr_pages;
+ struct memory_block *mem =
+ container_of(dev, struct memory_block, sysdev);
+
+ /*
+ * Get the type of first page in the block
+ */
+ page = pfn_to_page(section_nr_to_pfn(mem->phys_index));
+ type = get_pageblock_migratetype(page);
+
+ /*
+ * Check the migrate type of other pages in this section.
+ * If the type doesn't match, report it.
+ */
+ while (i < PAGES_PER_SECTION) {
+ if (type != get_pageblock_migratetype(page + i))
+ return sprintf(buf, "Multiple\n");
+ i += pageblock_nr_pages;
+ }
+ return sprintf(buf, "%s\n", migratetype_names[type]);
+}
+
+/*
* online, offline, going offline, etc.
*/
static ssize_t show_mem_state(struct sys_device *dev, char *buf)
@@ -263,6 +292,7 @@ static ssize_t show_phys_device(struct s
static SYSDEV_ATTR(phys_index, 0444, show_mem_phys_index, NULL);
static SYSDEV_ATTR(state, 0644, show_mem_state, store_mem_state);
static SYSDEV_ATTR(phys_device, 0444, show_phys_device, NULL);
+static SYSDEV_ATTR(mem_type, 0444, show_mem_type, NULL);
#define mem_create_simple_file(mem, attr_name) \
sysdev_create_file(&mem->sysdev, &attr_##attr_name)
@@ -351,6 +381,8 @@ static int add_memory_block(unsigned lon
ret = mem_create_simple_file(mem, state);
if (!ret)
ret = mem_create_simple_file(mem, phys_device);
+ if (!ret)
+ ret = mem_create_simple_file(mem, mem_type);
return ret;
}
@@ -395,6 +427,7 @@ int remove_memory_block(unsigned long no
mem_remove_simple_file(mem, phys_index);
mem_remove_simple_file(mem, state);
mem_remove_simple_file(mem, phys_device);
+ mem_remove_simple_file(mem, mem_type);
unregister_memory(mem, section, NULL);
return 0;
--
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] 15+ messages in thread* Re: [PATCH 2/2] Add mem_type in /syfs to show memblock migrate type
2007-10-25 15:55 Badari Pulavarty
@ 2007-10-25 16:07 ` Mel Gorman
2007-10-25 16:52 ` Dave Hansen
1 sibling, 0 replies; 15+ messages in thread
From: Mel Gorman @ 2007-10-25 16:07 UTC (permalink / raw)
To: Badari Pulavarty; +Cc: KAMEZAWA Hiroyuki, melgor, haveblue, linux-mm
On (25/10/07 08:55), Badari Pulavarty didst pronounce:
> Kame & Mel,
>
> Here is the updated patch, which checks all the pages in the section
> to cover all archs. Are you okay with this ?
>
> Thanks,
> Badari
>
> Here is the output:
>
> ./memory0/mem_type: Multiple
> ./memory1/mem_type: Multiple
> ./memory2/mem_type: Movable
> ./memory3/mem_type: Movable
> ./memory4/mem_type: Movable
> ./memory5/mem_type: Movable
> ./memory6/mem_type: Movable
> ./memory7/mem_type: Movable
> ..
>
> Each section of the memory has attributes in /sysfs. This patch adds
> file "mem_type" to show that memory section's migrate type. This is useful
> to identify section of the memory for hotplug memory remove.
>
> Signed-off-by: Badari Pulavarty <pbadari@us.ibm.com>
> drivers/base/memory.c | 33 +++++++++++++++++++++++++++++++++
> 1 file changed, 33 insertions(+)
>
> Index: linux-2.6.23/drivers/base/memory.c
> ===================================================================
> --- linux-2.6.23.orig/drivers/base/memory.c 2007-10-23 15:19:14.000000000 -0700
> +++ linux-2.6.23/drivers/base/memory.c 2007-10-25 10:34:41.000000000 -0700
> @@ -105,6 +105,35 @@ static ssize_t show_mem_phys_index(struc
> }
>
> /*
> + * show memory migrate type
> + */
> +static ssize_t show_mem_type(struct sys_device *dev, char *buf)
> +{
> + struct page *page;
> + int type;
> + int i = pageblock_nr_pages;
> + struct memory_block *mem =
> + container_of(dev, struct memory_block, sysdev);
> +
> + /*
> + * Get the type of first page in the block
> + */
> + page = pfn_to_page(section_nr_to_pfn(mem->phys_index));
> + type = get_pageblock_migratetype(page);
> +
> + /*
> + * Check the migrate type of other pages in this section.
> + * If the type doesn't match, report it.
The comment is a little misleading. We are not checking the type of pages,
but the pageblocks
/*
* Check all pageblocks in this section to ensure they are all of
* the same migrate type. If they are multiple types, report it.
*/
> + */
> + while (i < PAGES_PER_SECTION) {
> + if (type != get_pageblock_migratetype(page + i))
> + return sprintf(buf, "Multiple\n");
> + i += pageblock_nr_pages;
> + }
> + return sprintf(buf, "%s\n", migratetype_names[type]);
> +}
> +
> +/*
> * online, offline, going offline, etc.
> */
> static ssize_t show_mem_state(struct sys_device *dev, char *buf)
> @@ -263,6 +292,7 @@ static ssize_t show_phys_device(struct s
> static SYSDEV_ATTR(phys_index, 0444, show_mem_phys_index, NULL);
> static SYSDEV_ATTR(state, 0644, show_mem_state, store_mem_state);
> static SYSDEV_ATTR(phys_device, 0444, show_phys_device, NULL);
> +static SYSDEV_ATTR(mem_type, 0444, show_mem_type, NULL);
>
> #define mem_create_simple_file(mem, attr_name) \
> sysdev_create_file(&mem->sysdev, &attr_##attr_name)
> @@ -351,6 +381,8 @@ static int add_memory_block(unsigned lon
> ret = mem_create_simple_file(mem, state);
> if (!ret)
> ret = mem_create_simple_file(mem, phys_device);
> + if (!ret)
> + ret = mem_create_simple_file(mem, mem_type);
>
> return ret;
> }
> @@ -395,6 +427,7 @@ int remove_memory_block(unsigned long no
> mem_remove_simple_file(mem, phys_index);
> mem_remove_simple_file(mem, state);
> mem_remove_simple_file(mem, phys_device);
> + mem_remove_simple_file(mem, mem_type);
> unregister_memory(mem, section, NULL);
>
> return 0;
>
Other than the misleading comment;
Acked-by: Mel Gorman <mel@csn.ul.ie>
--
Mel Gorman
Part-time Phd Student Linux Technology Center
University of Limerick IBM Dublin Software Lab
--
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] 15+ messages in thread* Re: [PATCH 2/2] Add mem_type in /syfs to show memblock migrate type
2007-10-25 15:55 Badari Pulavarty
2007-10-25 16:07 ` Mel Gorman
@ 2007-10-25 16:52 ` Dave Hansen
2007-10-25 17:07 ` Badari Pulavarty
1 sibling, 1 reply; 15+ messages in thread
From: Dave Hansen @ 2007-10-25 16:52 UTC (permalink / raw)
To: Badari Pulavarty; +Cc: KAMEZAWA Hiroyuki, melgor, linux-mm
On Thu, 2007-10-25 at 08:55 -0700, Badari Pulavarty wrote:
>
> +static ssize_t show_mem_type(struct sys_device *dev, char *buf)
> +{
> + struct page *page;
> + int type;
> + int i = pageblock_nr_pages;
> + struct memory_block *mem =
> + container_of(dev, struct memory_block, sysdev);
> +
> + /*
> + * Get the type of first page in the block
> + */
> + page = pfn_to_page(section_nr_to_pfn(mem->phys_index));
> + type = get_pageblock_migratetype(page);
> +
> + /*
> + * Check the migrate type of other pages in this section.
> + * If the type doesn't match, report it.
> + */
> + while (i < PAGES_PER_SECTION) {
> + if (type != get_pageblock_migratetype(page + i))
> + return sprintf(buf, "Multiple\n");
> + i += pageblock_nr_pages;
> + }
I might change this to be a bit more generic. The odds are that the
existence of a "pageblock" or the types of "pageblocks" will either
change or go away over time.
But, a simple boolean "yes you have a good shot of removing this memory"
or "you have a snowball's chance in hell" on removability is likely
generic enough to stand the test of time.
That is, after all, what you're after here, right?
So, I'd rewrite that loop to look for the removable pageblock types and
see if the entire section is make up of removable pageblocks, or if it
has some party crashing non-removable pageblocks in ther.
-- Dave
--
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] 15+ messages in thread* Re: [PATCH 2/2] Add mem_type in /syfs to show memblock migrate type
2007-10-25 16:52 ` Dave Hansen
@ 2007-10-25 17:07 ` Badari Pulavarty
2007-10-25 17:15 ` Dave Hansen
0 siblings, 1 reply; 15+ messages in thread
From: Badari Pulavarty @ 2007-10-25 17:07 UTC (permalink / raw)
To: Dave Hansen; +Cc: KAMEZAWA Hiroyuki, melgor, linux-mm
On Thu, 2007-10-25 at 09:52 -0700, Dave Hansen wrote:
> On Thu, 2007-10-25 at 08:55 -0700, Badari Pulavarty wrote:
> >
> > +static ssize_t show_mem_type(struct sys_device *dev, char *buf)
> > +{
> > + struct page *page;
> > + int type;
> > + int i = pageblock_nr_pages;
> > + struct memory_block *mem =
> > + container_of(dev, struct memory_block, sysdev);
> > +
> > + /*
> > + * Get the type of first page in the block
> > + */
> > + page = pfn_to_page(section_nr_to_pfn(mem->phys_index));
> > + type = get_pageblock_migratetype(page);
> > +
> > + /*
> > + * Check the migrate type of other pages in this section.
> > + * If the type doesn't match, report it.
> > + */
> > + while (i < PAGES_PER_SECTION) {
> > + if (type != get_pageblock_migratetype(page + i))
> > + return sprintf(buf, "Multiple\n");
> > + i += pageblock_nr_pages;
> > + }
>
> I might change this to be a bit more generic. The odds are that the
> existence of a "pageblock" or the types of "pageblocks" will either
> change or go away over time.
>
> But, a simple boolean "yes you have a good shot of removing this memory"
> or "you have a snowball's chance in hell" on removability is likely
> generic enough to stand the test of time.
>
> That is, after all, what you're after here, right?
>
> So, I'd rewrite that loop to look for the removable pageblock types and
> see if the entire section is make up of removable pageblocks, or if it
> has some party crashing non-removable pageblocks in ther.
I agree with you that all I care about are the "movable" sections
for remove. But what we are doing here is, exporting the migrate type
to user-space and let the user space make a decision on what type
of sections to use for its use. For now, we can migrate/remove ONLY
"movable" sections. But in the future, we may be able to migrate/remove
"Reclaimable" ones. I don't know.
I don't want to make decisions in the kernel for removability - as
it might change depending on the situation. All I want is to export
the info and let user-space deal with the decision making.
Thanks,
Badari
--
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] 15+ messages in thread* Re: [PATCH 2/2] Add mem_type in /syfs to show memblock migrate type
2007-10-25 17:07 ` Badari Pulavarty
@ 2007-10-25 17:15 ` Dave Hansen
2007-10-25 17:36 ` Badari Pulavarty
0 siblings, 1 reply; 15+ messages in thread
From: Dave Hansen @ 2007-10-25 17:15 UTC (permalink / raw)
To: Badari Pulavarty; +Cc: KAMEZAWA Hiroyuki, melgor, linux-mm
On Thu, 2007-10-25 at 10:07 -0700, Badari Pulavarty wrote:
> I agree with you that all I care about are the "movable" sections
> for remove. But what we are doing here is, exporting the migrate type
> to user-space and let the user space make a decision on what type
> of sections to use for its use. For now, we can migrate/remove ONLY
> "movable" sections. But in the future, we may be able to
> migrate/remove
> "Reclaimable" ones. I don't know.
Right, and if that happens, we simply update the one function that makes
the (non)removable decision.
> I don't want to make decisions in the kernel for removability
Too late. :) That's what the mobility patches are all about: having the
kernel make decisions that affect removability.
> - as
> it might change depending on the situation. All I want is to export
> the info and let user-space deal with the decision making.
That's a good point. But, if we have multiple _removable_ pageblocks in
the same section, but with slightly different types, your patch doesn't
help. The user will just see "Multiple", and won't be able to tell that
they can remove it. :(
The sysfs entries are basically only exposed for memory hotplug, and I
don't think exposing the mobility stuff itself there has many valid
uses.
-- Dave
--
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] 15+ messages in thread
* Re: [PATCH 2/2] Add mem_type in /syfs to show memblock migrate type
2007-10-25 17:15 ` Dave Hansen
@ 2007-10-25 17:36 ` Badari Pulavarty
2007-10-25 17:34 ` Dave Hansen
2007-10-25 18:05 ` Mel Gorman
0 siblings, 2 replies; 15+ messages in thread
From: Badari Pulavarty @ 2007-10-25 17:36 UTC (permalink / raw)
To: Dave Hansen; +Cc: KAMEZAWA Hiroyuki, melgor, linux-mm
On Thu, 2007-10-25 at 10:15 -0700, Dave Hansen wrote:
> On Thu, 2007-10-25 at 10:07 -0700, Badari Pulavarty wrote:
> > I agree with you that all I care about are the "movable" sections
> > for remove. But what we are doing here is, exporting the migrate type
> > to user-space and let the user space make a decision on what type
> > of sections to use for its use. For now, we can migrate/remove ONLY
> > "movable" sections. But in the future, we may be able to
> > migrate/remove
> > "Reclaimable" ones. I don't know.
>
> Right, and if that happens, we simply update the one function that makes
> the (non)removable decision.
>
> > I don't want to make decisions in the kernel for removability
>
> Too late. :) That's what the mobility patches are all about: having the
> kernel make decisions that affect removability.
>
> > - as
> > it might change depending on the situation. All I want is to export
> > the info and let user-space deal with the decision making.
>
> That's a good point. But, if we have multiple _removable_ pageblocks in
> the same section, but with slightly different types, your patch doesn't
> help. The user will just see "Multiple", and won't be able to tell that
> they can remove it. :(
So, what you would like to see is - instead of mem_type, you want
"mem_removable" and print "true/false". Correct ?
Mel/KAME - what do you think ? At least on ppc64 (where section size ==
mobility group size), I prefer to see mobility type (more informative).
But I am okay with returning boolean.
Thanks,
Badari
--
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] 15+ messages in thread
* Re: [PATCH 2/2] Add mem_type in /syfs to show memblock migrate type
2007-10-25 17:36 ` Badari Pulavarty
@ 2007-10-25 17:34 ` Dave Hansen
2007-10-25 18:05 ` Mel Gorman
1 sibling, 0 replies; 15+ messages in thread
From: Dave Hansen @ 2007-10-25 17:34 UTC (permalink / raw)
To: Badari Pulavarty; +Cc: KAMEZAWA Hiroyuki, melgor, linux-mm
On Thu, 2007-10-25 at 10:36 -0700, Badari Pulavarty wrote:
>
> > That's a good point. But, if we have multiple _removable_ pageblocks in
> > the same section, but with slightly different types, your patch doesn't
> > help. The user will just see "Multiple", and won't be able to tell that
> > they can remove it. :(
>
> So, what you would like to see is - instead of mem_type, you want
> "mem_removable" and print "true/false". Correct ?
Yup.
-- Dave
--
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] 15+ messages in thread
* Re: [PATCH 2/2] Add mem_type in /syfs to show memblock migrate type
2007-10-25 17:36 ` Badari Pulavarty
2007-10-25 17:34 ` Dave Hansen
@ 2007-10-25 18:05 ` Mel Gorman
2007-10-25 18:12 ` Dave Hansen
1 sibling, 1 reply; 15+ messages in thread
From: Mel Gorman @ 2007-10-25 18:05 UTC (permalink / raw)
To: Badari Pulavarty; +Cc: Dave Hansen, KAMEZAWA Hiroyuki, melgor, linux-mm
On (25/10/07 10:36), Badari Pulavarty didst pronounce:
> On Thu, 2007-10-25 at 10:15 -0700, Dave Hansen wrote:
> > On Thu, 2007-10-25 at 10:07 -0700, Badari Pulavarty wrote:
> > > I agree with you that all I care about are the "movable" sections
> > > for remove. But what we are doing here is, exporting the migrate type
> > > to user-space and let the user space make a decision on what type
> > > of sections to use for its use. For now, we can migrate/remove ONLY
> > > "movable" sections. But in the future, we may be able to
> > > migrate/remove
> > > "Reclaimable" ones. I don't know.
> >
> > Right, and if that happens, we simply update the one function that makes
> > the (non)removable decision.
> >
> > > I don't want to make decisions in the kernel for removability
> >
> > Too late. :) That's what the mobility patches are all about: having the
> > kernel make decisions that affect removability.
> >
> > > - as
> > > it might change depending on the situation. All I want is to export
> > > the info and let user-space deal with the decision making.
> >
> > That's a good point. But, if we have multiple _removable_ pageblocks in
> > the same section, but with slightly different types, your patch doesn't
> > help. The user will just see "Multiple", and won't be able to tell that
> > they can remove it. :(
>
> So, what you would like to see is - instead of mem_type, you want
> "mem_removable" and print "true/false". Correct ?
>
That seems to be the suggestion all right.
> Mel/KAME - what do you think ? At least on ppc64 (where section size ==
> mobility group size), I prefer to see mobility type (more informative).
> But I am okay with returning boolean.
>
I think Dave has a point so I would be happy with a boolean. We don't really
care what the type is, we care about if it can be removed or not.
It also occurs to me from the "can we remove it perspective" that you may
also want to check if the pageblock is entirely free or not. You can encounter
a pageblock that is "Unmovable" but entirely free so it could be removed.
--
Mel Gorman
Part-time Phd Student Linux Technology Center
University of Limerick IBM Dublin Software Lab
--
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] 15+ messages in thread
* Re: [PATCH 2/2] Add mem_type in /syfs to show memblock migrate type
2007-10-25 18:05 ` Mel Gorman
@ 2007-10-25 18:12 ` Dave Hansen
2007-10-26 9:50 ` Mel Gorman
0 siblings, 1 reply; 15+ messages in thread
From: Dave Hansen @ 2007-10-25 18:12 UTC (permalink / raw)
To: Mel Gorman; +Cc: Badari Pulavarty, KAMEZAWA Hiroyuki, melgor, linux-mm
On Thu, 2007-10-25 at 19:05 +0100, Mel Gorman wrote:
> I think Dave has a point so I would be happy with a boolean. We don't really
> care what the type is, we care about if it can be removed or not.
>
> It also occurs to me from the "can we remove it perspective" that you may
> also want to check if the pageblock is entirely free or not. You can encounter
> a pageblock that is "Unmovable" but entirely free so it could be removed.
The other option is to make it somewhat of a "removability score". If
it has non-relocatable pages, then it gets a crappy score. If it is
relocatable, give it more points. If it has more free pages, give it
even more. If the pages contain images of puppies, take points away.
That way, if something in userspace says, "we need to give memory back",
it can go find the _best_ section from which to give it.
But, maybe I'm just over-enginnering now. ;)
-- Dave
--
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] 15+ messages in thread
* Re: [PATCH 2/2] Add mem_type in /syfs to show memblock migrate type
2007-10-25 18:12 ` Dave Hansen
@ 2007-10-26 9:50 ` Mel Gorman
2007-10-26 15:52 ` Dave Hansen
0 siblings, 1 reply; 15+ messages in thread
From: Mel Gorman @ 2007-10-26 9:50 UTC (permalink / raw)
To: Dave Hansen; +Cc: Badari Pulavarty, KAMEZAWA Hiroyuki, melgor, linux-mm
On (25/10/07 11:12), Dave Hansen didst pronounce:
> On Thu, 2007-10-25 at 19:05 +0100, Mel Gorman wrote:
> > I think Dave has a point so I would be happy with a boolean. We don't really
> > care what the type is, we care about if it can be removed or not.
> >
> > It also occurs to me from the "can we remove it perspective" that you may
> > also want to check if the pageblock is entirely free or not. You can encounter
> > a pageblock that is "Unmovable" but entirely free so it could be removed.
>
> The other option is to make it somewhat of a "removability score". If
> it has non-relocatable pages, then it gets a crappy score. If it is
> relocatable, give it more points. If it has more free pages, give it
> even more. If the pages contain images of puppies, take points away.
>
> That way, if something in userspace says, "we need to give memory back",
> it can go find the _best_ section from which to give it.
>
> But, maybe I'm just over-enginnering now. ;)
>
I think that's overkill, especially as any awkward page would give the
section a score of 0.
--
Mel Gorman
Part-time Phd Student Linux Technology Center
University of Limerick IBM Dublin Software Lab
--
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] 15+ messages in thread
* Re: [PATCH 2/2] Add mem_type in /syfs to show memblock migrate type
2007-10-26 9:50 ` Mel Gorman
@ 2007-10-26 15:52 ` Dave Hansen
2007-10-26 16:14 ` Mel Gorman
0 siblings, 1 reply; 15+ messages in thread
From: Dave Hansen @ 2007-10-26 15:52 UTC (permalink / raw)
To: Mel Gorman; +Cc: Badari Pulavarty, KAMEZAWA Hiroyuki, melgor, linux-mm
On Fri, 2007-10-26 at 10:50 +0100, Mel Gorman wrote:
> I think that's overkill, especially as any awkward page would give the
> section a score of 0.
But, if we have a choice, shouldn't we go for a section that is
completely free instead of one that has pages that need some kind of
reclaim first?
We also don't have to have awkward pages keep giving a 0 score, as long
as we have _some_ way of reclaiming them. If we can't reclaim them,
then I think it *needs* to be 0.
-- Dave
--
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] 15+ messages in thread
* Re: [PATCH 2/2] Add mem_type in /syfs to show memblock migrate type
2007-10-26 15:52 ` Dave Hansen
@ 2007-10-26 16:14 ` Mel Gorman
2007-10-26 17:18 ` Dave Hansen
0 siblings, 1 reply; 15+ messages in thread
From: Mel Gorman @ 2007-10-26 16:14 UTC (permalink / raw)
To: Dave Hansen; +Cc: Badari Pulavarty, KAMEZAWA Hiroyuki, melgor, linux-mm
On (26/10/07 08:52), Dave Hansen didst pronounce:
> On Fri, 2007-10-26 at 10:50 +0100, Mel Gorman wrote:
> > I think that's overkill, especially as any awkward page would give the
> > section a score of 0.
>
> But, if we have a choice, shouldn't we go for a section that is
> completely free instead of one that has pages that need some kind of
> reclaim first?
>
I would think that if memory is being shrunk in the system, the monitoring
software would not particularly care. If you think that might be the case,
then rename mem_removable to mem_removable_score and have it print out 0 or
1 for the moment based on the current criteria. Tell userspace developers
that the higher the score, the more suitable it is for removing. That will
allow the introduction of a proper scoring mechanism later if there is a
good reason for it without breaking backwards compatability.
> We also don't have to have awkward pages keep giving a 0 score, as long
> as we have _some_ way of reclaiming them. If we can't reclaim them,
> then I think it *needs* to be 0.
>
> -- Dave
>
> --
> 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>
--
--
Mel Gorman
Part-time Phd Student Linux Technology Center
University of Limerick IBM Dublin Software Lab
--
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] 15+ messages in thread
* Re: [PATCH 2/2] Add mem_type in /syfs to show memblock migrate type
2007-10-26 16:14 ` Mel Gorman
@ 2007-10-26 17:18 ` Dave Hansen
0 siblings, 0 replies; 15+ messages in thread
From: Dave Hansen @ 2007-10-26 17:18 UTC (permalink / raw)
To: Mel Gorman; +Cc: Badari Pulavarty, KAMEZAWA Hiroyuki, melgor, linux-mm
On Fri, 2007-10-26 at 17:14 +0100, Mel Gorman wrote:
>
> I would think that if memory is being shrunk in the system, the monitoring
> software would not particularly care. If you think that might be the case,
> then rename mem_removable to mem_removable_score and have it print out 0 or
> 1 for the moment based on the current criteria. Tell userspace developers
> that the higher the score, the more suitable it is for removing. That will
> allow the introduction of a proper scoring mechanism later if there is a
> good reason for it without breaking backwards compatability.
I completely agree.
-- Dave
--
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] 15+ messages in thread
end of thread, other threads:[~2007-10-26 17:18 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-24 16:37 [PATCH 2/2] Add mem_type in /syfs to show memblock migrate type Badari Pulavarty
2007-10-25 10:17 ` Mel Gorman
-- strict thread matches above, loose matches on Subject: below --
2007-10-25 15:55 Badari Pulavarty
2007-10-25 16:07 ` Mel Gorman
2007-10-25 16:52 ` Dave Hansen
2007-10-25 17:07 ` Badari Pulavarty
2007-10-25 17:15 ` Dave Hansen
2007-10-25 17:36 ` Badari Pulavarty
2007-10-25 17:34 ` Dave Hansen
2007-10-25 18:05 ` Mel Gorman
2007-10-25 18:12 ` Dave Hansen
2007-10-26 9:50 ` Mel Gorman
2007-10-26 15:52 ` Dave Hansen
2007-10-26 16:14 ` Mel Gorman
2007-10-26 17:18 ` Dave Hansen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).