Re: page migration: Fail with error if swap not setup

Christoph Lameter
2006-03-15T16:35:17Z

On Wed, 15 Mar 2006, Nick Piggin wrote:

> > There are a number of possible failure conditions. The strategy of the
> > migration function is to migrate as much as possible and return the rest
> > without giving any reason. migrate_pages() returns the number of leftover
> > pages not the reasons they failed.
> Could you return the reason the first failing page failed. At least then
> the caller can have some idea about what is needed to make further progress.

The return value of migrate_pages() is the number of pages that were not
migrated. It is up to the caller to figure out why a page was not
migrated. We could change that in the future but that would be a big
change to the code. Migrate_pages() makes the best effort at
migration and categorizes failing pages into those who with permanent
failures and those which may be retriable. Currently page migration simply
skips over any soft or hard failures to migrate pages and leaves them in
place. The current page migration code is intentionally designed to only
make a reasonable attempt on a group of pages. Earlier code attempted to
guarantee migration but that never worked the right way and introduced
unacceptable delays while holding locks.

The calling program may go through the list of failing pages and
investigate the reasons by inspecting page count, mapping, swap etc. I
guess we could add some sort of a callback in the future that determines
what to do on failure. Or add some flags to return immediately if
migration fails.

But I think the current code is just fine.