From: Akinobu Mita Date: Wed, 22 Mar 2006 08:09:09 +0000 (-0800) Subject: [PATCH] fix swap cluster offset X-Git-Tag: v2.6.17-rc1~1129^2~19 X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=9b65ef59d42a56fa1358958ede77aaa5bac385a8;p=~emulex%2Finfiniband.git [PATCH] fix swap cluster offset When we've allocated SWAPFILE_CLUSTER pages, ->cluster_next should be the first index of swap cluster. But current code probably sets it wrong offset. Signed-off-by: Akinobu Mita Acked-by: Hugh Dickins Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/mm/swapfile.c b/mm/swapfile.c index 1f9cf0d073b..365ed6ff182 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -116,7 +116,7 @@ static inline unsigned long scan_swap_map(struct swap_info_struct *si) last_in_cluster = offset + SWAPFILE_CLUSTER; else if (offset == last_in_cluster) { spin_lock(&swap_lock); - si->cluster_next = offset-SWAPFILE_CLUSTER-1; + si->cluster_next = offset-SWAPFILE_CLUSTER+1; goto cluster; } if (unlikely(--latency_ration < 0)) {