* [PATCH RESEND 0/2] percpu_ida: Couple of tweaks
@ 2014-04-22 14:51 Alexander Gordeev
2014-04-22 14:51 ` [PATCH RESEND 1/2] percpu_ida: Move waking up waiters out of atomic contexts Alexander Gordeev
2014-04-22 14:51 ` [PATCH RESEND 2/2] percpu_ida: Sanity check initialization parameters Alexander Gordeev
0 siblings, 2 replies; 3+ messages in thread
From: Alexander Gordeev @ 2014-04-22 14:51 UTC (permalink / raw)
To: linux-kernel
Cc: Alexander Gordeev, Kent Overstreet, Peter Zijlstra, Jens Axboe,
Nicholas A. Bellinger
Hello,
The patches are against 3.15-rc2
Cc: Kent Overstreet <kmo@daterainc.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: "Nicholas A. Bellinger" <nab@linux-iscsi.org>
Alexander Gordeev (2):
percpu_ida: Move waking up waiters out of atomic contexts
percpu_ida: Sanity check initialization parameters
lib/percpu_ida.c | 17 ++++++++++++-----
1 files changed, 12 insertions(+), 5 deletions(-)
--
1.7.7.6
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH RESEND 1/2] percpu_ida: Move waking up waiters out of atomic contexts
2014-04-22 14:51 [PATCH RESEND 0/2] percpu_ida: Couple of tweaks Alexander Gordeev
@ 2014-04-22 14:51 ` Alexander Gordeev
2014-04-22 14:51 ` [PATCH RESEND 2/2] percpu_ida: Sanity check initialization parameters Alexander Gordeev
1 sibling, 0 replies; 3+ messages in thread
From: Alexander Gordeev @ 2014-04-22 14:51 UTC (permalink / raw)
To: linux-kernel
Cc: Alexander Gordeev, Kent Overstreet, Peter Zijlstra, Jens Axboe,
Nicholas A. Bellinger
Currently percpu_ida_free() waikes up waiters always with local
interrupts disabled and sometimes with pool->lock held. Yet, it
does not appear there is any reason why it could not be done out
of these atomic contexts.
Signed-off-by: Alexander Gordeev <agordeev@redhat.com>
Cc: Kent Overstreet <kmo@daterainc.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: "Nicholas A. Bellinger" <nab@linux-iscsi.org>
Acked-by: Kent Overstreet <kmo@daterainc.com>
Signed-off-by: Alexander Gordeev <agordeev@redhat.com>
---
lib/percpu_ida.c | 12 +++++++-----
1 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/lib/percpu_ida.c b/lib/percpu_ida.c
index 93d145e..472ff08 100644
--- a/lib/percpu_ida.c
+++ b/lib/percpu_ida.c
@@ -221,6 +221,7 @@ void percpu_ida_free(struct percpu_ida *pool, unsigned tag)
struct percpu_ida_cpu *tags;
unsigned long flags;
unsigned nr_free;
+ bool wake_up = false;
BUG_ON(tag >= pool->nr_tags);
@@ -234,9 +235,8 @@ void percpu_ida_free(struct percpu_ida *pool, unsigned tag)
spin_unlock(&tags->lock);
if (nr_free == 1) {
- cpumask_set_cpu(smp_processor_id(),
- &pool->cpus_have_tags);
- wake_up(&pool->wait);
+ cpumask_set_cpu(smp_processor_id(), &pool->cpus_have_tags);
+ wake_up = true;
}
if (nr_free == pool->percpu_max_size) {
@@ -250,13 +250,15 @@ void percpu_ida_free(struct percpu_ida *pool, unsigned tag)
move_tags(pool->freelist, &pool->nr_free,
tags->freelist, &tags->nr_free,
pool->percpu_batch_size);
-
- wake_up(&pool->wait);
+ wake_up = true;
}
spin_unlock(&pool->lock);
}
local_irq_restore(flags);
+
+ if (wake_up)
+ wake_up(&pool->wait);
}
EXPORT_SYMBOL_GPL(percpu_ida_free);
--
1.7.7.6
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH RESEND 2/2] percpu_ida: Sanity check initialization parameters
2014-04-22 14:51 [PATCH RESEND 0/2] percpu_ida: Couple of tweaks Alexander Gordeev
2014-04-22 14:51 ` [PATCH RESEND 1/2] percpu_ida: Move waking up waiters out of atomic contexts Alexander Gordeev
@ 2014-04-22 14:51 ` Alexander Gordeev
1 sibling, 0 replies; 3+ messages in thread
From: Alexander Gordeev @ 2014-04-22 14:51 UTC (permalink / raw)
To: linux-kernel
Cc: Alexander Gordeev, Kent Overstreet, Peter Zijlstra, Jens Axboe,
Nicholas A. Bellinger
Signed-off-by: Alexander Gordeev <agordeev@redhat.com>
Cc: Kent Overstreet <kmo@daterainc.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: "Nicholas A. Bellinger" <nab@linux-iscsi.org>
Acked-by: Kent Overstreet <kmo@daterainc.com>
---
lib/percpu_ida.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/lib/percpu_ida.c b/lib/percpu_ida.c
index 472ff08..f474f03 100644
--- a/lib/percpu_ida.c
+++ b/lib/percpu_ida.c
@@ -293,6 +293,11 @@ int __percpu_ida_init(struct percpu_ida *pool, unsigned long nr_tags,
{
unsigned i, cpu, order;
+ if (batch_size > max_size)
+ return -ERANGE;
+ if (!batch_size)
+ return -EINVAL;
+
memset(pool, 0, sizeof(*pool));
init_waitqueue_head(&pool->wait);
--
1.7.7.6
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-04-22 14:51 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-22 14:51 [PATCH RESEND 0/2] percpu_ida: Couple of tweaks Alexander Gordeev
2014-04-22 14:51 ` [PATCH RESEND 1/2] percpu_ida: Move waking up waiters out of atomic contexts Alexander Gordeev
2014-04-22 14:51 ` [PATCH RESEND 2/2] percpu_ida: Sanity check initialization parameters Alexander Gordeev
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.