* [PATCH] mm: remove incorrect swap_count() from try_to_unuse()
@ 2009-11-02 16:50 Hugh Dickins
0 siblings, 0 replies; 3+ messages in thread
From: Hugh Dickins @ 2009-11-02 16:50 UTC (permalink / raw)
To: Linus Torvalds
Cc: Bo Liu, Bob Liu, Andrew Morton, KAMEZAWA Hiroyuki, linux-mm,
linux-kernel
From: Bo Liu <bo-liu@hotmail.com>
In try_to_unuse(), swcount is a local copy of *swap_map, including the
SWAP_HAS_CACHE bit; but a wrong comparison against swap_count(*swap_map),
which masks off the SWAP_HAS_CACHE bit, succeeded where it should fail.
That had the effect of resetting the mm from which to start searching
for the next swap page, to an irrelevant mm instead of to an mm in which
this swap page had been found: which may increase search time by ~20%.
But we're used to swapoff being slow, so never noticed the slowdown.
Remove that one spurious use of swap_count(): Bo Liu thought it merely
redundant, Hugh rewrote the description since it was measurably wrong.
Signed-off-by: Bo Liu <bo-liu@hotmail.com>
Signed-off-by: Hugh Dickins <hugh.dickins@tiscali.co.uk>
Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: stable@kernel.org
---
mm/swapfile.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
--- 2.6.32-rc5/mm/swapfile.c 2009-10-05 04:20:31.000000000 +0100
+++ linux/mm/swapfile.c 2009-10-28 19:31:43.000000000 +0000
@@ -1151,8 +1151,7 @@ static int try_to_unuse(unsigned int typ
} else
retval = unuse_mm(mm, entry, page);
- if (set_start_mm &&
- swap_count(*swap_map) < swcount) {
+ if (set_start_mm && *swap_map < swcount) {
mmput(new_start_mm);
atomic_inc(&mm->mm_users);
new_start_mm = mm;
--
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>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] mm: remove incorrect swap_count() from try_to_unuse()
2009-10-28 20:34 ` [PATCH] mm: remove incorrect swap_count() from try_to_unuse() Hugh Dickins
@ 2009-10-28 23:38 ` KAMEZAWA Hiroyuki
0 siblings, 0 replies; 3+ messages in thread
From: KAMEZAWA Hiroyuki @ 2009-10-28 23:38 UTC (permalink / raw)
To: Hugh Dickins; +Cc: Andrew Morton, Bob Liu, Bo Liu, linux-mm
On Wed, 28 Oct 2009 20:34:38 +0000 (GMT)
Hugh Dickins <hugh.dickins@tiscali.co.uk> wrote:
> From: Bo Liu <bo-liu@hotmail.com>
>
> In try_to_unuse(), swcount is a local copy of *swap_map, including the
> SWAP_HAS_CACHE bit; but a wrong comparison against swap_count(*swap_map),
> which masks off the SWAP_HAS_CACHE bit, succeeded where it should fail.
>
Ah, okay...
> That had the effect of resetting the mm from which to start searching
> for the next swap page, to an irrelevant mm instead of to an mm in which
> this swap page had been found: which may increase search time by ~20%.
> But we're used to swapoff being slow, so never noticed the slowdown.
>
> Remove that one spurious use of swap_count(): Bo Liu thought it merely
> redundant, Hugh rewrote the description since it was measurably wrong.
>
> Signed-off-by: Bo Liu <bo-liu@hotmail.com>
> Signed-off-by: Hugh Dickins <hugh.dickins@tiscali.co.uk>
> Cc: stable@kernel.org
Sorry for my misunderstanding.
Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> ---
>
> mm/swapfile.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> --- 2.6.32-rc5/mm/swapfile.c 2009-10-05 04:20:31.000000000 +0100
> +++ linux/mm/swapfile.c 2009-10-28 19:31:43.000000000 +0000
> @@ -1151,8 +1151,7 @@ static int try_to_unuse(unsigned int typ
> } else
> retval = unuse_mm(mm, entry, page);
>
> - if (set_start_mm &&
> - swap_count(*swap_map) < swcount) {
> + if (set_start_mm && *swap_map < swcount) {
> mmput(new_start_mm);
> atomic_inc(&mm->mm_users);
> new_start_mm = mm;
--
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>
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] mm: remove incorrect swap_count() from try_to_unuse()
2009-10-28 20:31 ` Hugh Dickins
@ 2009-10-28 20:34 ` Hugh Dickins
2009-10-28 23:38 ` KAMEZAWA Hiroyuki
0 siblings, 1 reply; 3+ messages in thread
From: Hugh Dickins @ 2009-10-28 20:34 UTC (permalink / raw)
To: Andrew Morton; +Cc: Bob Liu, KAMEZAWA Hiroyuki, Bo Liu, linux-mm
From: Bo Liu <bo-liu@hotmail.com>
In try_to_unuse(), swcount is a local copy of *swap_map, including the
SWAP_HAS_CACHE bit; but a wrong comparison against swap_count(*swap_map),
which masks off the SWAP_HAS_CACHE bit, succeeded where it should fail.
That had the effect of resetting the mm from which to start searching
for the next swap page, to an irrelevant mm instead of to an mm in which
this swap page had been found: which may increase search time by ~20%.
But we're used to swapoff being slow, so never noticed the slowdown.
Remove that one spurious use of swap_count(): Bo Liu thought it merely
redundant, Hugh rewrote the description since it was measurably wrong.
Signed-off-by: Bo Liu <bo-liu@hotmail.com>
Signed-off-by: Hugh Dickins <hugh.dickins@tiscali.co.uk>
Cc: stable@kernel.org
---
mm/swapfile.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
--- 2.6.32-rc5/mm/swapfile.c 2009-10-05 04:20:31.000000000 +0100
+++ linux/mm/swapfile.c 2009-10-28 19:31:43.000000000 +0000
@@ -1151,8 +1151,7 @@ static int try_to_unuse(unsigned int typ
} else
retval = unuse_mm(mm, entry, page);
- if (set_start_mm &&
- swap_count(*swap_map) < swcount) {
+ if (set_start_mm && *swap_map < swcount) {
mmput(new_start_mm);
atomic_inc(&mm->mm_users);
new_start_mm = mm;
--
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>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-11-02 16:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-02 16:50 [PATCH] mm: remove incorrect swap_count() from try_to_unuse() Hugh Dickins
-- strict thread matches above, loose matches on Subject: below --
2009-10-20 7:09 [PATCH] try_to_unuse : remove redundant swap_count() Bo Liu
2009-10-20 12:06 ` KAMEZAWA Hiroyuki
2009-10-21 1:25 ` Bob Liu
2009-10-28 20:31 ` Hugh Dickins
2009-10-28 20:34 ` [PATCH] mm: remove incorrect swap_count() from try_to_unuse() Hugh Dickins
2009-10-28 23:38 ` KAMEZAWA Hiroyuki
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox