Skip to content

Commit

Permalink
sched: Move /proc/sched_debug to debugfs
Browse files Browse the repository at this point in the history
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Tested-by: Valentin Schneider <valentin.schneider@arm.com>
Link: https://lkml.kernel.org/r/20210412102001.548833671@infradead.org
  • Loading branch information
Peter Zijlstra committed Apr 16, 2021
1 parent 3b87f13 commit d27e9ae
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions kernel/sched/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,20 @@ static const struct file_operations sched_dynamic_fops = {

__read_mostly bool sched_debug_enabled;

static const struct seq_operations sched_debug_sops;

static int sched_debug_open(struct inode *inode, struct file *filp)
{
return seq_open(filp, &sched_debug_sops);
}

static const struct file_operations sched_debug_fops = {
.open = sched_debug_open,
.read = seq_read,
.llseek = seq_lseek,
.release = seq_release,
};

static struct dentry *debugfs_sched;

static __init int sched_init_debug(void)
Expand Down Expand Up @@ -314,6 +328,8 @@ static __init int sched_init_debug(void)
debugfs_create_u32("scan_size_mb", 0644, numa, &sysctl_numa_balancing_scan_size);
#endif

debugfs_create_file("debug", 0444, debugfs_sched, NULL, &sched_debug_fops);

return 0;
}
late_initcall(sched_init_debug);
Expand Down Expand Up @@ -847,15 +863,6 @@ static const struct seq_operations sched_debug_sops = {
.show = sched_debug_show,
};

static int __init init_sched_debug_procfs(void)
{
if (!proc_create_seq("sched_debug", 0444, NULL, &sched_debug_sops))
return -ENOMEM;
return 0;
}

__initcall(init_sched_debug_procfs);

#define __PS(S, F) SEQ_printf(m, "%-45s:%21Ld\n", S, (long long)(F))
#define __P(F) __PS(#F, F)
#define P(F) __PS(#F, p->F)
Expand Down

0 comments on commit d27e9ae

Please sign in to comment.