Blame view

include/linux/pageblock-flags.h 3.08 KB
835c134ec   Mel Gorman   Add a bitmap that...
1
2
  /*
   * Macros for manipulating and testing flags related to a
d9c234005   Mel Gorman   Do not depend on ...
3
   * pageblock_nr_pages number of pages.
835c134ec   Mel Gorman   Add a bitmap that...
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
   *
   * 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>
835c134ec   Mel Gorman   Add a bitmap that...
27
28
  /* Bit indices that affect a whole block of pages */
  enum pageblock_bits {
c801ed386   Paul Jackson   x86 boot: simplif...
29
30
31
  	PB_migrate,
  	PB_migrate_end = PB_migrate + 3 - 1,
  			/* 3 bits required for migrate types */
bb13ffeb9   Mel Gorman   mm: compaction: c...
32
  	PB_migrate_skip,/* If set the block is skipped by compaction */
e58469baf   Mel Gorman   mm: page_alloc: u...
33
34
35
36
37
  
  	/*
  	 * Assume the bits will always align on a word. If this assumption
  	 * changes then get/set pageblock needs updating.
  	 */
835c134ec   Mel Gorman   Add a bitmap that...
38
39
  	NR_PAGEBLOCK_BITS
  };
d9c234005   Mel Gorman   Do not depend on ...
40
41
42
43
44
  #ifdef CONFIG_HUGETLB_PAGE
  
  #ifdef CONFIG_HUGETLB_PAGE_SIZE_VARIABLE
  
  /* Huge page sizes are variable */
d00181b96   Kirill A. Shutemov   mm: use 'unsigned...
45
  extern unsigned int pageblock_order;
d9c234005   Mel Gorman   Do not depend on ...
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
  
  #else /* CONFIG_HUGETLB_PAGE_SIZE_VARIABLE */
  
  /* Huge pages are a constant size */
  #define pageblock_order		HUGETLB_PAGE_ORDER
  
  #endif /* CONFIG_HUGETLB_PAGE_SIZE_VARIABLE */
  
  #else /* CONFIG_HUGETLB_PAGE */
  
  /* If huge pages are not used, group by MAX_ORDER_NR_PAGES */
  #define pageblock_order		(MAX_ORDER-1)
  
  #endif /* CONFIG_HUGETLB_PAGE */
  
  #define pageblock_nr_pages	(1UL << pageblock_order)
835c134ec   Mel Gorman   Add a bitmap that...
62
63
  /* Forward declaration */
  struct page;
dc4b0caff   Mel Gorman   mm: page_alloc: r...
64
65
  unsigned long get_pfnblock_flags_mask(struct page *page,
  				unsigned long pfn,
e58469baf   Mel Gorman   mm: page_alloc: u...
66
67
  				unsigned long end_bitidx,
  				unsigned long mask);
dc4b0caff   Mel Gorman   mm: page_alloc: r...
68
69
  
  void set_pfnblock_flags_mask(struct page *page,
e58469baf   Mel Gorman   mm: page_alloc: u...
70
  				unsigned long flags,
dc4b0caff   Mel Gorman   mm: page_alloc: r...
71
  				unsigned long pfn,
e58469baf   Mel Gorman   mm: page_alloc: u...
72
73
  				unsigned long end_bitidx,
  				unsigned long mask);
835c134ec   Mel Gorman   Add a bitmap that...
74
  /* Declarations for getting and setting flags. See mm/page_alloc.c */
dc4b0caff   Mel Gorman   mm: page_alloc: r...
75
76
77
78
79
80
81
82
  #define get_pageblock_flags_group(page, start_bitidx, end_bitidx) \
  	get_pfnblock_flags_mask(page, page_to_pfn(page),		\
  			end_bitidx,					\
  			(1 << (end_bitidx - start_bitidx + 1)) - 1)
  #define set_pageblock_flags_group(page, flags, start_bitidx, end_bitidx) \
  	set_pfnblock_flags_mask(page, flags, page_to_pfn(page),		\
  			end_bitidx,					\
  			(1 << (end_bitidx - start_bitidx + 1)) - 1)
835c134ec   Mel Gorman   Add a bitmap that...
83

bb13ffeb9   Mel Gorman   mm: compaction: c...
84
85
86
  #ifdef CONFIG_COMPACTION
  #define get_pageblock_skip(page) \
  			get_pageblock_flags_group(page, PB_migrate_skip,     \
627260595   Bartlomiej Zolnierkiewicz   mm: compaction: f...
87
  							PB_migrate_skip)
bb13ffeb9   Mel Gorman   mm: compaction: c...
88
89
  #define clear_pageblock_skip(page) \
  			set_pageblock_flags_group(page, 0, PB_migrate_skip,  \
627260595   Bartlomiej Zolnierkiewicz   mm: compaction: f...
90
  							PB_migrate_skip)
bb13ffeb9   Mel Gorman   mm: compaction: c...
91
92
  #define set_pageblock_skip(page) \
  			set_pageblock_flags_group(page, 1, PB_migrate_skip,  \
627260595   Bartlomiej Zolnierkiewicz   mm: compaction: f...
93
  							PB_migrate_skip)
bb13ffeb9   Mel Gorman   mm: compaction: c...
94
  #endif /* CONFIG_COMPACTION */
835c134ec   Mel Gorman   Add a bitmap that...
95
  #endif	/* PAGEBLOCK_FLAGS_H */