diff options
author | Pekka Enberg <penberg@kernel.org> | 2013-11-11 11:09:00 -0500 |
---|---|---|
committer | Pekka Enberg <penberg@kernel.org> | 2013-11-11 11:09:00 -0500 |
commit | ea982d9ffdfaa22552e9b0b9be94f459afa36102 (patch) | |
tree | d3f3c3d9e43f4bc616b0c7156b54b3760b48f60e /include/linux | |
parent | d56791b38e34e480d869d1b88735df16c81aa684 (diff) | |
parent | 7e00735520ffb00bda3e08c441d0a4dba42913a7 (diff) |
Merge branch 'slab/struct-page' into slab/next
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/mm_types.h | 24 | ||||
-rw-r--r-- | include/linux/slab.h | 9 | ||||
-rw-r--r-- | include/linux/slab_def.h | 4 |
3 files changed, 26 insertions, 11 deletions
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index faf4b7c1ad12..95bf0c5a7eb9 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h | |||
@@ -42,18 +42,22 @@ struct page { | |||
42 | /* First double word block */ | 42 | /* First double word block */ |
43 | unsigned long flags; /* Atomic flags, some possibly | 43 | unsigned long flags; /* Atomic flags, some possibly |
44 | * updated asynchronously */ | 44 | * updated asynchronously */ |
45 | struct address_space *mapping; /* If low bit clear, points to | 45 | union { |
46 | * inode address_space, or NULL. | 46 | struct address_space *mapping; /* If low bit clear, points to |
47 | * If page mapped as anonymous | 47 | * inode address_space, or NULL. |
48 | * memory, low bit is set, and | 48 | * If page mapped as anonymous |
49 | * it points to anon_vma object: | 49 | * memory, low bit is set, and |
50 | * see PAGE_MAPPING_ANON below. | 50 | * it points to anon_vma object: |
51 | */ | 51 | * see PAGE_MAPPING_ANON below. |
52 | */ | ||
53 | void *s_mem; /* slab first object */ | ||
54 | }; | ||
55 | |||
52 | /* Second double word */ | 56 | /* Second double word */ |
53 | struct { | 57 | struct { |
54 | union { | 58 | union { |
55 | pgoff_t index; /* Our offset within mapping. */ | 59 | pgoff_t index; /* Our offset within mapping. */ |
56 | void *freelist; /* slub/slob first free object */ | 60 | void *freelist; /* sl[aou]b first free object */ |
57 | bool pfmemalloc; /* If set by the page allocator, | 61 | bool pfmemalloc; /* If set by the page allocator, |
58 | * ALLOC_NO_WATERMARKS was set | 62 | * ALLOC_NO_WATERMARKS was set |
59 | * and the low watermark was not | 63 | * and the low watermark was not |
@@ -109,6 +113,7 @@ struct page { | |||
109 | }; | 113 | }; |
110 | atomic_t _count; /* Usage count, see below. */ | 114 | atomic_t _count; /* Usage count, see below. */ |
111 | }; | 115 | }; |
116 | unsigned int active; /* SLAB */ | ||
112 | }; | 117 | }; |
113 | }; | 118 | }; |
114 | 119 | ||
@@ -130,6 +135,9 @@ struct page { | |||
130 | 135 | ||
131 | struct list_head list; /* slobs list of pages */ | 136 | struct list_head list; /* slobs list of pages */ |
132 | struct slab *slab_page; /* slab fields */ | 137 | struct slab *slab_page; /* slab fields */ |
138 | struct rcu_head rcu_head; /* Used by SLAB | ||
139 | * when destroying via RCU | ||
140 | */ | ||
133 | }; | 141 | }; |
134 | 142 | ||
135 | /* Remainder is not double word aligned */ | 143 | /* Remainder is not double word aligned */ |
diff --git a/include/linux/slab.h b/include/linux/slab.h index 6c5cc0ea8713..caaad51fee1f 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h | |||
@@ -51,7 +51,14 @@ | |||
51 | * } | 51 | * } |
52 | * rcu_read_unlock(); | 52 | * rcu_read_unlock(); |
53 | * | 53 | * |
54 | * See also the comment on struct slab_rcu in mm/slab.c. | 54 | * This is useful if we need to approach a kernel structure obliquely, |
55 | * from its address obtained without the usual locking. We can lock | ||
56 | * the structure to stabilize it and check it's still at the given address, | ||
57 | * only if we can be sure that the memory has not been meanwhile reused | ||
58 | * for some other kind of object (which our subsystem's lock might corrupt). | ||
59 | * | ||
60 | * rcu_read_lock before reading the address, then rcu_read_unlock after | ||
61 | * taking the spinlock within the structure expected at that address. | ||
55 | */ | 62 | */ |
56 | #define SLAB_DESTROY_BY_RCU 0x00080000UL /* Defer freeing slabs to RCU */ | 63 | #define SLAB_DESTROY_BY_RCU 0x00080000UL /* Defer freeing slabs to RCU */ |
57 | #define SLAB_MEM_SPREAD 0x00100000UL /* Spread some memory over cpuset */ | 64 | #define SLAB_MEM_SPREAD 0x00100000UL /* Spread some memory over cpuset */ |
diff --git a/include/linux/slab_def.h b/include/linux/slab_def.h index cd401580bdd3..ca82e8ff89fa 100644 --- a/include/linux/slab_def.h +++ b/include/linux/slab_def.h | |||
@@ -41,8 +41,8 @@ struct kmem_cache { | |||
41 | 41 | ||
42 | size_t colour; /* cache colouring range */ | 42 | size_t colour; /* cache colouring range */ |
43 | unsigned int colour_off; /* colour offset */ | 43 | unsigned int colour_off; /* colour offset */ |
44 | struct kmem_cache *slabp_cache; | 44 | struct kmem_cache *freelist_cache; |
45 | unsigned int slab_size; | 45 | unsigned int freelist_size; |
46 | 46 | ||
47 | /* constructor func */ | 47 | /* constructor func */ |
48 | void (*ctor)(void *obj); | 48 | void (*ctor)(void *obj); |