Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1175036

Re: [RFC][PATCHv4 6/7] zsmalloc: account the number of compacted pages

From Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
Newsgroups linux.kernel
Subject Re: [RFC][PATCHv4 6/7] zsmalloc: account the number of compacted pages
Date 2015-07-01 09:30 +0200
Message-ID <pHkD0-27B-21@gated-at.bofh.it> (permalink)
References <pH2Zr-1ZE-3@gated-at.bofh.it> <pH2Zs-1ZE-29@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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 from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

Re: [RFC][PATCHv4 6/7] zsmalloc: account the number of compacted  pages Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2015-07-01 09:30 +0200

csiph-web