summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds2017-07-06 17:59:41 +0200
committerLinus Torvalds2017-07-06 17:59:41 +0200
commita4c20b9a574b9720acf6c647eaff5e7e1e688086 (patch)
treed25c1d51c6f55de593028fde1276ea9976214014 /include
parentMerge branch 'parisc-4.13-2' of git://git.kernel.org/pub/scm/linux/kernel/git... (diff)
parentpercpu: fix static checker warnings in pcpu_destroy_chunk (diff)
downloadkernel-qcow2-linux-a4c20b9a574b9720acf6c647eaff5e7e1e688086.tar.gz
kernel-qcow2-linux-a4c20b9a574b9720acf6c647eaff5e7e1e688086.tar.xz
kernel-qcow2-linux-a4c20b9a574b9720acf6c647eaff5e7e1e688086.zip
Merge branch 'for-4.13' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/percpu
Pull percpu updates from Tejun Heo: "These are the percpu changes for the v4.13-rc1 merge window. There are a couple visibility related changes - tracepoints and allocator stats through debugfs, along with __ro_after_init markings and a cosmetic rename in percpu_counter. Please note that the simple O(#elements_in_the_chunk) area allocator used by percpu allocator is again showing scalability issues, primarily with bpf allocating and freeing large number of counters. Dennis is working on the replacement allocator and the percpu allocator will be seeing increased churns in the coming cycles" * 'for-4.13' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/percpu: percpu: fix static checker warnings in pcpu_destroy_chunk percpu: fix early calls for spinlock in pcpu_stats percpu: resolve err may not be initialized in pcpu_alloc percpu_counter: Rename __percpu_counter_add to percpu_counter_add_batch percpu: add tracepoint support for percpu memory percpu: expose statistics about percpu memory via debugfs percpu: migrate percpu data structures to internal header percpu: add missing lockdep_assert_held to func pcpu_free_area mark most percpu globals as __ro_after_init
Diffstat (limited to 'include')
-rw-r--r--include/linux/backing-dev.h2
-rw-r--r--include/linux/blk-cgroup.h6
-rw-r--r--include/linux/mman.h2
-rw-r--r--include/linux/percpu_counter.h7
-rw-r--r--include/net/inet_frag.h4
-rw-r--r--include/trace/events/percpu.h125
6 files changed, 136 insertions, 10 deletions
diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h
index 557d84063934..ace73f96eb1e 100644
--- a/include/linux/backing-dev.h
+++ b/include/linux/backing-dev.h
@@ -66,7 +66,7 @@ static inline bool bdi_has_dirty_io(struct backing_dev_info *bdi)
static inline void __add_wb_stat(struct bdi_writeback *wb,
enum wb_stat_item item, s64 amount)
{
- __percpu_counter_add(&wb->stat[item], amount, WB_STAT_BATCH);
+ percpu_counter_add_batch(&wb->stat[item], amount, WB_STAT_BATCH);
}
static inline void __inc_wb_stat(struct bdi_writeback *wb,
diff --git a/include/linux/blk-cgroup.h b/include/linux/blk-cgroup.h
index 01b62e7bac74..7104bea8dab1 100644
--- a/include/linux/blk-cgroup.h
+++ b/include/linux/blk-cgroup.h
@@ -518,7 +518,7 @@ static inline void blkg_stat_exit(struct blkg_stat *stat)
*/
static inline void blkg_stat_add(struct blkg_stat *stat, uint64_t val)
{
- __percpu_counter_add(&stat->cpu_cnt, val, BLKG_STAT_CPU_BATCH);
+ percpu_counter_add_batch(&stat->cpu_cnt, val, BLKG_STAT_CPU_BATCH);
}
/**
@@ -597,14 +597,14 @@ static inline void blkg_rwstat_add(struct blkg_rwstat *rwstat,
else
cnt = &rwstat->cpu_cnt[BLKG_RWSTAT_READ];
- __percpu_counter_add(cnt, val, BLKG_STAT_CPU_BATCH);
+ percpu_counter_add_batch(cnt, val, BLKG_STAT_CPU_BATCH);
if (op_is_sync(op))
cnt = &rwstat->cpu_cnt[BLKG_RWSTAT_SYNC];
else
cnt = &rwstat->cpu_cnt[BLKG_RWSTAT_ASYNC];
- __percpu_counter_add(cnt, val, BLKG_STAT_CPU_BATCH);
+ percpu_counter_add_batch(cnt, val, BLKG_STAT_CPU_BATCH);
}
/**
diff --git a/include/linux/mman.h b/include/linux/mman.h
index 634c4c51fe3a..c8367041fafd 100644
--- a/include/linux/mman.h
+++ b/include/linux/mman.h
@@ -22,7 +22,7 @@ unsigned long vm_memory_committed(void);
static inline void vm_acct_memory(long pages)
{
- __percpu_counter_add(&vm_committed_as, pages, vm_committed_as_batch);
+ percpu_counter_add_batch(&vm_committed_as, pages, vm_committed_as_batch);
}
static inline void vm_unacct_memory(long pages)
diff --git a/include/linux/percpu_counter.h b/include/linux/percpu_counter.h
index 84a109449610..ec065387f443 100644
--- a/include/linux/percpu_counter.h
+++ b/include/linux/percpu_counter.h
@@ -39,7 +39,8 @@ int __percpu_counter_init(struct percpu_counter *fbc, s64 amount, gfp_t gfp,
void percpu_counter_destroy(struct percpu_counter *fbc);
void percpu_counter_set(struct percpu_counter *fbc, s64 amount);
-void __percpu_counter_add(struct percpu_counter *fbc, s64 amount, s32 batch);
+void percpu_counter_add_batch(struct percpu_counter *fbc, s64 amount,
+ s32 batch);
s64 __percpu_counter_sum(struct percpu_counter *fbc);
int __percpu_counter_compare(struct percpu_counter *fbc, s64 rhs, s32 batch);
@@ -50,7 +51,7 @@ static inline int percpu_counter_compare(struct percpu_counter *fbc, s64 rhs)
static inline void percpu_counter_add(struct percpu_counter *fbc, s64 amount)
{
- __percpu_counter_add(fbc, amount, percpu_counter_batch);
+ percpu_counter_add_batch(fbc, amount, percpu_counter_batch);
}
static inline s64 percpu_counter_sum_positive(struct percpu_counter *fbc)
@@ -136,7 +137,7 @@ percpu_counter_add(struct percpu_counter *fbc, s64 amount)
}
static inline void
-__percpu_counter_add(struct percpu_counter *fbc, s64 amount, s32 batch)
+percpu_counter_add_batch(struct percpu_counter *fbc, s64 amount, s32 batch)
{
percpu_counter_add(fbc, amount);
}
diff --git a/include/net/inet_frag.h b/include/net/inet_frag.h
index 440c1e9d0623..6fdcd2427776 100644
--- a/include/net/inet_frag.h
+++ b/include/net/inet_frag.h
@@ -154,12 +154,12 @@ static inline int frag_mem_limit(struct netns_frags *nf)
static inline void sub_frag_mem_limit(struct netns_frags *nf, int i)
{
- __percpu_counter_add(&nf->mem, -i, frag_percpu_counter_batch);
+ percpu_counter_add_batch(&nf->mem, -i, frag_percpu_counter_batch);
}
static inline void add_frag_mem_limit(struct netns_frags *nf, int i)
{
- __percpu_counter_add(&nf->mem, i, frag_percpu_counter_batch);
+ percpu_counter_add_batch(&nf->mem, i, frag_percpu_counter_batch);
}
static inline unsigned int sum_frag_mem_limit(struct netns_frags *nf)
diff --git a/include/trace/events/percpu.h b/include/trace/events/percpu.h
new file mode 100644
index 000000000000..ad34b1bae047
--- /dev/null
+++ b/include/trace/events/percpu.h
@@ -0,0 +1,125 @@
+#undef TRACE_SYSTEM
+#define TRACE_SYSTEM percpu
+
+#if !defined(_TRACE_PERCPU_H) || defined(TRACE_HEADER_MULTI_READ)
+#define _TRACE_PERCPU_H
+
+#include <linux/tracepoint.h>
+
+TRACE_EVENT(percpu_alloc_percpu,
+
+ TP_PROTO(bool reserved, bool is_atomic, size_t size,
+ size_t align, void *base_addr, int off, void __percpu *ptr),
+
+ TP_ARGS(reserved, is_atomic, size, align, base_addr, off, ptr),
+
+ TP_STRUCT__entry(
+ __field( bool, reserved )
+ __field( bool, is_atomic )
+ __field( size_t, size )
+ __field( size_t, align )
+ __field( void *, base_addr )
+ __field( int, off )
+ __field( void __percpu *, ptr )
+ ),
+
+ TP_fast_assign(
+ __entry->reserved = reserved;
+ __entry->is_atomic = is_atomic;
+ __entry->size = size;
+ __entry->align = align;
+ __entry->base_addr = base_addr;
+ __entry->off = off;
+ __entry->ptr = ptr;
+ ),
+
+ TP_printk("reserved=%d is_atomic=%d size=%zu align=%zu base_addr=%p off=%d ptr=%p",
+ __entry->reserved, __entry->is_atomic,
+ __entry->size, __entry->align,
+ __entry->base_addr, __entry->off, __entry->ptr)
+);
+
+TRACE_EVENT(percpu_free_percpu,
+
+ TP_PROTO(void *base_addr, int off, void __percpu *ptr),
+
+ TP_ARGS(base_addr, off, ptr),
+
+ TP_STRUCT__entry(
+ __field( void *, base_addr )
+ __field( int, off )
+ __field( void __percpu *, ptr )
+ ),
+
+ TP_fast_assign(
+ __entry->base_addr = base_addr;
+ __entry->off = off;
+ __entry->ptr = ptr;
+ ),
+
+ TP_printk("base_addr=%p off=%d ptr=%p",
+ __entry->base_addr, __entry->off, __entry->ptr)
+);
+
+TRACE_EVENT(percpu_alloc_percpu_fail,
+
+ TP_PROTO(bool reserved, bool is_atomic, size_t size, size_t align),
+
+ TP_ARGS(reserved, is_atomic, size, align),
+
+ TP_STRUCT__entry(
+ __field( bool, reserved )
+ __field( bool, is_atomic )
+ __field( size_t, size )
+ __field( size_t, align )
+ ),
+
+ TP_fast_assign(
+ __entry->reserved = reserved;
+ __entry->is_atomic = is_atomic;
+ __entry->size = size;
+ __entry->align = align;
+ ),
+
+ TP_printk("reserved=%d is_atomic=%d size=%zu align=%zu",
+ __entry->reserved, __entry->is_atomic,
+ __entry->size, __entry->align)
+);
+
+TRACE_EVENT(percpu_create_chunk,
+
+ TP_PROTO(void *base_addr),
+
+ TP_ARGS(base_addr),
+
+ TP_STRUCT__entry(
+ __field( void *, base_addr )
+ ),
+
+ TP_fast_assign(
+ __entry->base_addr = base_addr;
+ ),
+
+ TP_printk("base_addr=%p", __entry->base_addr)
+);
+
+TRACE_EVENT(percpu_destroy_chunk,
+
+ TP_PROTO(void *base_addr),
+
+ TP_ARGS(base_addr),
+
+ TP_STRUCT__entry(
+ __field( void *, base_addr )
+ ),
+
+ TP_fast_assign(
+ __entry->base_addr = base_addr;
+ ),
+
+ TP_printk("base_addr=%p", __entry->base_addr)
+);
+
+#endif /* _TRACE_PERCPU_H */
+
+#include <trace/define_trace.h>