First of all, I think this little slice of code is a bit under-documented. Perhaps this will help clarify things. I'm pretty confident the page_count() check in the first patch is right, which is why I removed it outright. The xas_load() check is a bit murkier, so I just left a warning in for it. Cc: Nicholas Piggin <npiggin@xxxxxxxxx> Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> Cc: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx> Cc: Yang Shi <yang.shi@xxxxxxxxxxxxxxxxx> Cc: linux-mm@xxxxxxxxx Cc: linux-kernel@xxxxxxxxxxxxxxx