On Thu, Dec 6, 2012 at 8:19 AM, Mel Gorman <mgorman@xxxxxxx> wrote: > > Still travelling and am not in a position to test this properly :(. > However, this bug feels very similar to a bug in the migration scanner where > a pfn_valid check is missed because the start is not aligned. Ugh. This patch makes my eyes bleed. Is there no way to do this nicely in the caller? IOW, fix the 'end_pfn' logic way upstream where it is computed, and just cap it at the MAX_ORDER_NR_PAGES boundary? For example, isolate_freepages_range() seems to have this *other* end-point alignment thing going on, and does it in a loop. Wouldn't it be much better to have a separate loop that looped up to the next MAX_ORDER_NR_PAGES boundary instead of having this kind of very random test in the middle of a loop. Even the name ("isolate_freepages_block") implies that we have a "block" of pages. Having to have a random "oops, this block can have other blocks inside of it that aren't mapped" test in the middle of that function really makes me go "Uhh, no". Plus, is it even guaranteed that the *first* pfn (that we get called with) is pfnvalid to begin with? So I guess this patch fixes things, but it does make me go "That's really *really* ugly". Linus -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>