On Thu, Sep 29, 2016 at 2:20 PM, Vlastimil Babka <vbabka@xxxxxxx> wrote:
On 09/29/2016 10:08 PM, Raymond Jennings wrote:
Suggestion:
1. Make it a background process "kcompactd"
2. It is activated/woke up/semaphored awake any time a page is
freed.
3. Once it is activated, it enters a loop:
3.1. Reset the semaphore.
3.2. Once a cycle, it takes the highest movable page
3.3. It then finds the lowest free page
3.4. Then, it migrates the highest used page to the lowest free
space
3.5. maybe pace itself by sleeping for a teensy, then go back to
step
3.2
3.6. Do one page at a time to keep it neatly interruptible and
keep it
from blocking other stuff. Since compaction is a housekeeping
task, it
should probably be eager to yield to other things.
3.7. Probably leave hugepages alone if detected since they are by
definition fairly defragmented already.
4. Once all gaps are backfilled, go back to sleep and park back at
step 2 waiting for the next wakeup.
Would this be a good way to do it?
Yes, that's pretty much how it already works, except movable pages are
taken from low pfn and free pages from high. Then there's ton of
subtle
issues to tackle, mostly the balance between overhead and benefit.
Besides the kswapd hook, what would nudge kcompactd to run? If its not
proactively nudged after a page is freed how will it know that there's
fragmentation that could be taken care of in advance before being
shoved by kswapd?
--
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>