aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Lameter <cl@linux.com>2014-04-07 15:39:42 -0700
committerMoyster <oysterized@gmail.com>2016-09-28 15:14:07 +0200
commitb74a1f640dc915f9297e10e50bbd378751eda056 (patch)
tree02b35ceefe261890191098af3d8155c1b446477a
parentf0eaf96c524b819915997d6fafb9976183251fa4 (diff)
slub: use raw_cpu_inc for incrementing statistics
Statistics are not critical to the operation of the allocation but should also not cause too much overhead. When __this_cpu_inc is altered to check if preemption is disabled this triggers. Use raw_cpu_inc to avoid the checks. Using this_cpu_ops may cause interrupt disable/enable sequences on various arches which may significantly impact allocator performance. [akpm@linux-foundation.org: add comment] Signed-off-by: Christoph Lameter <cl@linux.com> Cc: Fengguang Wu <fengguang.wu@intel.com> Cc: Pekka Enberg <penberg@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: W4TCH0UT <ateekujjawal@gmail.com>
-rw-r--r--mm/slub.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/mm/slub.c b/mm/slub.c
index 43b5370df..1e5c22fe0 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -260,7 +260,11 @@ static inline void memcg_propagate_slab_attrs(struct kmem_cache *s) { }
static inline void stat(const struct kmem_cache *s, enum stat_item si)
{
#ifdef CONFIG_SLUB_STATS
- __this_cpu_inc(s->cpu_slab->stat[si]);
+ /*
+ * The rmw is racy on a preemptible kernel but this is acceptable, so
+ * avoid this_cpu_add()'s irq-disable overhead.
+ */
+ raw_cpu_inc(s->cpu_slab->stat[si]);
#endif
}