2 * kernel/power/tuxonice_pageflags.h
4 * Copyright (C) 2004-2007 Nigel Cunningham (nigel at suspend2 net)
6 * This file is released under the GPLv2.
8 * TuxOnIce needs a few pageflags while working that aren't otherwise
9 * used. To save the struct page pageflags, we dynamically allocate
10 * a bitmap and use that. These are the only non order-0 allocations
14 * We assume that PAGE_SIZE - sizeof(void *) is a multiple of
15 * sizeof(unsigned long). Is this ever false?
18 #include <linux/dyn_pageflags.h>
19 #include <linux/suspend.h>
21 extern dyn_pageflags_t pageset1_map
;
22 extern dyn_pageflags_t pageset1_copy_map
;
23 extern dyn_pageflags_t pageset2_map
;
24 extern dyn_pageflags_t page_resave_map
;
25 extern dyn_pageflags_t io_map
;
26 extern dyn_pageflags_t nosave_map
;
27 extern dyn_pageflags_t free_map
;
29 #define PagePageset1(page) (test_dynpageflag(&pageset1_map, page))
30 #define SetPagePageset1(page) (set_dynpageflag(&pageset1_map, page))
31 #define ClearPagePageset1(page) (clear_dynpageflag(&pageset1_map, page))
33 #define PagePageset1Copy(page) (test_dynpageflag(&pageset1_copy_map, page))
34 #define SetPagePageset1Copy(page) (set_dynpageflag(&pageset1_copy_map, page))
35 #define ClearPagePageset1Copy(page) (clear_dynpageflag(&pageset1_copy_map, page))
37 #define PagePageset2(page) (test_dynpageflag(&pageset2_map, page))
38 #define SetPagePageset2(page) (set_dynpageflag(&pageset2_map, page))
39 #define ClearPagePageset2(page) (clear_dynpageflag(&pageset2_map, page))
41 #define PageWasRW(page) (test_dynpageflag(&pageset2_map, page))
42 #define SetPageWasRW(page) (set_dynpageflag(&pageset2_map, page))
43 #define ClearPageWasRW(page) (clear_dynpageflag(&pageset2_map, page))
45 #define PageResave(page) (page_resave_map ? test_dynpageflag(&page_resave_map, page) : 0)
46 #define SetPageResave(page) (set_dynpageflag(&page_resave_map, page))
47 #define ClearPageResave(page) (clear_dynpageflag(&page_resave_map, page))
49 #define PageNosave(page) (nosave_map ? test_dynpageflag(&nosave_map, page) : 0)
50 #define SetPageNosave(page) (set_dynpageflag(&nosave_map, page))
51 #define ClearPageNosave(page) (clear_dynpageflag(&nosave_map, page))
53 #define PageNosaveFree(page) (free_map ? test_dynpageflag(&free_map, page) : 0)
54 #define SetPageNosaveFree(page) (set_dynpageflag(&free_map, page))
55 #define ClearPageNosaveFree(page) (clear_dynpageflag(&free_map, page))
57 extern void save_dyn_pageflags(dyn_pageflags_t pagemap
);
58 extern int load_dyn_pageflags(dyn_pageflags_t pagemap
);
59 extern int toi_pageflags_space_needed(void);