sched/debug: Collapse subsequent CONFIG_SCHED_CLASS_EXT sections

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://patch.msgid.link/20260511120627.281160085@infradead.org
This commit is contained in:
Peter Zijlstra 2026-05-11 13:31:07 +02:00
parent 7755700223
commit e05777c44e

View File

@ -488,6 +488,8 @@ static const struct file_operations fair_server_runtime_fops = {
.release = single_release,
};
static struct dentry *debugfs_sched;
#ifdef CONFIG_SCHED_CLASS_EXT
static ssize_t
sched_ext_server_runtime_write(struct file *filp, const char __user *ubuf,
@ -520,6 +522,59 @@ static const struct file_operations ext_server_runtime_fops = {
.llseek = seq_lseek,
.release = single_release,
};
static ssize_t
sched_ext_server_period_write(struct file *filp, const char __user *ubuf,
size_t cnt, loff_t *ppos)
{
long cpu = (long) ((struct seq_file *) filp->private_data)->private;
struct rq *rq = cpu_rq(cpu);
return sched_server_write_common(filp, ubuf, cnt, ppos, DL_PERIOD,
&rq->ext_server);
}
static int sched_ext_server_period_show(struct seq_file *m, void *v)
{
unsigned long cpu = (unsigned long) m->private;
struct rq *rq = cpu_rq(cpu);
return sched_server_show_common(m, v, DL_PERIOD, &rq->ext_server);
}
static int sched_ext_server_period_open(struct inode *inode, struct file *filp)
{
return single_open(filp, sched_ext_server_period_show, inode->i_private);
}
static const struct file_operations ext_server_period_fops = {
.open = sched_ext_server_period_open,
.write = sched_ext_server_period_write,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
static void debugfs_ext_server_init(void)
{
struct dentry *d_ext;
unsigned long cpu;
d_ext = debugfs_create_dir("ext_server", debugfs_sched);
if (!d_ext)
return;
for_each_possible_cpu(cpu) {
struct dentry *d_cpu;
char buf[32];
snprintf(buf, sizeof(buf), "cpu%lu", cpu);
d_cpu = debugfs_create_dir(buf, d_ext);
debugfs_create_file("runtime", 0644, d_cpu, (void *) cpu, &ext_server_runtime_fops);
debugfs_create_file("period", 0644, d_cpu, (void *) cpu, &ext_server_period_fops);
}
}
#endif /* CONFIG_SCHED_CLASS_EXT */
static ssize_t
@ -554,42 +609,6 @@ static const struct file_operations fair_server_period_fops = {
.release = single_release,
};
#ifdef CONFIG_SCHED_CLASS_EXT
static ssize_t
sched_ext_server_period_write(struct file *filp, const char __user *ubuf,
size_t cnt, loff_t *ppos)
{
long cpu = (long) ((struct seq_file *) filp->private_data)->private;
struct rq *rq = cpu_rq(cpu);
return sched_server_write_common(filp, ubuf, cnt, ppos, DL_PERIOD,
&rq->ext_server);
}
static int sched_ext_server_period_show(struct seq_file *m, void *v)
{
unsigned long cpu = (unsigned long) m->private;
struct rq *rq = cpu_rq(cpu);
return sched_server_show_common(m, v, DL_PERIOD, &rq->ext_server);
}
static int sched_ext_server_period_open(struct inode *inode, struct file *filp)
{
return single_open(filp, sched_ext_server_period_show, inode->i_private);
}
static const struct file_operations ext_server_period_fops = {
.open = sched_ext_server_period_open,
.write = sched_ext_server_period_write,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
#endif /* CONFIG_SCHED_CLASS_EXT */
static struct dentry *debugfs_sched;
static void debugfs_fair_server_init(void)
{
struct dentry *d_fair;
@ -611,29 +630,6 @@ static void debugfs_fair_server_init(void)
}
}
#ifdef CONFIG_SCHED_CLASS_EXT
static void debugfs_ext_server_init(void)
{
struct dentry *d_ext;
unsigned long cpu;
d_ext = debugfs_create_dir("ext_server", debugfs_sched);
if (!d_ext)
return;
for_each_possible_cpu(cpu) {
struct dentry *d_cpu;
char buf[32];
snprintf(buf, sizeof(buf), "cpu%lu", cpu);
d_cpu = debugfs_create_dir(buf, d_ext);
debugfs_create_file("runtime", 0644, d_cpu, (void *) cpu, &ext_server_runtime_fops);
debugfs_create_file("period", 0644, d_cpu, (void *) cpu, &ext_server_period_fops);
}
}
#endif /* CONFIG_SCHED_CLASS_EXT */
static __init int sched_init_debug(void)
{
struct dentry __maybe_unused *numa, *llc;