kernel/sched/debug.c

Source file repositories/reference/linux-study-clean/kernel/sched/debug.c

File Facts

System
Linux kernel
Corpus path
kernel/sched/debug.c
Extension
.c
Size
36399 bytes
Lines
1462
Domain
Core OS
Bucket
Scheduler, Processes, Timers, Sync, And Syscalls
Inferred role
Core OS: operation-table or driver-model contract
Status
pattern implementation candidate

Why This File Exists

Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.

Dependency Surface

Detected Declarations

Annotated Snippet

static const struct file_operations sched_feat_fops = {
	.open		= sched_feat_open,
	.write		= sched_feat_write,
	.read		= seq_read,
	.llseek		= seq_lseek,
	.release	= single_release,
};

static ssize_t sched_scaling_write(struct file *filp, const char __user *ubuf,
				   size_t cnt, loff_t *ppos)
{
	unsigned int scaling;
	int ret;

	ret = kstrtouint_from_user(ubuf, cnt, 10, &scaling);
	if (ret)
		return ret;

	if (scaling >= SCHED_TUNABLESCALING_END)
		return -EINVAL;

	sysctl_sched_tunable_scaling = scaling;
	if (sched_update_scaling())
		return -EINVAL;

	*ppos += cnt;
	return cnt;
}

static int sched_scaling_show(struct seq_file *m, void *v)
{
	seq_printf(m, "%d\n", sysctl_sched_tunable_scaling);
	return 0;
}

static int sched_scaling_open(struct inode *inode, struct file *filp)
{
	return single_open(filp, sched_scaling_show, NULL);
}

static const struct file_operations sched_scaling_fops = {
	.open		= sched_scaling_open,
	.write		= sched_scaling_write,
	.read		= seq_read,
	.llseek		= seq_lseek,
	.release	= single_release,
};

#ifdef CONFIG_SCHED_CACHE
static ssize_t
sched_cache_enable_write(struct file *filp, const char __user *ubuf,
			 size_t cnt, loff_t *ppos)
{
	bool val;
	int ret;

	ret = kstrtobool_from_user(ubuf, cnt, &val);
	if (ret)
		return ret;

	sysctl_sched_cache_user = val;

	sched_cache_active_set();

	*ppos += cnt;

	return cnt;
}

static int sched_cache_enable_show(struct seq_file *m, void *v)
{
	seq_printf(m, "%d\n", sysctl_sched_cache_user);
	return 0;
}

static int sched_cache_enable_open(struct inode *inode,
				   struct file *filp)
{
	return single_open(filp, sched_cache_enable_show, NULL);
}

static const struct file_operations sched_cache_enable_fops = {
	.open           = sched_cache_enable_open,
	.write          = sched_cache_enable_write,
	.read           = seq_read,
	.llseek         = seq_lseek,
	.release        = single_release,
};
#endif

Annotation

Implementation Notes