[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180712233636.20629-2-ying.huang@intel.com>
Date: Fri, 13 Jul 2018 07:36:31 +0800
From: "Huang, Ying" <ying.huang@...el.com>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: linux-mm@...ck.org, linux-kernel@...r.kernel.org,
Huang Ying <ying.huang@...el.com>,
Michal Hocko <mhocko@...e.com>,
Johannes Weiner <hannes@...xchg.org>,
Shaohua Li <shli@...nel.org>, Hugh Dickins <hughd@...gle.com>,
Minchan Kim <minchan@...nel.org>,
Rik van Riel <riel@...hat.com>,
Daniel Jordan <daniel.m.jordan@...cle.com>,
Dan Williams <dan.j.williams@...el.com>,
Dave Hansen <dave.hansen@...ux.intel.com>
Subject: [PATCH 1/6] swap: Add comments to lock_cluster_or_swap_info()
From: Huang Ying <ying.huang@...el.com>
To improve the code readability.
Signed-off-by: "Huang, Ying" <ying.huang@...el.com>
Suggested-by: Dave Hansen <dave.hansen@...ux.intel.com>
Cc: Michal Hocko <mhocko@...e.com>
Cc: Johannes Weiner <hannes@...xchg.org>
Cc: Shaohua Li <shli@...nel.org>
Cc: Hugh Dickins <hughd@...gle.com>
Cc: Minchan Kim <minchan@...nel.org>
Cc: Rik van Riel <riel@...hat.com>
Cc: Daniel Jordan <daniel.m.jordan@...cle.com>
Cc: Dan Williams <dan.j.williams@...el.com>
---
mm/swapfile.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/mm/swapfile.c b/mm/swapfile.c
index d8fddfb000ec..e31aa601d9c0 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -297,6 +297,12 @@ static inline void unlock_cluster(struct swap_cluster_info *ci)
spin_unlock(&ci->lock);
}
+/*
+ * At most times, fine grained cluster lock is sufficient to protect
+ * the operations on sis->swap_map. No need to acquire gross grained
+ * sis->lock. But cluster and cluster lock isn't available for HDD,
+ * so sis->lock will be instead for them.
+ */
static inline struct swap_cluster_info *lock_cluster_or_swap_info(
struct swap_info_struct *si,
unsigned long offset)
--
2.16.4
Powered by blists - more mailing lists