On (06/30/15 21:35), Sergey Senozhatsky wrote: [..] > if (src_page) > putback_zspage(pool, class, src_page); > > - pool->num_migrated += cc.nr_migrated; > + cc.nr_migrated /= get_maxobj_per_zspage(class->size, > + class->pages_per_zspage); > + > + pool->num_migrated += cc.nr_migrated * > + get_pages_per_zspage(class->size); > > spin_unlock(&class->lock); Oh, well. This is bloody wrong, sorry. We don't pick up src_page-s that we can completely drain. Thus, the fact that we can't compact (!zs_can_compact()) anymore doesn't mean that we actually have released any zspages. So... (a) we can isolate_source_page() more accurately -- iterate list and look for pages that have ->inuse less or equal to the amount of unused objects. So we can guarantee that this particular zspage will be released at the end. It adds O(n) every time we isolate_source_page(), because the number of unused objects changes. But it's sort of worth it, I think. Otherwise we still can move M objects w/o releasing any pages after all. If we consider compaction as a slow path (and I think we do) then this option doesn't look so bad. (b) if (a) is not an option, then we need to know that we have drained the src_page. And it seems that the easiest way to do it is to change 'void putback_zspage(...)' to 'bool putback_zspage(...)' and return `true' from putback_zspage() when putback resulted in free_zspage() (IOW, the page was ZS_EMPTY). And in __zs_compact() do something like if (putback_zspage(.. src_page)) pool->num_migrated++; (c) or we can check src_page fullness (or simply if src_page->inuse == 0) in __zs_compact() and increment ->num_migrated for ZS_EMPTY page. But this is what free_zspage() already does. -ss -- 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>