mmap_lock: add /proc/<pid>/mmap_lock_contention interface
Subsystems (2)
PATCH v2 5/7 mmap_lock: add /proc/<pid>/mmap_lock_contention interface
When this file is read, we print a human-readable listing of histogram buckets, as well as the number of samples recorded in each bucket.
Signed-off-by Axel Rasmussen <[email protected]>
--- fs/proc/base.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)
fs/proc/base.c +25 -0
@@ -96,6 +96,8 @@#include <linux/posix-timers.h> #include <linux/time_namespace.h> #include <linux/resctrl.h> +#include <linux/histogram.h> +#include <linux/mm_types.h> #include <trace/events/oom.h> #include "internal.h" #include "fd.h"
@@ -3115,6 +3117,26 @@ static int proc_stack_depth(struct seq_file *m, struct pid_namespace *ns, }#endif /* CONFIG_STACKLEAK_METRICS */ +#ifdef CONFIG_MMAP_LOCK_HISTOGRAMS +static int proc_pid_mmap_lock_contention_show (struct seq_file *m, +struct pid_namespace *ns, +struct pid *pid, +struct task_struct *task) +{ +int rc; + +if (unlikely (!task->mm->mmap_lock_contention)) +return 0 ; + + rc =histogram_print_buckets_rcu ( + task->mm->mmap_lock_contention, + m->buf + m->count, m->size - m->count); +if (rc >0 ) + m->count += rc; +return 0 ; +} +#endif /* CONFIG_MMAP_LOCK_HISTOGRAMS */ +/* * Thread groups */
@@ -3228,6 +3250,9 @@ static const struct pid_entry tgid_base_stuff[] = {#ifdef CONFIG_PROC_PID_ARCH_STATUS ONE("arch_status", S_IRUGO, proc_pid_arch_status),#endif +#ifdef CONFIG_MMAP_LOCK_HISTOGRAMS + ONE("mmap_lock_contention", S_IRUGO, proc_pid_mmap_lock_contention_show), +#endif };static int proc_tgid_base_readdir (struct file *file,struct dir_context *ctx)
Signature · 1 line
2.27.0.rc0.183.gde8f92d652-goog