Subject: + swap-delete-the-last_in_cluster-scan_base-loop-in-the-body-of-scan_swap_map.patch added to -mm tree To: slaoub@xxxxxxxxx,hughd@xxxxxxxxxx,shli@xxxxxxxxxx From: akpm@xxxxxxxxxxxxxxxxxxxx Date: Mon, 02 Jun 2014 13:50:08 -0700 The patch titled Subject: mm/swapfile.c: delete the "last_in_cluster < scan_base" loop in the body of scan_swap_map() has been added to the -mm tree. Its filename is swap-delete-the-last_in_cluster-scan_base-loop-in-the-body-of-scan_swap_map.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/swap-delete-the-last_in_cluster-scan_base-loop-in-the-body-of-scan_swap_map.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/swap-delete-the-last_in_cluster-scan_base-loop-in-the-body-of-scan_swap_map.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Chen Yucong <slaoub@xxxxxxxxx> Subject: mm/swapfile.c: delete the "last_in_cluster < scan_base" loop in the body of scan_swap_map() Via ebc2a1a69111 ("swap: make cluster allocation per-cpu"), we can find that all SWP_SOLIDSTATE "seek is cheap"(SSD case) has already gone to si->cluster_info scan_swap_map_try_ssd_cluster() route. So that the "last_in_cluster < scan_base" loop in the body of scan_swap_map() has already become a dead code snippet, and it should have been deleted. This patch is to delete the redundant loop as Hugh and Shaohua suggested. Signed-off-by: Chen Yucong <slaoub@xxxxxxxxx> Cc: Shaohua Li <shli@xxxxxxxxxx> Cc: Hugh Dickins <hughd@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/swapfile.c | 20 -------------------- 1 file changed, 20 deletions(-) diff -puN mm/swapfile.c~swap-delete-the-last_in_cluster-scan_base-loop-in-the-body-of-scan_swap_map mm/swapfile.c --- a/mm/swapfile.c~swap-delete-the-last_in_cluster-scan_base-loop-in-the-body-of-scan_swap_map +++ a/mm/swapfile.c @@ -549,26 +549,6 @@ static unsigned long scan_swap_map(struc } } - offset = si->lowest_bit; - last_in_cluster = offset + SWAPFILE_CLUSTER - 1; - - /* Locate the first empty (unaligned) cluster */ - for (; last_in_cluster < scan_base; offset++) { - if (si->swap_map[offset]) - last_in_cluster = offset + SWAPFILE_CLUSTER; - else if (offset == last_in_cluster) { - spin_lock(&si->lock); - offset -= SWAPFILE_CLUSTER - 1; - si->cluster_next = offset; - si->cluster_nr = SWAPFILE_CLUSTER - 1; - goto checks; - } - if (unlikely(--latency_ration < 0)) { - cond_resched(); - latency_ration = LATENCY_LIMIT; - } - } - offset = scan_base; spin_lock(&si->lock); si->cluster_nr = SWAPFILE_CLUSTER - 1; _ Patches currently in -mm which might be from slaoub@xxxxxxxxx are hwpoison-remove-unused-global-variable-in-do_machine_check.patch swap-delete-the-last_in_cluster-scan_base-loop-in-the-body-of-scan_swap_map.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html