aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/slub_def.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/slub_def.h')
-rw-r--r--include/linux/slub_def.h30
1 files changed, 19 insertions, 11 deletions
diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h
index 0249d4175ba..9f63538928c 100644
--- a/include/linux/slub_def.h
+++ b/include/linux/slub_def.h
@@ -10,9 +10,10 @@
10#include <linux/gfp.h> 10#include <linux/gfp.h>
11#include <linux/workqueue.h> 11#include <linux/workqueue.h>
12#include <linux/kobject.h> 12#include <linux/kobject.h>
13#include <linux/kmemtrace.h>
14#include <linux/kmemleak.h> 13#include <linux/kmemleak.h>
15 14
15#include <trace/events/kmem.h>
16
16enum stat_item { 17enum stat_item {
17 ALLOC_FASTPATH, /* Allocation from cpu slab */ 18 ALLOC_FASTPATH, /* Allocation from cpu slab */
18 ALLOC_SLOWPATH, /* Allocation by getting a new cpu slab */ 19 ALLOC_SLOWPATH, /* Allocation by getting a new cpu slab */
@@ -67,7 +68,7 @@ struct kmem_cache_order_objects {
67 * Slab cache management. 68 * Slab cache management.
68 */ 69 */
69struct kmem_cache { 70struct kmem_cache {
70 struct kmem_cache_cpu *cpu_slab; 71 struct kmem_cache_cpu __percpu *cpu_slab;
71 /* Used for retriving partial slabs etc */ 72 /* Used for retriving partial slabs etc */
72 unsigned long flags; 73 unsigned long flags;
73 int size; /* The size of an object including meta data */ 74 int size; /* The size of an object including meta data */
@@ -75,12 +76,6 @@ struct kmem_cache {
75 int offset; /* Free pointer offset. */ 76 int offset; /* Free pointer offset. */
76 struct kmem_cache_order_objects oo; 77 struct kmem_cache_order_objects oo;
77 78
78 /*
79 * Avoid an extra cache line for UP, SMP and for the node local to
80 * struct kmem_cache.
81 */
82 struct kmem_cache_node local_node;
83
84 /* Allocation and freeing of slabs */ 79 /* Allocation and freeing of slabs */
85 struct kmem_cache_order_objects max; 80 struct kmem_cache_order_objects max;
86 struct kmem_cache_order_objects min; 81 struct kmem_cache_order_objects min;
@@ -102,20 +97,33 @@ struct kmem_cache {
102 */ 97 */
103 int remote_node_defrag_ratio; 98 int remote_node_defrag_ratio;
104 struct kmem_cache_node *node[MAX_NUMNODES]; 99 struct kmem_cache_node *node[MAX_NUMNODES];
100#else
101 /* Avoid an extra cache line for UP */
102 struct kmem_cache_node local_node;
105#endif 103#endif
106}; 104};
107 105
108/* 106/*
109 * Kmalloc subsystem. 107 * Kmalloc subsystem.
110 */ 108 */
111#if defined(ARCH_KMALLOC_MINALIGN) && ARCH_KMALLOC_MINALIGN > 8 109#if defined(ARCH_DMA_MINALIGN) && ARCH_DMA_MINALIGN > 8
112#define KMALLOC_MIN_SIZE ARCH_KMALLOC_MINALIGN 110#define KMALLOC_MIN_SIZE ARCH_DMA_MINALIGN
113#else 111#else
114#define KMALLOC_MIN_SIZE 8 112#define KMALLOC_MIN_SIZE 8
115#endif 113#endif
116 114
117#define KMALLOC_SHIFT_LOW ilog2(KMALLOC_MIN_SIZE) 115#define KMALLOC_SHIFT_LOW ilog2(KMALLOC_MIN_SIZE)
118 116
117#ifdef ARCH_DMA_MINALIGN
118#define ARCH_KMALLOC_MINALIGN ARCH_DMA_MINALIGN
119#else
120#define ARCH_KMALLOC_MINALIGN __alignof__(unsigned long long)
121#endif
122
123#ifndef ARCH_SLAB_MINALIGN
124#define ARCH_SLAB_MINALIGN __alignof__(unsigned long long)
125#endif
126
119/* 127/*
120 * Maximum kmalloc object size handled by SLUB. Larger object allocations 128 * Maximum kmalloc object size handled by SLUB. Larger object allocations
121 * are passed through to the page allocator. The page allocator "fastpath" 129 * are passed through to the page allocator. The page allocator "fastpath"
@@ -132,7 +140,7 @@ struct kmem_cache {
132#ifdef CONFIG_ZONE_DMA 140#ifdef CONFIG_ZONE_DMA
133#define SLUB_DMA __GFP_DMA 141#define SLUB_DMA __GFP_DMA
134/* Reserve extra caches for potential DMA use */ 142/* Reserve extra caches for potential DMA use */
135#define KMALLOC_CACHES (2 * SLUB_PAGE_SHIFT - 6) 143#define KMALLOC_CACHES (2 * SLUB_PAGE_SHIFT)
136#else 144#else
137/* Disable DMA functionality */ 145/* Disable DMA functionality */
138#define SLUB_DMA (__force gfp_t)0 146#define SLUB_DMA (__force gfp_t)0