Re: [RFC][PATCH 03/26] mm, mpol: add MPOL_MF_LAZY ...
From: Mel Gorman
Date: Fri Mar 23 2012 - 07:50:31 EST
On Fri, Mar 16, 2012 at 03:40:31PM +0100, Peter Zijlstra wrote:
> From: Lee Schermerhorn <Lee.Schermerhorn@xxxxxx>
>
> This patch adds another mbind() flag to request "lazy migration".
> The flag, MPOL_MF_LAZY, modifies MPOL_MF_MOVE* such that the selected
> pages are simply unmapped from the calling task's page table ['_MOVE]
> or from all referencing page tables [_MOVE_ALL]. Anon pages will first
> be added to the swap [or migration?] cache, if necessary. The pages
> will be migrated in the fault path on "first touch", if the policy
> dictates at that time.
>
> <SNIP>
>
> @@ -950,6 +950,98 @@ static int unmap_and_move_huge_page(new_
> }
>
> /*
> + * Lazy migration: just unmap pages, moving anon pages to swap cache, if
> + * necessary. Migration will occur, if policy dictates, when a task faults
> + * an unmapped page back into its page table--i.e., on "first touch" after
> + * unmapping. Note that migrate-on-fault only migrates pages whose mapping
> + * [e.g., file system] supplies a migratepage op, so we skip pages that
> + * wouldn't migrate on fault.
> + *
> + * Pages are placed back on the lru whether or not they were successfully
> + * unmapped. Like migrate_pages().
> + *
> + * Unline migrate_pages(), this function is only called in the context of
> + * a task that is unmapping it's own pages while holding its map semaphore
> + * for write.
> + */
> +int migrate_pages_unmap_only(struct list_head *pagelist)
I'm not properly reviewing these patches at the moment but am taking a
quick look as I play some catch up on linux-mm.
I think it's worth pointing out that this potentially will confuse
reclaim. Lets say a process is being migrated to another node and it
gets unmapped like this then some heuristics will change.
1. If the page was referenced prior to the unmapping then it should be
activated if the page reached the end of the LRU due to the checks
in page_check_references(). If the process has been unmapped for
migrate-on-fault, the pages will instead be reclaimed.
2. The heuristic that applies pressure to slab pages if pages are mapped
is changed. Prior to migrate-on-fault sc->nr_scanned is incremented
for mapped pages to increase the number of slab pages scanned to
avoid swapping. During migrate-on-fault, this pressure is relieved
3. zone_reclaim_mode in default mode will reclaim pages it would
previously have skipped over. It potentially will call shrink_zone more
for the local node than falling back to other nodes because it thinks
most pages are unmapped. This could lead to some trashing.
It may not even be a major problem but it's worth thinking about. If it
is a problem, it will be necessary to account for migrate-on-fault pages
similar to mapped pages during reclaim.
--
Mel Gorman
SUSE Labs
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/