lkml.org 
[lkml]   [2014]   [Feb]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH RESEND 2/3] percpu_ida: Move waking up waiters out of atomic contexts
Date
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>
---
lib/percpu_ida.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/lib/percpu_ida.c b/lib/percpu_ida.c
index fccfb28..c2fa3dc 100644
--- a/lib/percpu_ida.c
+++ b/lib/percpu_ida.c
@@ -229,6 +229,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);

@@ -247,7 +248,7 @@ void percpu_ida_free(struct percpu_ida *pool, unsigned tag)
* Pairs with smp_rmb() in steal_tags()
*/
smp_wmb();
- wake_up(&pool->wait);
+ wake_up = true;
}

if (nr_free == pool->percpu_max_size) {
@@ -261,13 +262,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


\
 
 \ /
  Last update: 2014-02-06 14:01    [W:0.090 / U:0.404 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site