[Top] [All Lists]

[PATCH 10/10] libxfs: remove a couple of locks

To: xfs@xxxxxxxxxxx
Subject: [PATCH 10/10] libxfs: remove a couple of locks
From: Dave Chinner <david@xxxxxxxxxxxxx>
Date: Thu, 27 Feb 2014 20:51:15 +1100
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <1393494675-30194-1-git-send-email-david@xxxxxxxxxxxxx>
References: <1393494675-30194-1-git-send-email-david@xxxxxxxxxxxxx>
From: Dave Chinner <dchinner@xxxxxxxxxx>

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

Signed-off-by: Dave Chinner <dchinner@xxxxxxxxxx>
 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_lock(&cache->c_mutex);
-                       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);
@@ -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;

<Prev in Thread] Current Thread [Next in Thread>