From: Shaohua Li <shli@kernel.org>
To: linux-kernel@vger.kernel.org
Cc: axboe@kernel.dk, hch@infradead.org, kmo@daterainc.com
Subject: [patch 1/2]percpu_ida: fix a live lock
Date: Tue, 31 Dec 2013 11:38:27 +0800 [thread overview]
Message-ID: <20131231033827.GA31994@kernel.org> (raw)
steal_tags only happens when free tags is more than half of the total tags.
This is too restrict and can cause live lock. I found one cpu has free tags,
but other cpu can't steal (thread is bound to specific cpus), threads which
wants to allocate tags are always sleeping. I found this when I run next patch,
but this could happen without it I think.
I did performance test too with null_blk. Two cases (each cpu has enough percpu
tags, or total tags are limited) haven't performance changes.
Signed-off-by: Shaohua Li <shli@fusionio.com>
---
lib/percpu_ida.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
Index: linux/lib/percpu_ida.c
===================================================================
--- linux.orig/lib/percpu_ida.c 2013-11-25 09:36:52.196626486 +0800
+++ linux/lib/percpu_ida.c 2013-12-31 11:20:03.205400612 +0800
@@ -54,9 +54,7 @@ static inline void move_tags(unsigned *d
/*
* Try to steal tags from a remote cpu's percpu freelist.
*
- * We first check how many percpu freelists have tags - we don't steal tags
- * unless enough percpu freelists have tags on them that it's possible more than
- * half the total tags could be stuck on remote percpu freelists.
+ * We first check how many percpu freelists have tags
*
* Then we iterate through the cpus until we find some tags - we don't attempt
* to find the "best" cpu to steal from, to keep cacheline bouncing to a
@@ -69,8 +67,7 @@ static inline void steal_tags(struct per
struct percpu_ida_cpu *remote;
for (cpus_have_tags = cpumask_weight(&pool->cpus_have_tags);
- cpus_have_tags * pool->percpu_max_size > pool->nr_tags / 2;
- cpus_have_tags--) {
+ cpus_have_tags; cpus_have_tags--) {
cpu = cpumask_next(cpu, &pool->cpus_have_tags);
if (cpu >= nr_cpu_ids) {
next reply other threads:[~2013-12-31 3:38 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-31 3:38 Shaohua Li [this message]
2014-01-04 21:08 ` [patch 1/2]percpu_ida: fix a live lock Kent Overstreet
2014-01-05 13:13 ` Shaohua Li
2014-01-06 20:46 ` Kent Overstreet
2014-01-06 20:52 ` Jens Axboe
2014-01-06 21:47 ` Kent Overstreet
2014-02-09 15:50 ` Alexander Gordeev
2014-02-10 10:32 ` Christoph Hellwig
2014-02-10 12:29 ` Alexander Gordeev
2014-02-10 15:49 ` Alexander Gordeev
2014-02-10 16:16 ` Christoph Hellwig
2014-02-10 16:26 ` Jens Axboe
2014-02-10 22:41 ` Kent Overstreet
2014-02-10 23:06 ` Jens Axboe
2014-02-11 9:12 ` Christoph Hellwig
2014-02-11 14:42 ` James Bottomley
2014-02-11 14:53 ` Christoph Hellwig
2014-02-14 10:36 ` Alexander Gordeev
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=20131231033827.GA31994@kernel.org \
--to=shli@kernel.org \
--cc=axboe@kernel.dk \
--cc=hch@infradead.org \
--cc=kmo@daterainc.com \
--cc=linux-kernel@vger.kernel.org \
/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).