[PATCH 08/10] libxfs: remove a couple of locks
Dave Chinner
david at fromorbit.com
Mon Feb 24 00:29:27 CST 2014
From: Dave Chinner <dchinner at redhat.com>
THe libxfs cache has a lot of false scalability about it. I can't
get lookups to scale past about one and half CPUs, with one of the
key problems being a preponderance of global locks.
Like just after doing a hash lookup, that is careful only to take
the hash chain lock, it takes a global cache lock to update the
cache hit statistic. Scalable? Not at all.
The node priority stuff is protected by the object locks (i.e the
buffer lock) and so it doesn't need locks, either.
This doesn't do very much to improve scalability, but it's a small
start.
Signed-off-by: Dave Chinner <dchinner at redhat.com>
---
libxfs/cache.c | 6 ------
1 file changed, 6 deletions(-)
diff --git a/libxfs/cache.c b/libxfs/cache.c
index dc69689..9f7f8f4 100644
--- a/libxfs/cache.c
+++ b/libxfs/cache.c
@@ -391,9 +391,7 @@ cache_node_get(
pthread_mutex_unlock(&node->cn_mutex);
pthread_mutex_unlock(&hash->ch_mutex);
- pthread_mutex_lock(&cache->c_mutex);
cache->c_hits++;
- pthread_mutex_unlock(&cache->c_mutex);
*nodep = node;
return 0;
@@ -482,10 +480,8 @@ cache_node_set_priority(
else if (priority > CACHE_MAX_PRIORITY)
priority = CACHE_MAX_PRIORITY;
- pthread_mutex_lock(&node->cn_mutex);
ASSERT(node->cn_count > 0);
node->cn_priority = priority;
- pthread_mutex_unlock(&node->cn_mutex);
}
int
@@ -494,9 +490,7 @@ cache_node_get_priority(
{
int priority;
- pthread_mutex_lock(&node->cn_mutex);
priority = node->cn_priority;
- pthread_mutex_unlock(&node->cn_mutex);
return priority;
}
--
1.8.4.rc3
More information about the xfs
mailing list