mm/swapfile.c: do not skip lowest_bit in scan_swap_map() scan loop
authorJamie Liu <jamieliu@google.com>
Thu, 23 Jan 2014 23:53:40 +0000 (15:53 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 24 Jan 2014 00:36:53 +0000 (16:36 -0800)
In the second half of scan_swap_map()'s scan loop, offset is set to
si->lowest_bit and then incremented before entering the loop for the
first time, causing si->swap_map[si->lowest_bit] to be skipped.

Signed-off-by: Jamie Liu <jamieliu@google.com>
Cc: Shaohua Li <shli@fusionio.com>
Acked-by: Hugh Dickins <hughd@google.com>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/swapfile.c

index d443dea95c27bd060c4a545bcfe39ba722cbe64f..c6c13b050a58c4223464221a61e93a9944aec9f5 100644 (file)
@@ -616,7 +616,7 @@ scan:
                }
        }
        offset = si->lowest_bit;
-       while (++offset < scan_base) {
+       while (offset < scan_base) {
                if (!si->swap_map[offset]) {
                        spin_lock(&si->lock);
                        goto checks;
@@ -629,6 +629,7 @@ scan:
                        cond_resched();
                        latency_ration = LATENCY_LIMIT;
                }
+               offset++;
        }
        spin_lock(&si->lock);