mm, swap: improve readability via make spin_lock/unlock balanced
authorHuang Ying <ying.huang@intel.com>
Wed, 3 May 2017 21:54:36 +0000 (14:54 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 3 May 2017 22:52:10 +0000 (15:52 -0700)
This is just a cleanup patch, no functionality change.

In cluster_list_add_tail(), spin_lock_nested() is used to lock the
cluster, while unlock_cluster() is used to unlock the cluster.  To
improve the code readability, use spin_unlock() directly to unlock the
cluster.

Link: http://lkml.kernel.org/r/20170317064635.12792-2-ying.huang@intel.com
Signed-off-by: "Huang, Ying" <ying.huang@intel.com>
Acked-by: Tim Chen <tim.c.chen@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/swapfile.c

index 6b6bb1bb620970d2081b64bad79db9d43d504f8f..42fd620dcf4cf3fb00a68c08f5389a1067213f7c 100644 (file)
@@ -335,7 +335,7 @@ static void cluster_list_add_tail(struct swap_cluster_list *list,
                ci_tail = ci + tail;
                spin_lock_nested(&ci_tail->lock, SINGLE_DEPTH_NESTING);
                cluster_set_next(ci_tail, idx);
-               unlock_cluster(ci_tail);
+               spin_unlock(&ci_tail->lock);
                cluster_set_next_flag(&list->tail, idx, 0);
        }
 }