Hibernation: do not try to mark invalid PFNs as nosave
authorRafael J. Wysocki <[email protected]>
Fri, 10 Aug 2007 20:00:57 +0000 (13:00 -0700)
committerLinus Torvalds <[email protected]>
Sat, 11 Aug 2007 22:47:40 +0000 (15:47 -0700)
On some systems some PFNs reported by the early initialization code as
'nosave' may be invalid.  If we try to set the corresponding bits in the
hibernation bitmap, BUG_ON() in memory_bm_find_bit() will be triggered and
the system won't be able to boot (cf.
https://bugzilla.novell.com/show_bug.cgi?id=296242).

Prevent this from happening by verifying if the 'nosave' PFNs are valid in
mark_nosave_pages().

Signed-off-by: Rafael J. Wysocki <[email protected]>
Acked-by: Pavel Machek <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
kernel/power/snapshot.c

index a3b7854b8f7c8ea2de21e8940e0f2f3be4ba50ca..a686590d88c1b5def265e84aa9ab9091c4b07290 100644 (file)
@@ -709,7 +709,8 @@ static void mark_nosave_pages(struct memory_bitmap *bm)
                                region->end_pfn << PAGE_SHIFT);
 
                for (pfn = region->start_pfn; pfn < region->end_pfn; pfn++)
-                       memory_bm_set_bit(bm, pfn);
+                       if (pfn_valid(pfn))
+                               memory_bm_set_bit(bm, pfn);
        }
 }