From: Chen Yucong <slaoub@gmail.com>
To: shli@kernel.org
Cc: hughd@google.com, akpm@linux-foundation.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org, Chen Yucong <slaoub@gmail.com>
Subject: [PATCH] swap: Delete the "last_in_cluster < scan_base" loop in the body of scan_swap_map()
Date: Mon, 2 Jun 2014 19:54:13 +0800 [thread overview]
Message-ID: <1401710053-8460-1-git-send-email-slaoub@gmail.com> (raw)
>From commit ebc2a1a69111, 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@gmail.com>
---
mm/swapfile.c | 20 --------------------
1 file changed, 20 deletions(-)
diff --git a/mm/swapfile.c b/mm/swapfile.c
index beeeef8..1b44bd9 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -549,26 +549,6 @@ static unsigned long scan_swap_map(struct swap_info_struct *si,
}
}
- 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;
--
1.7.10.4
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next reply other threads:[~2014-06-02 11:55 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-02 11:54 Chen Yucong [this message]
2014-06-02 23:26 ` [PATCH] swap: Delete the "last_in_cluster < scan_base" loop in the body of scan_swap_map() Hugh Dickins
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1401710053-8460-1-git-send-email-slaoub@gmail.com \
--to=slaoub@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=hughd@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=shli@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).