Re: [PATCH v2] mm: prototype: rid swapoff of quadratic complexity
From: Vineeth Remanan Pillai
Date: Mon Dec 03 2018 - 09:35:35 EST
Hi Matthew,
This seems terribly complicated. You run through i_pages, record the
indices of the swap entries, then go back and look them up again by
calling shmem_getpage() which calls the incredibly complex 300 line
shmem_getpage_gfp().
Can we refactor shmem_getpage_gfp() to skip some of the checks which
aren't necessary when called from this path, and turn this into a nice
simple xas_for_each() loop which works one entry at a time?
I shall investigate this and make this simpler as you suggested.
I have looked into this deeper. I think it would be very difficult to
consolidate the whole logic into a single xas_for_each() loop because,
we do disk io and might sleep. I have refactored the code such that it
much more readable now and I am using the same format used by
find_get_entries.
Will send out the next revision later today.
Thanks,
Vineeth