linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm: Consider the entire user address space during node migration
@ 2010-05-14 20:46 Greg Thelen
  2010-05-14 21:26 ` Christoph Lameter
  0 siblings, 1 reply; 7+ messages in thread
From: Greg Thelen @ 2010-05-14 20:46 UTC (permalink / raw)
  To: Andrew Morton, KOSAKI Motohiro, Lee Schermerhorn,
	Christoph Lameter, Mel Gorman, kamezawa.hiroyu, nishimura, balbir
  Cc: linux-kernel, linux-mm, Greg Thelen

This patch uses TASK_SIZE_MAX instead of TASK_SIZE to ensure that the entire
user address space is migrated.  TASK_SIZE_MAX is independent of the calling
task context.  TASK SIZE may be dependant on the address space size of the
calling process.  Usage of TASK_SIZE can lead to partial address space migration
if the calling process was 32 bit and the migrating process was 64 bit.

Here is the test script used on 64 system with a 32 bit echo process:
  mount -t cgroup none /cgroup -o cpuset
  cd /cgroup

  mkdir 0
  echo 1 > 0/cpuset.cpus
  echo 0 > 0/cpuset.mems
  echo 1 > 0/cpuset.memory_migrate

  mkdir 1
  echo 1 > 1/cpuset.cpus
  echo 1 > 1/cpuset.mems
  echo 1 > 1/cpuset.memory_migrate

  echo $$ > 0/tasks
  64_bit_process &
  pid=$!

  echo $pid > 1/tasks   # This does not migrate all process pages without
                        # this patch.  If 64 bit echo is used or this patch is
                        # applied, then the full address space of $pid is
                        # migrated.

To check memory migration, I watched:
  grep MemUsed /sys/devices/system/node/node*/meminfo

Signed-off-by: Greg Thelen <gthelen@google.com>
---
 mm/mempolicy.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index 9f11728..a42c0f1 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -928,7 +928,7 @@ static int migrate_to_node(struct mm_struct *mm, int source, int dest,
 	nodes_clear(nmask);
 	node_set(source, nmask);
 
-	check_range(mm, mm->mmap->vm_start, TASK_SIZE, &nmask,
+	check_range(mm, mm->mmap->vm_start, TASK_SIZE_MAX, &nmask,
 			flags | MPOL_MF_DISCONTIG_OK, &pagelist);
 
 	if (!list_empty(&pagelist))
-- 
1.7.0.1

--
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 related	[flat|nested] 7+ messages in thread

* Re: [PATCH] mm: Consider the entire user address space during node migration
  2010-05-14 20:46 [PATCH] mm: Consider the entire user address space during node migration Greg Thelen
@ 2010-05-14 21:26 ` Christoph Lameter
  2010-05-15 14:31   ` KOSAKI Motohiro
  0 siblings, 1 reply; 7+ messages in thread
From: Christoph Lameter @ 2010-05-14 21:26 UTC (permalink / raw)
  To: Greg Thelen
  Cc: Andrew Morton, KOSAKI Motohiro, Lee Schermerhorn, Mel Gorman,
	kamezawa.hiroyu, nishimura, balbir, linux-kernel, linux-mm



Acked-by: Christoph Lameter <cl@linux-foundation.org>

--
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: [PATCH] mm: Consider the entire user address space during node migration
  2010-05-14 21:26 ` Christoph Lameter
@ 2010-05-15 14:31   ` KOSAKI Motohiro
  2010-05-15 22:35     ` [PATCH v2] " Greg Thelen
  2010-05-15 22:44     ` [PATCH] " Greg Thelen
  0 siblings, 2 replies; 7+ messages in thread
From: KOSAKI Motohiro @ 2010-05-15 14:31 UTC (permalink / raw)
  To: Christoph Lameter
  Cc: Greg Thelen, Andrew Morton, Lee Schermerhorn, Mel Gorman,
	kamezawa.hiroyu, nishimura, balbir, linux-kernel, linux-mm

Hi

Mysteriously, I haven't receive original post.
So now I'm guessing you acked following patch.

http://lkml.org/lkml/2010/5/14/393

but I don't think it is correct.

> -	check_range(mm, mm->mmap->vm_start, TASK_SIZE, &nmask,
> +	check_range(mm, mm->mmap->vm_start, TASK_SIZE_MAX, &nmask,
> 			flags | MPOL_MF_DISCONTIG_OK, &pagelist);

Because TASK_SIZE_MAX is defined on x86 only. Why can we ignore other platform?
Please put following line anywhere.

#define TASK_SIZE_MAX TASK_SIZE


But this patch is conceptually good. if it fixes the bug. I'll ack gladly.

Thanks.

--
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

* [PATCH v2] mm: Consider the entire user address space during node migration
  2010-05-15 14:31   ` KOSAKI Motohiro
@ 2010-05-15 22:35     ` Greg Thelen
  2010-05-16  1:14       ` Christoph Lameter
  2010-05-17  0:00       ` KOSAKI Motohiro
  2010-05-15 22:44     ` [PATCH] " Greg Thelen
  1 sibling, 2 replies; 7+ messages in thread
From: Greg Thelen @ 2010-05-15 22:35 UTC (permalink / raw)
  To: Andrew Morton, KOSAKI Motohiro, Lee Schermerhorn,
	Christoph Lameter, Mel Gorman, kamezawa.hiroyu, nishimura, balbir
  Cc: linux-kernel, linux-mm, Greg Thelen

This patch uses mm->task_size instead of TASK_SIZE to ensure that the entire
user address space is migrated.  mm->task_size is independent of the calling
task context.  TASK SIZE may be dependant on the address space size of the
calling process.  Usage of TASK_SIZE can lead to partial address space migration
if the calling process was 32 bit and the migrating process was 64 bit.

Here is the test script used on 64 system with a 32 bit echo process:
  mount -t cgroup none /cgroup -o cpuset
  cd /cgroup

  mkdir 0
  echo 1 > 0/cpuset.cpus
  echo 0 > 0/cpuset.mems
  echo 1 > 0/cpuset.memory_migrate

  mkdir 1
  echo 1 > 1/cpuset.cpus
  echo 1 > 1/cpuset.mems
  echo 1 > 1/cpuset.memory_migrate

  echo $$ > 0/tasks
  64_bit_process &
  pid=$!

  echo $pid > 1/tasks   # This does not migrate all process pages without
                        # this patch.  If 64 bit echo is used or this patch is
                        # applied, then the full address space of $pid is
                        # migrated.

To check memory migration, I watched:
  grep MemUsed /sys/devices/system/node/node*/meminfo

Changes since v1:
- Use mm->task_size rather than TASK_SIZE_MAX to support all platforms.

Signed-off-by: Greg Thelen <gthelen@google.com>
---
 mm/mempolicy.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index 9f11728..2fd17e7 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -928,7 +928,7 @@ static int migrate_to_node(struct mm_struct *mm, int source, int dest,
 	nodes_clear(nmask);
 	node_set(source, nmask);
 
-	check_range(mm, mm->mmap->vm_start, TASK_SIZE, &nmask,
+	check_range(mm, mm->mmap->vm_start, mm->task_size, &nmask,
 			flags | MPOL_MF_DISCONTIG_OK, &pagelist);
 
 	if (!list_empty(&pagelist))
-- 
1.7.0.1

--
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 related	[flat|nested] 7+ messages in thread

* Re: [PATCH] mm: Consider the entire user address space during node migration
  2010-05-15 14:31   ` KOSAKI Motohiro
  2010-05-15 22:35     ` [PATCH v2] " Greg Thelen
@ 2010-05-15 22:44     ` Greg Thelen
  1 sibling, 0 replies; 7+ messages in thread
From: Greg Thelen @ 2010-05-15 22:44 UTC (permalink / raw)
  To: KOSAKI Motohiro
  Cc: Christoph Lameter, Andrew Morton, Lee Schermerhorn, Mel Gorman,
	kamezawa.hiroyu, nishimura, balbir, linux-kernel, linux-mm

On Sat, May 15, 2010 at 7:31 AM, KOSAKI Motohiro
<kosaki.motohiro@jp.fujitsu.com> wrote:
>
> Hi
>
> Mysteriously, I haven't receive original post.
> So now I'm guessing you acked following patch.
>
> http://lkml.org/lkml/2010/5/14/393
>
> but I don't think it is correct.
>
> > -     check_range(mm, mm->mmap->vm_start, TASK_SIZE, &nmask,
> > +     check_range(mm, mm->mmap->vm_start, TASK_SIZE_MAX, &nmask,
> >                       flags | MPOL_MF_DISCONTIG_OK, &pagelist);
>
> Because TASK_SIZE_MAX is defined on x86 only. Why can we ignore other platform?
> Please put following line anywhere.
>
> #define TASK_SIZE_MAX TASK_SIZE

I just send out patch v2, which uses mm->task_size rather than
TASK_SIZE_MAX.  Some non-x86 architectures do not define
TASK_SIZE_MAX, but do make TASK_SIZE depend on the current task.  So I
feel it would be better to refer to the mm struct to obtain the needed
address space limit information rather than TASK_SIZE[_MAX], which can
depend on current.

--
Greg

--
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: [PATCH v2] mm: Consider the entire user address space during node migration
  2010-05-15 22:35     ` [PATCH v2] " Greg Thelen
@ 2010-05-16  1:14       ` Christoph Lameter
  2010-05-17  0:00       ` KOSAKI Motohiro
  1 sibling, 0 replies; 7+ messages in thread
From: Christoph Lameter @ 2010-05-16  1:14 UTC (permalink / raw)
  To: Greg Thelen
  Cc: Andrew Morton, KOSAKI Motohiro, Lee Schermerhorn, Mel Gorman,
	kamezawa.hiroyu, nishimura, balbir, linux-kernel, linux-mm


Ok. Looks okay to me.

Acked-by: Christoph Lameter <cl@linux-foundation.org>

--
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: [PATCH v2] mm: Consider the entire user address space during node migration
  2010-05-15 22:35     ` [PATCH v2] " Greg Thelen
  2010-05-16  1:14       ` Christoph Lameter
@ 2010-05-17  0:00       ` KOSAKI Motohiro
  1 sibling, 0 replies; 7+ messages in thread
From: KOSAKI Motohiro @ 2010-05-17  0:00 UTC (permalink / raw)
  To: Greg Thelen
  Cc: kosaki.motohiro, Andrew Morton, Lee Schermerhorn,
	Christoph Lameter, Mel Gorman, kamezawa.hiroyu, nishimura, balbir,
	linux-kernel, linux-mm

> Changes since v1:
> - Use mm->task_size rather than TASK_SIZE_MAX to support all platforms.
> 
> Signed-off-by: Greg Thelen <gthelen@google.com>

Looks good. Thanks Greg!
	Reviewed-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>


> ---
>  mm/mempolicy.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/mm/mempolicy.c b/mm/mempolicy.c
> index 9f11728..2fd17e7 100644
> --- a/mm/mempolicy.c
> +++ b/mm/mempolicy.c
> @@ -928,7 +928,7 @@ static int migrate_to_node(struct mm_struct *mm, int source, int dest,
>  	nodes_clear(nmask);
>  	node_set(source, nmask);
>  
> -	check_range(mm, mm->mmap->vm_start, TASK_SIZE, &nmask,
> +	check_range(mm, mm->mmap->vm_start, mm->task_size, &nmask,
>  			flags | MPOL_MF_DISCONTIG_OK, &pagelist);
>  
>  	if (!list_empty(&pagelist))
> -- 
> 1.7.0.1
> 



--
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:[~2010-05-17  0:00 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-14 20:46 [PATCH] mm: Consider the entire user address space during node migration Greg Thelen
2010-05-14 21:26 ` Christoph Lameter
2010-05-15 14:31   ` KOSAKI Motohiro
2010-05-15 22:35     ` [PATCH v2] " Greg Thelen
2010-05-16  1:14       ` Christoph Lameter
2010-05-17  0:00       ` KOSAKI Motohiro
2010-05-15 22:44     ` [PATCH] " Greg Thelen

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).