lkml.org 
[lkml]   [2013]   [Oct]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH 3/5] percpu_ida: Optimize freeing tags when maximum cache size is 1
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


\
 
 \ /
  Last update: 2013-10-28 11:41    [W:0.026 / U:0.116 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site