Commit a5998061 authored by Jamie Liu's avatar Jamie Liu Committed by Linus Torvalds

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: default avatarJamie Liu <jamieliu@google.com>
Cc: Shaohua Li <shli@fusionio.com>
Acked-by: default avatarHugh Dickins <hughd@google.com>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 0d8a4a37
...@@ -616,7 +616,7 @@ static unsigned long scan_swap_map(struct swap_info_struct *si, ...@@ -616,7 +616,7 @@ static unsigned long scan_swap_map(struct swap_info_struct *si,
} }
} }
offset = si->lowest_bit; offset = si->lowest_bit;
while (++offset < scan_base) { while (offset < scan_base) {
if (!si->swap_map[offset]) { if (!si->swap_map[offset]) {
spin_lock(&si->lock); spin_lock(&si->lock);
goto checks; goto checks;
...@@ -629,6 +629,7 @@ static unsigned long scan_swap_map(struct swap_info_struct *si, ...@@ -629,6 +629,7 @@ static unsigned long scan_swap_map(struct swap_info_struct *si,
cond_resched(); cond_resched();
latency_ration = LATENCY_LIMIT; latency_ration = LATENCY_LIMIT;
} }
offset++;
} }
spin_lock(&si->lock); spin_lock(&si->lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment