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>
This commit is contained in:
Jamie Liu 2014-01-23 15:53:40 -08:00 committed by Linus Torvalds
parent 0d8a4a3799
commit a5998061da
1 changed files with 2 additions and 1 deletions

View File

@ -616,7 +616,7 @@ static unsigned long scan_swap_map(struct swap_info_struct *si,
}
}
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 @@ static unsigned long scan_swap_map(struct swap_info_struct *si,
cond_resched();
latency_ration = LATENCY_LIMIT;
}
offset++;
}
spin_lock(&si->lock);