Commit a5998061daab27802c418debe662be98a6e42874

Authored by Jamie Liu
Committed by Linus Torvalds
1 parent 0d8a4a3799

mm/swapfile.c: do not skip lowest_bit in scan_swap_map() scan loop

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>

Showing 1 changed file with 2 additions and 1 deletions Side-by-side Diff

... ... @@ -616,7 +616,7 @@
616 616 }
617 617 }
618 618 offset = si->lowest_bit;
619   - while (++offset < scan_base) {
  619 + while (offset < scan_base) {
620 620 if (!si->swap_map[offset]) {
621 621 spin_lock(&si->lock);
622 622 goto checks;
... ... @@ -629,6 +629,7 @@
629 629 cond_resched();
630 630 latency_ration = LATENCY_LIMIT;
631 631 }
  632 + offset++;
632 633 }
633 634 spin_lock(&si->lock);
634 635