On Mon, Oct 05, 2020 at 03:12:54PM +0100, Matthew Wilcox wrote: > On Mon, Oct 05, 2020 at 05:11:19PM +0300, Jarkko Sakkinen wrote: > > Fix the issue further discussed in: > > No, this is still utter crap. Just use the version I sent. OK, just a quick recap to fully understand it. Here's your response from the original thread: https://lore.kernel.org/linux-sgx/20201005013053.GJ20115@xxxxxxxxxxxxxxxxxxxx/ And here's your snippet from v2: https://lore.kernel.org/linux-sgx/20201005111139.GK20115@xxxxxxxxxxxxxxxxxxxx/ This is what confused me. Compared to (v3) patch and your version, the differences I spot are: A. 'count' is checked first. B. Both this and the snippet from the original thread (i.e. page-writeback.c) use the same loop construct. Right, and snippet from page-writeback.c is not compatible with this because looking at documentation xas_find() continued with xas_next_entry() sequence will jump through the existing entries and skip the holes? On the other hand, xas_next() does not. Of the A part I'm not sure how the order there semantically matter. /Jarkko