Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751092AbdCQGto (ORCPT ); Fri, 17 Mar 2017 02:49:44 -0400 Received: from mga11.intel.com ([192.55.52.93]:10506 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750991AbdCQGtn (ORCPT ); Fri, 17 Mar 2017 02:49:43 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,175,1486454400"; d="scan'208";a="945346638" From: "Huang, Ying" To: Andrew Morton Cc: Andi Kleen , Dave Hansen , Shaohua Li , Rik van Riel , Huang Ying , Tim Chen , Michal Hocko , Hugh Dickins , Vegard Nossum , Ingo Molnar , "Kirill A. Shutemov" , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/5] mm, swap: Improve readability via make spin_lock/unlock balanced Date: Fri, 17 Mar 2017 14:46:20 +0800 Message-Id: <20170317064635.12792-2-ying.huang@intel.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170317064635.12792-1-ying.huang@intel.com> References: <20170317064635.12792-1-ying.huang@intel.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 933 Lines: 29 From: Huang Ying 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. Signed-off-by: "Huang, Ying" Acked-by: Tim Chen --- mm/swapfile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/swapfile.c b/mm/swapfile.c index 6b6bb1bb6209..42fd620dcf4c 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -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); } } -- 2.11.0