From: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
To: Minchan Kim <minchan@kernel.org>
Cc: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>,
Andrew Morton <akpm@linux-foundation.org>,
Sergey Senozhatsky <sergey.senozhatsky@gmail.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] zram: adjust the number of zram thread
Date: Mon, 24 Oct 2016 14:29:05 +0900 [thread overview]
Message-ID: <20161024052905.GB1855@swordfish> (raw)
In-Reply-To: <20161024045413.GC4938@blaptop>
On (10/24/16 13:54), Minchan Kim wrote:
> > On (09/22/16 15:42), Minchan Kim wrote:
> > [..]
> > > +static int __zram_cpu_notifier(void *dummy, unsigned long action,
> > > + unsigned long cpu)
> > > {
> > > struct zram_worker *worker;
> > >
> > > - while (!list_empty(&workers.worker_list)) {
> > > + switch (action) {
> > > + case CPU_UP_PREPARE:
> > > + worker = kmalloc(sizeof(*worker), GFP_KERNEL);
> > > + if (!worker) {
> > > + pr_err("Can't allocate a worker\n");
> > > + return NOTIFY_BAD;
> > > + }
> > > +
> > > + worker->task = kthread_run(zram_thread, NULL, "zramd-%lu", cpu);
> > > + if (IS_ERR(worker->task)) {
> > > + kfree(worker);
> > > + pr_err("Can't allocate a zram thread\n");
> > > + return NOTIFY_BAD;
> > > + }
> >
> > well, strictly speaking we are have no strict bound-to-cpu (per-cpu)
> > requirement here, we just want to have num_online_cpus() worker threads.
> > if we fail to create one more worker thread nothing really bad happens,
> > so I think we better not block that cpu from coming online.
> > iow, always 'return NOTIFY_OK'.
>
> If it doesn't make code complicated, I will do that in next spin.
thanks. I think it won't. we don't really care how many workers we
have, because the workers are not per-cpu. we just want to be as
parallel as possible, but don't guarantee anything at all: who knows
how those workers will be scheduled; may be we even can end up with
just one active worker all the time, if other rq-s have higher prio
tasks to run. there are many things that can be against us here.
that's a massive complication of zram.
preventing CPU from coming online is a bit over-reaction.
-ss
prev parent reply other threads:[~2016-10-24 5:29 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-22 6:42 [PATCH 1/3] zram: rename IO processing functions Minchan Kim
2016-09-22 6:42 ` [PATCH 2/3] zram: support page-based parallel write Minchan Kim
2016-09-29 3:18 ` Sergey Senozhatsky
2016-09-30 5:52 ` Minchan Kim
2016-10-04 4:43 ` Sergey Senozhatsky
2016-10-04 7:35 ` Minchan Kim
2016-10-05 2:01 ` Minchan Kim
2016-10-06 8:29 ` Sergey Senozhatsky
2016-10-07 6:33 ` Minchan Kim
2016-10-07 18:08 ` Sergey Senozhatsky
2016-10-17 5:04 ` Minchan Kim
2016-10-21 6:08 ` Sergey Senozhatsky
2016-10-24 4:51 ` Minchan Kim
2016-10-21 6:03 ` Sergey Senozhatsky
2016-10-24 4:47 ` Minchan Kim
2016-10-24 5:20 ` Sergey Senozhatsky
2016-10-24 5:58 ` Minchan Kim
2016-10-24 7:23 ` Sergey Senozhatsky
2016-09-22 6:42 ` [PATCH 3/3] zram: adjust the number of zram thread Minchan Kim
2016-10-21 6:23 ` Sergey Senozhatsky
2016-10-24 4:54 ` Minchan Kim
2016-10-24 5:29 ` Sergey Senozhatsky [this message]
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=20161024052905.GB1855@swordfish \
--to=sergey.senozhatsky.work@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.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).