Rev 5270 | Rev 6936 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5270 | Rev 6082 | ||
---|---|---|---|
Line 16... | Line 16... | ||
16 | #include |
16 | #include |
Line 17... | Line 17... | ||
17 | 17 | ||
18 | 18 | ||
19 | /* |
19 | /* |
20 | * Flags to pass to kmem_cache_create(). |
20 | * Flags to pass to kmem_cache_create(). |
21 | * The ones marked DEBUG are only valid if CONFIG_SLAB_DEBUG is set. |
21 | * The ones marked DEBUG are only valid if CONFIG_DEBUG_SLAB is set. |
22 | */ |
22 | */ |
23 | #define SLAB_DEBUG_FREE 0x00000100UL /* DEBUG: Perform (expensive) checks on free */ |
23 | #define SLAB_DEBUG_FREE 0x00000100UL /* DEBUG: Perform (expensive) checks on free */ |
24 | #define SLAB_RED_ZONE 0x00000400UL /* DEBUG: Red zone objs in a cache */ |
24 | #define SLAB_RED_ZONE 0x00000400UL /* DEBUG: Red zone objs in a cache */ |
Line 102... | Line 102... | ||
102 | 102 | ||
103 | #define ZERO_OR_NULL_PTR(x) ((unsigned long)(x) <= \ |
103 | #define ZERO_OR_NULL_PTR(x) ((unsigned long)(x) <= \ |
Line 104... | Line 104... | ||
104 | (unsigned long)ZERO_SIZE_PTR) |
104 | (unsigned long)ZERO_SIZE_PTR) |
105 | 105 | ||
- | 106 | void __init kmem_cache_init(void); |
|
- | 107 | bool slab_is_available(void); |
|
- | 108 | ||
- | 109 | struct kmem_cache *kmem_cache_create(const char *, size_t, size_t, |
|
106 | void __init kmem_cache_init(void); |
110 | unsigned long, |
107 | int slab_is_available(void); |
111 | void (*)(void *)); |
108 | void kmem_cache_destroy(struct kmem_cache *); |
112 | void kmem_cache_destroy(struct kmem_cache *); |
Line 109... | Line 113... | ||
109 | int kmem_cache_shrink(struct kmem_cache *); |
113 | int kmem_cache_shrink(struct kmem_cache *); |
Line 118... | Line 122... | ||
118 | { |
122 | { |
119 | __builtin_free(p); |
123 | __builtin_free(p); |
120 | } |
124 | } |
121 | static __always_inline void *kmalloc(size_t size, gfp_t flags) |
125 | static __always_inline void *kmalloc(size_t size, gfp_t flags) |
122 | { |
126 | { |
123 | return __builtin_malloc(size); |
127 | void *ret = __builtin_malloc(size); |
- | 128 | memset(ret, 0, size); |
|
- | 129 | return ret; |
|
124 | } |
130 | } |
Line 125... | Line 131... | ||
125 | 131 | ||
126 | /** |
132 | /** |
127 | * kzalloc - allocate memory. The memory is set to zero. |
133 | * kzalloc - allocate memory. The memory is set to zero. |