lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 1 Jul 2015 16:29:52 +0900
From:	Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>
To:	Minchan Kim <minchan@...nel.org>
Cc:	Andrew Morton <akpm@...ux-foundation.org>, linux-mm@...ck.org,
	linux-kernel@...r.kernel.org,
	Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>,
	Sergey Senozhatsky <sergey.senozhatsky@...il.com>
Subject: Re: [RFC][PATCHv4 6/7] zsmalloc: account the number of compacted
 pages

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@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ