blob: e30687bad07590c11acf6c43debb041d5db89316 [file] [log] [blame]
Heiko Carstens5b99cd02006-09-27 01:50:01 -07001#ifndef _LINUX_MM_TYPES_H
2#define _LINUX_MM_TYPES_H
3
4#include <linux/types.h>
5#include <linux/threads.h>
6#include <linux/list.h>
7#include <linux/spinlock.h>
8
9struct address_space;
10
11/*
12 * Each physical page in the system has a struct page associated with
13 * it to keep track of whatever it is we are using the page for at the
14 * moment. Note that we have no way to track which tasks are using
15 * a page, though if it is a pagecache page, rmap structures can tell us
16 * who is mapping it.
17 */
18struct page {
19 unsigned long flags; /* Atomic flags, some possibly
20 * updated asynchronously */
21 atomic_t _count; /* Usage count, see below. */
Christoph Lameter81819f02007-05-06 14:49:36 -070022 union {
23 atomic_t _mapcount; /* Count of ptes mapped in mms,
Heiko Carstens5b99cd02006-09-27 01:50:01 -070024 * to show when page is mapped
25 * & limit reverse map searches.
26 */
Christoph Lameter81819f02007-05-06 14:49:36 -070027 struct { /* SLUB uses */
28 short unsigned int inuse;
29 short unsigned int offset;
30 };
31 };
Heiko Carstens5b99cd02006-09-27 01:50:01 -070032 union {
33 struct {
34 unsigned long private; /* Mapping-private opaque data:
35 * usually used for buffer_heads
36 * if PagePrivate set; used for
37 * swp_entry_t if PageSwapCache;
38 * indicates order in the buddy
39 * system if PG_buddy is set.
40 */
41 struct address_space *mapping; /* If low bit clear, points to
42 * inode address_space, or NULL.
43 * If page mapped as anonymous
44 * memory, low bit is set, and
45 * it points to anon_vma object:
46 * see PAGE_MAPPING_ANON below.
47 */
48 };
49#if NR_CPUS >= CONFIG_SPLIT_PTLOCK_CPUS
50 spinlock_t ptl;
51#endif
Christoph Lameter81819f02007-05-06 14:49:36 -070052 struct { /* SLUB uses */
53 struct page *first_page; /* Compound pages */
54 struct kmem_cache *slab; /* Pointer to slab */
55 };
Heiko Carstens5b99cd02006-09-27 01:50:01 -070056 };
Christoph Lameter81819f02007-05-06 14:49:36 -070057 union {
58 pgoff_t index; /* Our offset within mapping. */
59 void *freelist; /* SLUB: pointer to free object */
60 };
Heiko Carstens5b99cd02006-09-27 01:50:01 -070061 struct list_head lru; /* Pageout list, eg. active_list
62 * protected by zone->lru_lock !
63 */
64 /*
65 * On machines where all RAM is mapped into kernel address space,
66 * we can simply calculate the virtual address. On machines with
67 * highmem some memory is mapped into kernel virtual memory
68 * dynamically, so we need a place to store that address.
69 * Note that this field could be 16 bits on x86 ... ;)
70 *
71 * Architectures with slow multiplication can define
72 * WANT_PAGE_VIRTUAL in asm/page.h
73 */
74#if defined(WANT_PAGE_VIRTUAL)
75 void *virtual; /* Kernel virtual address (NULL if
76 not kmapped, ie. highmem) */
77#endif /* WANT_PAGE_VIRTUAL */
78};
79
80#endif /* _LINUX_MM_TYPES_H */