Get the size of a range of free pages beginning at the given page, and
finishing at the end of the zone in which the page is found if not before.
The page given may not itself be free, in which case the return value will
be zero.
Signed-off-by: Nigel Cunningham <[email protected]>
kernel/power/prepare_image.c | 18 ++++++++++++++++++
1 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/kernel/power/prepare_image.c b/kernel/power/prepare_image.c
index bf38334..0030661 100644
--- a/kernel/power/prepare_image.c
+++ b/kernel/power/prepare_image.c
@@ -222,3 +222,21 @@ static void generate_free_page_map(void)
}
}
+/* size_of_free_region
+ *
+ * Description: Return the number of pages that are free, beginning with and
+ * including this one.
+ */
+static int size_of_free_region(struct page *page)
+{
+ struct zone *zone = page_zone(page);
+ struct page *posn = page, *last_in_zone =
+ pfn_to_page(zone->zone_start_pfn) + zone->spanned_pages - 1;
+
+ while (posn < last_in_zone && !PageInUse(posn)) {
+ BUG_ON(PagePageset2(posn));
+ posn++;
+ }
+ return (posn - page);
+}
+
--
Nigel Cunningham nigel at suspend2 dot net
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]