From: akpm@linux-foundation.org
To: mm-commits@vger.kernel.org
Cc: Brice.Goglin@inria.fr, Nathalie.Furmento@labri.fr,
cl@linux-foundation.org, mel@csn.ul.ie
Subject: + mm-make-do_move_pages-complexity-linear-fix.patch added to -mm tree
Date: Thu, 02 Oct 2008 17:23:15 -0700 [thread overview]
Message-ID: <200810030023.m930NF2G002083@imap1.linux-foundation.org> (raw)
The patch titled
mm: make do_move_pages() complexity linear
has been added to the -mm tree. Its filename is
mm-make-do_move_pages-complexity-linear-fix.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/SubmitChecklist when testing your code ***
See http://userweb.kernel.org/~akpm/added-to-mm.txt to find
out what to do about this
The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/
------------------------------------------------------
Subject: mm: make do_move_pages() complexity linear
From: Brice Goglin <Brice.Goglin@inria.fr>
> +/*
> + * Allocate a page on the node given as a page_to_node in private.
> + * Increase private to point to the next page_to_node so that the
> + * next iteration does not have to traverse the whole pm array.
> + */
> static struct page *new_page_node(struct page *p, unsigned long private,
> int **result)
> {
> - struct page_to_node *pm = (struct page_to_node *)private;
> + struct page_to_node **pmptr = (struct page_to_node **)private;
> + struct page_to_node *pm = *pmptr;
>
> while (pm->node != MAX_NUMNODES && pm->page != p)
> pm++;
>
> + /* prepare for the next iteration */
> + *pmptr = pm + 1;
> +
>
Actually, this "pm+1" breaks the case where migrate_pages() calls
unmap_and_move() multiple times on the same page. In this case, we need
the while loop to look at pm instead of pm+1 first. So we can't cache
pm+1 in private, but caching pm is ok. There will be 1 while loop
instead of 0 in the regular case. Updated patch (with more comments)
coming soon.
Signed-off-by: Brice Goglin <Brice.Goglin@inria.fr>
Signed-off-by: Nathalie Furmento <Nathalie.Furmento@labri.fr>
Cc: Christoph Lameter <cl@linux-foundation.org>
Cc: Mel Gorman <mel@csn.ul.ie>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
mm/migrate.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff -puN mm/migrate.c~mm-make-do_move_pages-complexity-linear-fix mm/migrate.c
--- a/mm/migrate.c~mm-make-do_move_pages-complexity-linear-fix
+++ a/mm/migrate.c
@@ -839,8 +839,14 @@ struct page_to_node {
/*
* Allocate a page on the node given as a page_to_node in private.
- * Increase private to point to the next page_to_node so that the
- * next iteration does not have to traverse the whole pm array.
+ *
+ * Cache the _last used_ pm in private so that the next call may find the
+ * target pm in very few while loops (usually 1) instead of scanning the
+ * whole pm array.
+ * We cannot cache the _next_ pm in private (to get 0 while loop in the
+ * regular case) because it would break the case where new_page_node()
+ * is called multiple times on the same page (when migrate_pages() tries
+ * unmap_and_move() multiple times).
*/
static struct page *new_page_node(struct page *p, unsigned long private,
int **result)
@@ -851,8 +857,8 @@ static struct page *new_page_node(struct
while (pm->node != MAX_NUMNODES && pm->page != p)
pm++;
- /* prepare for the next iteration */
- *pmptr = pm + 1;
+ /* save the current pm to reduce the while loop in the next call */
+ *pmptr = pm;
if (pm->node == MAX_NUMNODES)
return NULL;
_
Patches currently in -mm which might be from Brice.Goglin@inria.fr are
mm-make-do_move_pages-complexity-linear.patch
mm-make-do_move_pages-complexity-linear-fix.patch
reply other threads:[~2008-10-03 0:23 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=200810030023.m930NF2G002083@imap1.linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=Brice.Goglin@inria.fr \
--cc=Nathalie.Furmento@labri.fr \
--cc=cl@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mel@csn.ul.ie \
--cc=mm-commits@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.