linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Larry Woodman <lwoodman@redhat.com>
To: KOSAKI Motohiro <kosaki.motohiro@gmail.com>
Cc: linux-mm@kvack.org,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Christoph Lameter <cl@linux.com>,
	Motohiro Kosaki <mkosaki@redhat.com>,
	Rik van Riel <riel@redhat.com>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH -mm V2] do_migrate_pages() calls migrate_to_node() even if task is already on a correct node
Date: Tue, 24 Apr 2012 13:16:16 -0400	[thread overview]
Message-ID: <4F96DFE0.6040306@redhat.com> (raw)
In-Reply-To: <4F96D27A.2050005@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1543 bytes --]

On 04/24/2012 12:19 PM, KOSAKI Motohiro wrote:
>> diff --git a/mm/mempolicy.c b/mm/mempolicy.c
>> index 47296fe..6c189fa 100644
>> --- a/mm/mempolicy.c
>> +++ b/mm/mempolicy.c
>> @@ -1012,6 +1012,16 @@ int do_migrate_pages(struct mm_struct *mm,
>>          int dest = 0;
>>
>>          for_each_node_mask(s, tmp) {
>> +
>> +            /* IFF there is an equal number of source and
>> +             * destination nodes, maintain relative node distance
>> +             * even when source and destination nodes overlap.
>> +             * However, when the node weight is unequal, never move
>> +             * memory out of any destination nodes */
>
> Please use
>
> /*
>  * foo bar
>  */
>
> style comment. and this comment only explain how code work but don't 
> explain why.
> I hope the comment describe HPC usecase require to migrate if src and 
> dest have the
> same weight.
>
> Otherwise looks ok. please feel free to use my ack to your next spin.
>  Acked-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
>
>
>
>> +            if ((nodes_weight(*from_nodes) != 
>> nodes_weight(*to_nodes)) &&
>> +                        (node_isset(s, *to_nodes)))
>> +                continue;
>> +
>
>
> -- 
> 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/ .
> Fight unfair telecom internet charges in Canada: sign 
> http://stopthemeter.ca/
> Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
How does this look:



[-- Attachment #2: upstream-do_migrate_pages.patch --]
[-- Type: text/plain, Size: 929 bytes --]

diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index f563fa3..b76b49a 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -1012,6 +1012,24 @@ int do_migrate_pages(struct mm_struct *mm,
 		int dest = 0;
 
 		for_each_node_mask(s, tmp) {
+
+			/*
+			 * IFF there is an equal number of source and
+			 * destination nodes, maintain relative node distance
+			 * even when source and destination nodes overlap.
+			 * However, when the node weight is unequal/there are
+			 * a different number of source and destination nodes,
+			 * never move memory out of a source node that is also
+			 * a destination node.
+			 * 
+			 * Example: [2,3,4] -> [3,4,5] moves everything.
+			 * 	    [0-7] - > [3,4,5] moves only 0,1,2,6,7.
+			 */
+
+			if ((nodes_weight(*from_nodes) != nodes_weight(*to_nodes)) && 
+						(node_isset(s, *to_nodes)))
+				continue;
+
 			d = node_remap(s, *from_nodes, *to_nodes);
 			if (s == d)
 				continue;

  reply	other threads:[~2012-04-24 17:16 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-24 15:59 [PATCH -mm V2] do_migrate_pages() calls migrate_to_node() even if task is already on a correct node Larry Woodman
2012-04-24 16:08 ` Christoph Lameter
2012-04-24 16:19 ` KOSAKI Motohiro
2012-04-24 17:16   ` Larry Woodman [this message]
2012-04-24 17:17     ` KOSAKI Motohiro
2012-04-24 17:21     ` Rik van Riel
2012-04-24 18:17     ` Christoph Lameter
2012-04-24 20:08       ` Larry Woodman
2012-04-24 20:11         ` Rik van Riel

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=4F96DFE0.6040306@redhat.com \
    --to=lwoodman@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=cl@linux.com \
    --cc=kosaki.motohiro@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mkosaki@redhat.com \
    --cc=riel@redhat.com \
    /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;
as well as URLs for NNTP newsgroup(s).