Skip to content

Commit a599806

Browse files
nixprimetorvalds
authored andcommitted
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>
1 parent 0d8a4a3 commit a599806

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎mm/swapfile.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,7 @@ static unsigned long scan_swap_map(struct swap_info_struct *si,
616616
}
617617
}
618618
offset = si->lowest_bit;
619-
while (++offset < scan_base) {
619+
while (offset < scan_base) {
620620
if (!si->swap_map[offset]) {
621621
spin_lock(&si->lock);
622622
goto checks;
@@ -629,6 +629,7 @@ static unsigned long scan_swap_map(struct swap_info_struct *si,
629629
cond_resched();
630630
latency_ration = LATENCY_LIMIT;
631631
}
632+
offset++;
632633
}
633634
spin_lock(&si->lock);
634635

0 commit comments

Comments
 (0)