linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Minchan Kim <minchan@kernel.org>
To: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] zram: export the number of available comp streams
Date: Fri, 18 Mar 2016 10:25:24 +0900	[thread overview]
Message-ID: <20160318012524.GA10612@bbox> (raw)
In-Reply-To: <20160318010937.GA572@swordfish>

On Fri, Mar 18, 2016 at 10:09:37AM +0900, Sergey Senozhatsky wrote:
> Hello Minchan,
> 
> On (03/18/16 09:32), Minchan Kim wrote:
> [..]
> > > do I need 21? may be no. do I nede 18? if 18 streams are needed only 10%
> > > of the time (I can figure it out by doing repetitive cat zramX/mm_stat),
> > > then I can set max_comp_streams to make 90% of applications happy, e.g.
> > > max_comp_streams to 10, and save some memory.
> > > 
> > 
> > Okay. Let's go back to zcomp design decade. As you remember, the reason
> > we separated single and multi stream code was performance caused by
> > locking scheme(ie, mutex_lock in single stream model was really fast
> > than sleep/wakeup model in multi stream).
> > If we could overcome that problem back then, we should have gone to
> > multi stream code default.
> 
> yes, IIRC I wanted to limit the number of streams by the number of
> online CPUs (or was it 2*num_online_cpus()?), and thus change the
> number of streams dynamically (because CPUs can go on and off line);
> and create at least num_online_cpus() streams during device
> initialization.
> 
> the reason for a single-stream zram IIRC were setups in which
> zram is used as a swap device. streams require some memory, after
> all. and then we discovered that mutex spin on owner boosts single
> stream zram significantly.
> 
> > How about using *per-cpu* streams?
> 
> OK. instead of list of idle streams use per-cpu pointer and process
> CPU_FOO notifications. that can work, sounds good to me.
> 
> 
> > I remember you wanted to create max number of comp streams statically
> > although I didn't want at that time but I change my decision.
> > 
> > Let's allocate comp stream statically but remove max_comp_streams
> > knob. Instead, by default, zram alloctes number of streams according
> > to the number of online CPU.
> 
> OK. removing `max_comp_streams' will take another 2 years. That's
> a major change, we can leave it for longer, just make it nop.
> 
> > So I think we can solve locking scheme issue in single stream
> > , guarantee parallel level as well as enhancing performance with
> > no locking.
> >
> > Downside with the approach is that unnecessary memory space reserve
> > although zram might be used 1% of running system time. But we
> > should give it up for other benefits
> 
> aha, ok.
> 
> > (ie, simple code, removing
> > max_comp_streams knob, no need to this your stat, guarantee parallel
> > level, guarantee consumed memory space).
> 
> I'll take a look and prepare some numbers (most likely next week).

Sounds great to me!

> 
> 
> > What do you think about it?
> 
> so should I ask Andrew to drop this patch?

Yeb.

Thanks!

> 
> 	-ss

  reply	other threads:[~2016-03-18  1:24 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-26 12:03 [PATCH] zram: export the number of available comp streams Sergey Senozhatsky
2016-01-26 21:13 ` Andrew Morton
2016-01-27  0:34   ` Sergey Senozhatsky
2016-01-29  7:28 ` Minchan Kim
2016-02-01  1:02   ` Sergey Senozhatsky
2016-03-18  0:32     ` Minchan Kim
2016-03-18  1:09       ` Sergey Senozhatsky
2016-03-18  1:25         ` Minchan Kim [this message]
2016-03-21  7:51           ` Sergey Senozhatsky
2016-03-22  0:39             ` Minchan Kim
2016-03-23  8:01               ` 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=20160318012524.GA10612@bbox \
    --to=minchan@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sergey.senozhatsky.work@gmail.com \
    --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).