Re: swap storage alignment and stride size

From: Hugh Dickins
Date: Tue Dec 14 2010 - 23:57:48 EST


On Tue, 14 Dec 2010, Martin K. Petersen wrote:
> >>>>> "Ric" == Ric Wheeler <ricwheeler@xxxxxxxxx> writes:
>
> Ric> There has been a lot of work on alignment, Martin Petersen lead
> Ric> most of that and is probably the best one to ping.
>
> With modern tooling we should align the partition or DM device correctly
> so the swap starts on a properly aligned boundary. But I don't think
> anybody has looked into hooking the swap stuff up with the I/O
> topology. I'm also not sure the swap code is flexible enough to deal
> with units that are bigger than page size.

You and Christian are right, mm/swapfile.c is very much oriented to
the small mm page size, 4kB on x86.

Yes, when it's running nicely, the elevator can make a big difference
by merging adjacent writes to swap; but swapping is often by nature
not so nice.

I think it would be a big mistake to try to build the idea of bigger
blocks into mm/swapfile.c: it is so orientated towards the mm concerns
that we'd end up with a mess that way.

Much better to add a dm layer below it, to buffer such alignment and
stride concerns. Perhaps someone has already done that?

(scan_swap_map does try to allocate in 1MB clusters, but they're not
written out that way, and there's no attempt to align: if it worked
out better for the lower level to require that these 1MB clusters
are aligned, we could probably go for that - though the swap header
page might then be a nuisance.)

Hugh
--
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/