aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/mm.h
diff options
context:
space:
mode:
authorHeiko Carstens <heiko.carstens@de.ibm.com>2006-09-27 04:50:01 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-09-27 11:26:12 -0400
commit5b99cd0effaf846240a15441aec459a592577eaf (patch)
tree355772422c716698762030e6261596c2ba484a37 /include/linux/mm.h
parente129b5c23c2b471d47f1c5d2b8b193fc2034af43 (diff)
[PATCH] own header file for struct page
This moves the definition of struct page from mm.h to its own header file page-struct.h. This is a prereq to fix SetPageUptodate which is broken on s390: #define SetPageUptodate(_page) do { struct page *__page = (_page); if (!test_and_set_bit(PG_uptodate, &__page->flags)) page_test_and_clear_dirty(_page); } while (0) _page gets used twice in this macro which can cause subtle bugs. Using __page for the page_test_and_clear_dirty call doesn't work since it causes yet another problem with the page_test_and_clear_dirty macro as well. In order to avoid all these problems caused by macros it seems to be a good idea to get rid of them and convert them to static inline functions. Because of header file include order it's necessary to have a seperate header file for the struct page definition. Cc: Martin Schwidefsky <schwidefsky@de.ibm.com> Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Cc: Roman Zippel <zippel@linux-m68k.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include/linux/mm.h')
-rw-r--r--include/linux/mm.h62
1 files changed, 1 insertions, 61 deletions
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 9d046db31e76..7477fb59c4f2 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -16,6 +16,7 @@
16#include <linux/mutex.h> 16#include <linux/mutex.h>
17#include <linux/debug_locks.h> 17#include <linux/debug_locks.h>
18#include <linux/backing-dev.h> 18#include <linux/backing-dev.h>
19#include <linux/mm_types.h>
19 20
20struct mempolicy; 21struct mempolicy;
21struct anon_vma; 22struct anon_vma;
@@ -215,62 +216,6 @@ struct vm_operations_struct {
215struct mmu_gather; 216struct mmu_gather;
216struct inode; 217struct inode;
217 218
218/*
219 * Each physical page in the system has a struct page associated with
220 * it to keep track of whatever it is we are using the page for at the
221 * moment. Note that we have no way to track which tasks are using
222 * a page, though if it is a pagecache page, rmap structures can tell us
223 * who is mapping it.
224 */
225struct page {
226 unsigned long flags; /* Atomic flags, some possibly
227 * updated asynchronously */
228 atomic_t _count; /* Usage count, see below. */
229 atomic_t _mapcount; /* Count of ptes mapped in mms,
230 * to show when page is mapped
231 * & limit reverse map searches.
232 */
233 union {
234 struct {
235 unsigned long private; /* Mapping-private opaque data:
236 * usually used for buffer_heads
237 * if PagePrivate set; used for
238 * swp_entry_t if PageSwapCache;
239 * indicates order in the buddy
240 * system if PG_buddy is set.
241 */
242 struct address_space *mapping; /* If low bit clear, points to
243 * inode address_space, or NULL.
244 * If page mapped as anonymous
245 * memory, low bit is set, and
246 * it points to anon_vma object:
247 * see PAGE_MAPPING_ANON below.
248 */
249 };
250#if NR_CPUS >= CONFIG_SPLIT_PTLOCK_CPUS
251 spinlock_t ptl;
252#endif
253 };
254 pgoff_t index; /* Our offset within mapping. */
255 struct list_head lru; /* Pageout list, eg. active_list
256 * protected by zone->lru_lock !
257 */
258 /*
259 * On machines where all RAM is mapped into kernel address space,
260 * we can simply calculate the virtual address. On machines with
261 * highmem some memory is mapped into kernel virtual memory
262 * dynamically, so we need a place to store that address.
263 * Note that this field could be 16 bits on x86 ... ;)
264 *
265 * Architectures with slow multiplication can define
266 * WANT_PAGE_VIRTUAL in asm/page.h
267 */
268#if defined(WANT_PAGE_VIRTUAL)
269 void *virtual; /* Kernel virtual address (NULL if
270 not kmapped, ie. highmem) */
271#endif /* WANT_PAGE_VIRTUAL */
272};
273
274#define page_private(page) ((page)->private) 219#define page_private(page) ((page)->private)
275#define set_page_private(page, v) ((page)->private = (v)) 220#define set_page_private(page, v) ((page)->private = (v))
276 221
@@ -546,11 +491,6 @@ static inline void set_page_links(struct page *page, enum zone_type zone,
546 */ 491 */
547#include <linux/vmstat.h> 492#include <linux/vmstat.h>
548 493
549#ifndef CONFIG_DISCONTIGMEM
550/* The array of struct pages - for discontigmem use pgdat->lmem_map */
551extern struct page *mem_map;
552#endif
553
554static __always_inline void *lowmem_page_address(struct page *page) 494static __always_inline void *lowmem_page_address(struct page *page)
555{ 495{
556 return __va(page_to_pfn(page) << PAGE_SHIFT); 496 return __va(page_to_pfn(page) << PAGE_SHIFT);