From: Hugh Dickins <hughd@google.com>
To: Chen Yucong <slaoub@gmail.com>
Cc: shli@kernel.org, hughd@google.com, akpm@linux-foundation.org,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] swap: Delete the "last_in_cluster < scan_base" loop in the body of scan_swap_map()
Date: Mon, 2 Jun 2014 16:26:13 -0700 (PDT) [thread overview]
Message-ID: <alpine.LSU.2.11.1406021603330.2584@eggly.anvils> (raw)
In-Reply-To: <1401710053-8460-1-git-send-email-slaoub@gmail.com>
On Mon, 2 Jun 2014, Chen Yucong wrote:
> 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>
That is very nice, thank you.
Acked-by: Hugh Dickins <hughd@google.com>
But it does beg for just a little more: perhaps Andrew can kindly fold in:
---
mm/swapfile.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
--- chen/mm/swapfile.c 2014-06-02 15:55:44.812368186 -0700
+++ hugh/mm/swapfile.c 2014-06-02 16:15:20.344396124 -0700
@@ -505,13 +505,10 @@ static unsigned long scan_swap_map(struc
/*
* If seek is expensive, start searching for new cluster from
* start of partition, to minimize the span of allocated swap.
- * But if seek is cheap, search from our current position, so
- * that swap is allocated from all over the partition: if the
- * Flash Translation Layer only remaps within limited zones,
- * we don't want to wear out the first zone too quickly.
+ * If seek is cheap, that is the SWP_SOLIDSTATE si->cluster_info
+ * case, just handled by scan_swap_map_try_ssd_cluster() above.
*/
- if (!(si->flags & SWP_SOLIDSTATE))
- scan_base = offset = si->lowest_bit;
+ scan_base = offset = si->lowest_bit;
last_in_cluster = offset + SWAPFILE_CLUSTER - 1;
/* Locate the first empty (unaligned) cluster */
--
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>
prev parent reply other threads:[~2014-06-02 23:27 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-02 11:54 Chen Yucong
2014-06-02 23:26 ` Hugh Dickins [this message]
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=alpine.LSU.2.11.1406021603330.2584@eggly.anvils \
--to=hughd@google.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=shli@kernel.org \
--cc=slaoub@gmail.com \
/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