aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/linux/mmzone.h13
-rw-r--r--include/linux/pageblock-flags.h51
2 files changed, 64 insertions, 0 deletions
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index f6167f2fd7fb..322e8048463e 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -13,6 +13,7 @@
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/seqlock.h> 14#include <linux/seqlock.h>
15#include <linux/nodemask.h> 15#include <linux/nodemask.h>
16#include <linux/pageblock-flags.h>
16#include <asm/atomic.h> 17#include <asm/atomic.h>
17#include <asm/page.h> 18#include <asm/page.h>
18 19
@@ -222,6 +223,14 @@ struct zone {
222#endif 223#endif
223 struct free_area free_area[MAX_ORDER]; 224 struct free_area free_area[MAX_ORDER];
224 225
226#ifndef CONFIG_SPARSEMEM
227 /*
228 * Flags for a MAX_ORDER_NR_PAGES block. See pageblock-flags.h.
229 * In SPARSEMEM, this map is stored in struct mem_section
230 */
231 unsigned long *pageblock_flags;
232#endif /* CONFIG_SPARSEMEM */
233
225 234
226 ZONE_PADDING(_pad1_) 235 ZONE_PADDING(_pad1_)
227 236
@@ -720,6 +729,9 @@ extern struct zone *next_zone(struct zone *zone);
720#define PAGES_PER_SECTION (1UL << PFN_SECTION_SHIFT) 729#define PAGES_PER_SECTION (1UL << PFN_SECTION_SHIFT)
721#define PAGE_SECTION_MASK (~(PAGES_PER_SECTION-1)) 730#define PAGE_SECTION_MASK (~(PAGES_PER_SECTION-1))
722 731
732#define SECTION_BLOCKFLAGS_BITS \
733 ((SECTION_SIZE_BITS - (MAX_ORDER-1)) * NR_PAGEBLOCK_BITS)
734
723#if (MAX_ORDER - 1 + PAGE_SHIFT) > SECTION_SIZE_BITS 735#if (MAX_ORDER - 1 + PAGE_SHIFT) > SECTION_SIZE_BITS
724#error Allocator MAX_ORDER exceeds SECTION_SIZE 736#error Allocator MAX_ORDER exceeds SECTION_SIZE
725#endif 737#endif
@@ -739,6 +751,7 @@ struct mem_section {
739 * before using it wrong. 751 * before using it wrong.
740 */ 752 */
741 unsigned long section_mem_map; 753 unsigned long section_mem_map;
754 DECLARE_BITMAP(pageblock_flags, SECTION_BLOCKFLAGS_BITS);
742}; 755};
743 756
744#ifdef CONFIG_SPARSEMEM_EXTREME 757#ifdef CONFIG_SPARSEMEM_EXTREME
diff --git a/include/linux/pageblock-flags.h b/include/linux/pageblock-flags.h
new file mode 100644
index 000000000000..96b623f9b4db
--- /dev/null
+++ b/include/linux/pageblock-flags.h
@@ -0,0 +1,51 @@
1/*
2 * Macros for manipulating and testing flags related to a
3 * MAX_ORDER_NR_PAGES block of pages.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation version 2 of the License
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 *
18 * Copyright (C) IBM Corporation, 2006
19 *
20 * Original author, Mel Gorman
21 * Major cleanups and reduction of bit operations, Andy Whitcroft
22 */
23#ifndef PAGEBLOCK_FLAGS_H
24#define PAGEBLOCK_FLAGS_H
25
26#include <linux/types.h>
27
28/* Macro to aid the definition of ranges of bits */
29#define PB_range(name, required_bits) \
30 name, name ## _end = (name + required_bits) - 1
31
32/* Bit indices that affect a whole block of pages */
33enum pageblock_bits {
34 NR_PAGEBLOCK_BITS
35};
36
37/* Forward declaration */
38struct page;
39
40/* Declarations for getting and setting flags. See mm/page_alloc.c */
41unsigned long get_pageblock_flags_group(struct page *page,
42 int start_bitidx, int end_bitidx);
43void set_pageblock_flags_group(struct page *page, unsigned long flags,
44 int start_bitidx, int end_bitidx);
45
46#define get_pageblock_flags(page) \
47 get_pageblock_flags_group(page, 0, NR_PAGEBLOCK_BITS-1)
48#define set_pageblock_flags(page) \
49 set_pageblock_flags_group(page, 0, NR_PAGEBLOCK_BITS-1)
50
51#endif /* PAGEBLOCK_FLAGS_H */