diff options
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/mmzone.h | 13 | ||||
-rw-r--r-- | include/linux/pageblock-flags.h | 51 |
2 files changed, 64 insertions, 0 deletions
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index f6167f2fd7f..322e8048463 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -13,6 +13,7 @@ #include <linux/init.h> #include <linux/seqlock.h> #include <linux/nodemask.h> +#include <linux/pageblock-flags.h> #include <asm/atomic.h> #include <asm/page.h> @@ -222,6 +223,14 @@ struct zone { #endif struct free_area free_area[MAX_ORDER]; +#ifndef CONFIG_SPARSEMEM + /* + * Flags for a MAX_ORDER_NR_PAGES block. See pageblock-flags.h. + * In SPARSEMEM, this map is stored in struct mem_section + */ + unsigned long *pageblock_flags; +#endif /* CONFIG_SPARSEMEM */ + ZONE_PADDING(_pad1_) @@ -720,6 +729,9 @@ extern struct zone *next_zone(struct zone *zone); #define PAGES_PER_SECTION (1UL << PFN_SECTION_SHIFT) #define PAGE_SECTION_MASK (~(PAGES_PER_SECTION-1)) +#define SECTION_BLOCKFLAGS_BITS \ + ((SECTION_SIZE_BITS - (MAX_ORDER-1)) * NR_PAGEBLOCK_BITS) + #if (MAX_ORDER - 1 + PAGE_SHIFT) > SECTION_SIZE_BITS #error Allocator MAX_ORDER exceeds SECTION_SIZE #endif @@ -739,6 +751,7 @@ struct mem_section { * before using it wrong. */ unsigned long section_mem_map; + DECLARE_BITMAP(pageblock_flags, SECTION_BLOCKFLAGS_BITS); }; #ifdef CONFIG_SPARSEMEM_EXTREME diff --git a/include/linux/pageblock-flags.h b/include/linux/pageblock-flags.h new file mode 100644 index 00000000000..96b623f9b4d --- /dev/null +++ b/include/linux/pageblock-flags.h @@ -0,0 +1,51 @@ +/* + * Macros for manipulating and testing flags related to a + * MAX_ORDER_NR_PAGES block of pages. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * Copyright (C) IBM Corporation, 2006 + * + * Original author, Mel Gorman + * Major cleanups and reduction of bit operations, Andy Whitcroft + */ +#ifndef PAGEBLOCK_FLAGS_H +#define PAGEBLOCK_FLAGS_H + +#include <linux/types.h> + +/* Macro to aid the definition of ranges of bits */ +#define PB_range(name, required_bits) \ + name, name ## _end = (name + required_bits) - 1 + +/* Bit indices that affect a whole block of pages */ +enum pageblock_bits { + NR_PAGEBLOCK_BITS +}; + +/* Forward declaration */ +struct page; + +/* Declarations for getting and setting flags. See mm/page_alloc.c */ +unsigned long get_pageblock_flags_group(struct page *page, + int start_bitidx, int end_bitidx); +void set_pageblock_flags_group(struct page *page, unsigned long flags, + int start_bitidx, int end_bitidx); + +#define get_pageblock_flags(page) \ + get_pageblock_flags_group(page, 0, NR_PAGEBLOCK_BITS-1) +#define set_pageblock_flags(page) \ + set_pageblock_flags_group(page, 0, NR_PAGEBLOCK_BITS-1) + +#endif /* PAGEBLOCK_FLAGS_H */ |