From: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
To: "kyeongdon.kim" <kyeongdon.kim@lge.com>
Cc: Minchan Kim <minchan@kernel.org>,
Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>,
Andrew Morton <akpm@linux-foundation.org>,
linux-kernel@vger.kernel.org,
Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Subject: Re: [PATCH v3 2/2] zram: try vmalloc() after kmalloc()
Date: Mon, 30 Nov 2015 20:14:24 +0900 [thread overview]
Message-ID: <20151130111424.GB1483@swordfish> (raw)
In-Reply-To: <565C27FA.407@lge.com>
On (11/30/15 19:42), kyeongdon.kim wrote:
[..]
> Sorry to have kept you waiting,
> Obviously, I couldn't see allocation fail message with this patch.
> But, there is something to make some delay(not sure yet this is normal).
what delay? how significant it is? do you see it in practice or it's just
a guess?
> static struct zcomp_strm *zcomp_strm_alloc(struct zcomp *comp)
> {
> <snip>
>
> zstrm->private = comp->backend->create();
> ^ // sometimes, return 'null' continually(2-5times)
>
> As you know, if there is 'null' return, this function is called again to
> get a memory in while() loop. I just checked this one with printk().
well, not always.
a) current wait_event() for available stream to become idle.
b) once current awaken it attempts to get an idle stream
c) if zstrm then return
d) if there is no idle stream then goto a)
e) else try to allocate stream again, if !zstrm goto a), else return
while (1) {
spin_lock(&zs->strm_lock);
if (!list_empty(&zs->idle_strm)) {
zstrm = list_entry(zs->idle_strm.next,
struct zcomp_strm, list);
list_del(&zstrm->list);
spin_unlock(&zs->strm_lock);
return zstrm;
}
/* zstrm streams limit reached, wait for idle stream */
if (zs->avail_strm >= zs->max_strm) {
spin_unlock(&zs->strm_lock);
wait_event(zs->strm_wait, !list_empty(&zs->idle_strm));
continue;
}
/* allocate new zstrm stream */
zs->avail_strm++;
spin_unlock(&zs->strm_lock);
zstrm = zcomp_strm_alloc(comp);
if (!zstrm) {
spin_lock(&zs->strm_lock);
zs->avail_strm--;
spin_unlock(&zs->strm_lock);
wait_event(zs->strm_wait, !list_empty(&zs->idle_strm));
continue;
}
break;
}
so it's possible for current to zcomp_strm_alloc() several times...
do you see the same process doing N zcomp_strm_alloc() calls, or it's N processes
doing one zcomp_strm_alloc()? I think the latter one is more likely; once we failed
to zcomp_strm_alloc() quite possible that N concurrent or succeeding IOs will do
the same. That's why I proposed to decrease ->max_strm; but we basically don't know
when we shall rollback it to the original value; I'm not sure I want to do something
like: every 42nd IO try to increment ->max_strm by one, until it's less than the
original value.
so I'd probably prefer to keep it the way it is; but let's see the numbers from
you first.
-ss
next prev parent reply other threads:[~2015-11-30 11:14 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-27 4:10 [PATCH v3 0/2] zram/zcomp: stream allocation fixes and tweaks Sergey Senozhatsky
2015-11-27 4:10 ` [PATCH v3 1/2] zram/zcomp: use GFP_NOIO to allocate streams Sergey Senozhatsky
2015-11-30 7:09 ` Minchan Kim
2015-11-27 4:10 ` [PATCH v3 2/2] zram: try vmalloc() after kmalloc() Sergey Senozhatsky
2015-11-30 7:10 ` Minchan Kim
2015-11-30 10:42 ` kyeongdon.kim
2015-11-30 11:14 ` Sergey Senozhatsky [this message]
2015-12-01 2:04 ` kyeongdon.kim
[not found] ` <20151130231841.GA960@bbox>
2015-12-01 0:33 ` Sergey Senozhatsky
2015-12-01 2:31 ` Re: " kyeongdon.kim
2015-12-01 4:44 ` Minchan Kim
[not found] ` <20151201045535.GA5999@bbox>
2015-12-01 5:16 ` Sergey Senozhatsky
2015-12-01 6:35 ` Kyeongdon Kim
2015-12-01 7:15 ` Sergey Senozhatsky
2015-12-01 7:33 ` Sergey Senozhatsky
2015-12-01 8:16 ` Minchan Kim
2015-12-01 9:11 ` Sergey Senozhatsky
2015-12-01 7:24 ` 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=20151130111424.GB1483@swordfish \
--to=sergey.senozhatsky.work@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=kyeongdon.kim@lge.com \
--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