Skip to content

Commit

Permalink
mm/swapfile.c: do not skip lowest_bit in scan_swap_map() scan loop
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jamie Liu authored and Linus Torvalds committed Jan 24, 2014
1 parent 0d8a4a3 commit a599806
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion mm/swapfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);

Expand Down

0 comments on commit a599806

Please sign in to comment.