linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
To: Minchan Kim <minchan@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>,
	Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Subject: Re: [RFC][PATCHv4 6/7] zsmalloc: account the number of compacted pages
Date: Wed, 1 Jul 2015 16:29:52 +0900	[thread overview]
Message-ID: <20150701072952.GA537@swordfish> (raw)
In-Reply-To: <1435667758-14075-7-git-send-email-sergey.senozhatsky@gmail.com>

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@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2015-07-01  7:29 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-30 12:35 [RFC][PATCHv4 0/7] mm/zsmalloc: introduce automatic pool compaction Sergey Senozhatsky
2015-06-30 12:35 ` [RFC][PATCHv4 1/7] zsmalloc: drop unused variable `nr_to_migrate' Sergey Senozhatsky
2015-06-30 12:35 ` [RFC][PATCHv4 2/7] zsmalloc: always keep per-class stats Sergey Senozhatsky
2015-06-30 12:35 ` [RFC][PATCHv4 3/7] zsmalloc: introduce zs_can_compact() function Sergey Senozhatsky
2015-06-30 12:35 ` [RFC][PATCHv4 4/7] zsmalloc: cosmetic compaction code adjustments Sergey Senozhatsky
2015-06-30 12:35 ` [RFC][PATCHv4 5/7] zsmalloc/zram: store compaction stats in zspool Sergey Senozhatsky
2015-06-30 12:35 ` [RFC][PATCHv4 6/7] zsmalloc: account the number of compacted pages Sergey Senozhatsky
2015-07-01  7:29   ` Sergey Senozhatsky [this message]
2015-07-02  2:13     ` Sergey Senozhatsky
2015-07-06  7:52     ` Minchan Kim
2015-06-30 12:35 ` [RFC][PATCHv4 7/7] zsmalloc: register a shrinker to trigger auto-compaction Sergey Senozhatsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150701072952.GA537@swordfish \
    --to=sergey.senozhatsky.work@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=minchan@kernel.org \
    --cc=sergey.senozhatsky@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).