linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [RFC] 4/4 Migration Cache - use for direct migration
@ 2006-02-17 15:37 Lee Schermerhorn
  2006-02-17 16:35 ` Christoph Lameter
  0 siblings, 1 reply; 3+ messages in thread
From: Lee Schermerhorn @ 2006-02-17 15:37 UTC (permalink / raw)
  To: linux-mm; +Cc: Christoph Lameter, Marcelo Tosatti

Migration Cache "V8" 4/4

This patch hooks the migration cache up to direct page migration.
If a destination page exists, and the old page is not already in
a swap cache, we place it in the migration cache instead.

If direct migration is successful, the page will be removed by
remove_from_swap(), et al.  If migration is not successful after
4 or 5 passes, migrate_pages() drops back to swapping.  In this
case, we must move the page from the migration cache to the swap
cache.

Signed-off-by:  Lee Schermerhorn <lee.schermerhorn@hp.com>

Index: linux-2.6.16-rc3-mm1/mm/vmscan.c
===================================================================
--- linux-2.6.16-rc3-mm1.orig/mm/vmscan.c	2006-02-15 10:50:59.000000000 -0500
+++ linux-2.6.16-rc3-mm1/mm/vmscan.c	2006-02-15 10:51:09.000000000 -0500
@@ -911,7 +911,12 @@ redo:
 		 * preserved.
 		 */
 		if (PageAnon(page) && !PageSwapCache(page)) {
-			if (!add_to_swap(page, GFP_KERNEL)) {
+			if (!to) {
+				if (!add_to_swap(page, GFP_KERNEL)) {
+					rc = -ENOMEM;
+					goto unlock_page;
+				}
+			} else if (add_to_migration_cache(page, GFP_KERNEL)) {
 				rc = -ENOMEM;
 				goto unlock_page;
 			}
@@ -989,6 +994,12 @@ redo:
 			 */
 			unlock_page(newpage);
 			newpage = NULL;
+			if (page_is_migration(page)) {
+				if (!migration_move_to_swap(page)) {
+					rc = -ENOMEM;
+					goto unlock_page;
+				}
+			}
 			rc = swap_page(page);
 			goto next;
 		}


--
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] 3+ messages in thread

* Re: [RFC] 4/4 Migration Cache - use for direct migration
  2006-02-17 15:37 [RFC] 4/4 Migration Cache - use for direct migration Lee Schermerhorn
@ 2006-02-17 16:35 ` Christoph Lameter
  2006-02-17 18:37   ` Lee Schermerhorn
  0 siblings, 1 reply; 3+ messages in thread
From: Christoph Lameter @ 2006-02-17 16:35 UTC (permalink / raw)
  To: Lee Schermerhorn; +Cc: linux-mm, Marcelo Tosatti

On Fri, 17 Feb 2006, Lee Schermerhorn wrote:

> Index: linux-2.6.16-rc3-mm1/mm/vmscan.c
> ===================================================================
> --- linux-2.6.16-rc3-mm1.orig/mm/vmscan.c	2006-02-15 10:50:59.000000000 -0500
> +++ linux-2.6.16-rc3-mm1/mm/vmscan.c	2006-02-15 10:51:09.000000000 -0500
> @@ -911,7 +911,12 @@ redo:
>  		 * preserved.
>  		 */
>  		if (PageAnon(page) && !PageSwapCache(page)) {
> -			if (!add_to_swap(page, GFP_KERNEL)) {
> +			if (!to) {
> +				if (!add_to_swap(page, GFP_KERNEL)) {
> +					rc = -ENOMEM;
> +					goto unlock_page;
> +				}
> +			} else if (add_to_migration_cache(page, GFP_KERNEL)) {
>  				rc = -ENOMEM;
>  				goto unlock_page;
>  			}

Hmmm.... maybe add another parameter to add_to_swap instead? This seems to 
be duplicating some code.

--
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] 3+ messages in thread

* Re: [RFC] 4/4 Migration Cache - use for direct migration
  2006-02-17 16:35 ` Christoph Lameter
@ 2006-02-17 18:37   ` Lee Schermerhorn
  0 siblings, 0 replies; 3+ messages in thread
From: Lee Schermerhorn @ 2006-02-17 18:37 UTC (permalink / raw)
  To: Christoph Lameter; +Cc: linux-mm, Marcelo Tosatti

On Fri, 2006-02-17 at 08:35 -0800, Christoph Lameter wrote:
> On Fri, 17 Feb 2006, Lee Schermerhorn wrote:
> 
> > Index: linux-2.6.16-rc3-mm1/mm/vmscan.c
> > ===================================================================
> > --- linux-2.6.16-rc3-mm1.orig/mm/vmscan.c	2006-02-15 10:50:59.000000000 -0500
> > +++ linux-2.6.16-rc3-mm1/mm/vmscan.c	2006-02-15 10:51:09.000000000 -0500
> > @@ -911,7 +911,12 @@ redo:
> >  		 * preserved.
> >  		 */
> >  		if (PageAnon(page) && !PageSwapCache(page)) {
> > -			if (!add_to_swap(page, GFP_KERNEL)) {
> > +			if (!to) {
> > +				if (!add_to_swap(page, GFP_KERNEL)) {
> > +					rc = -ENOMEM;
> > +					goto unlock_page;
> > +				}
> > +			} else if (add_to_migration_cache(page, GFP_KERNEL)) {
> >  				rc = -ENOMEM;
> >  				goto unlock_page;
> >  			}
> 
> Hmmm.... maybe add another parameter to add_to_swap instead? This seems to 
> be duplicating some code.
> 

Could do.  The value of which would depend on 'to' in this context.  

This would require a change to shrink_list() in vmscan which you wanted
to avoid in comment on previous mail, or we could leave add_to_swap() as
a wrapper over the current one renamed to __add_to_swap or such with the
extra parameter.

Could also change the code above to use a single if:

if ((!to && !add_to_swap()) || (to && add_to_migration_cache())) ...

I'm not too clear on what passes for "readability" and how that weighs
against this level code duplication. ;-)

But, in general, I agree with the notion of hiding the details or
even existence of the migration cache behind the swap interfaces.


--
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] 3+ messages in thread

end of thread, other threads:[~2006-02-17 18:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-02-17 15:37 [RFC] 4/4 Migration Cache - use for direct migration Lee Schermerhorn
2006-02-17 16:35 ` Christoph Lameter
2006-02-17 18:37   ` Lee Schermerhorn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox