Hi Sergey, On Wed, Jul 08, 2015 at 08:31:53PM +0900, Sergey Senozhatsky wrote: > Perform automatic pool compaction by a shrinker when system > is getting tight on memory. > > User-space has a very little knowledge regarding zsmalloc fragmentation > and basically has no mechanism to tell whether compaction will result > in any memory gain. Another issue is that user space is not always > aware of the fact that system is getting tight on memory. Which leads > to very uncomfortable scenarios when user space may start issuing > compaction 'randomly' or from crontab (for example). Fragmentation > is not always necessarily bad, allocated and unused objects, after all, > may be filled with the data later, w/o the need of allocating a new > zspage. On the other hand, we obviously don't want to waste memory > when the system needs it. > > Compaction now has a relatively quick pool scan so we are able to > estimate the number of pages that will be freed easily, which makes it > possible to call this function from a shrinker->count_objects() callback. > We also abort compaction as soon as we detect that we can't free any > pages any more, preventing wasteful objects migrations. > > Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@xxxxxxxxx> > Suggested-by: Minchan Kim <minchan@xxxxxxxxxx> Acked-by: Minchan Kim <minchan@xxxxxxxxxx> Thanks for great work! -- 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>