From: Alexander Gordeev <agordeev@redhat.com>
To: Kent Overstreet <kmo@daterainc.com>
Cc: Oleg Nesterov <oleg@redhat.com>, Jens Axboe <axboe@kernel.dk>,
"Nicholas A. Bellinger" <nab@linux-iscsi.org>,
linux-kernel@vger.kernel.org
Subject: [PATCH 3/5] percpu_ida: Optimize freeing tags when maximum cache size is 1
Date: Mon, 28 Oct 2013 11:05:48 +0100 [thread overview]
Message-ID: <20131028100547.GD5744@dhcp-26-207.brq.redhat.com> (raw)
In-Reply-To: <cover.1382950629.git.agordeev@redhat.com>
In case percpu_max_size is 1 percpu_ida_free() sets bit in
the cpumask and immediately transfers the tag to the pool.
As result, the very next call to percpu_ida_alloc() on the
same CPU will have to pull a tag from the pool to the local
cache and so on. Hence, positive effects of local caching
become largely negated.
This update assumes stealing tags is faster than ping-ponging
between local caches and the pool and prevents returning tags
to the pool in case percpu_max_size is 1.
Signed-off-by: Alexander Gordeev <agordeev@redhat.com>
---
lib/percpu_ida.c | 5 ++---
1 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/lib/percpu_ida.c b/lib/percpu_ida.c
index 9dd8741..4adc3e5 100644
--- a/lib/percpu_ida.c
+++ b/lib/percpu_ida.c
@@ -243,9 +243,8 @@ void percpu_ida_free(struct percpu_ida *pool, unsigned tag)
*/
smp_wmb();
wake_up = true;
- }
-
- if (nr_free == pool->percpu_max_size) {
+ } else if ((nr_free == pool->percpu_max_size) &&
+ (pool->percpu_max_size > 1)) {
spin_lock(&pool->lock);
/*
--
1.7.7.6
--
Regards,
Alexander Gordeev
agordeev@redhat.com
next prev parent reply other threads:[~2013-10-28 10:03 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <cover.1382950629.git.agordeev@redhat.com>
2013-10-28 10:05 ` [PATCH 1/5] percpu_ida: Fix data race on cpus_have_tags cpumask Alexander Gordeev
2013-10-28 21:20 ` Kent Overstreet
2013-10-28 10:05 ` [PATCH 2/5] percpu_ida: Move waking up waiters out of atomic contexts Alexander Gordeev
2013-10-28 21:21 ` Kent Overstreet
2013-10-28 10:05 ` Alexander Gordeev [this message]
2013-10-28 10:06 ` [PATCH 4/5] percpu_ida: Sanity check initialization parameters Alexander Gordeev
2013-10-28 10:06 ` [PATCH 5/5] percpu_ida: Allow variable maximum number of cached tags 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=20131028100547.GD5744@dhcp-26-207.brq.redhat.com \
--to=agordeev@redhat.com \
--cc=axboe@kernel.dk \
--cc=kmo@daterainc.com \
--cc=linux-kernel@vger.kernel.org \
--cc=nab@linux-iscsi.org \
--cc=oleg@redhat.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
all inboxes | Powered by JetHome®