diff --git a/fs/proc/base.c b/fs/proc/base.c index a0c4fd012520a1f37e1d059b082d099bdebc728d..4ce5bcf38e42bea636b30eda3da41f66f097428f 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c @@ -54,6 +54,11 @@ #include #include #include + +#ifdef CONFIG_QOS_CTRL +#include +#endif + #include #include #include @@ -1488,6 +1493,34 @@ static const struct file_operations proc_pid_sched_operations = { #endif +#ifdef CONFIG_QOS_CTRL +long proc_qos_ctrl_ioctl(struct file *file, unsigned int cmd, unsigned long arg) +{ + return do_qos_ctrl_ioctl(QOS_IOCTL_ABI_AARCH64, file, cmd, arg); +} + +#ifdef CONFIG_COMPAT +long proc_qos_ctrl_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) +{ + return do_qos_ctrl_ioctl(QOS_IOCTL_ABI_ARM32, file, cmd, + (unsigned long)(compat_ptr((compat_uptr_t)arg))); +} +#endif + +int proc_qos_ctrl_open(struct inode *inode, struct file *filp) +{ + return 0; +} + +static const struct file_operations proc_qos_ctrl_operations = { + .open = proc_qos_ctrl_open, + .unlocked_ioctl = proc_qos_ctrl_ioctl, +#ifdef CONFIG_COMPAT + .compat_ioctl = proc_qos_ctrl_compat_ioctl, +#endif +}; +#endif + #ifdef CONFIG_SCHED_RTG static const struct file_operations proc_rtg_operations = { .open = proc_rtg_open, @@ -3850,6 +3883,9 @@ static const struct pid_entry tid_base_stuff[] = { #ifdef CONFIG_ACCESS_TOKENID ONE("tokenid", S_IRUSR, proc_token_operations), #endif +#ifdef CONFIG_QOS_CTRL + REG("sched_qos_ctrl", S_IRUGO|S_IWUGO, proc_qos_ctrl_operations), +#endif #ifdef CONFIG_SCHED_RTG_DEBUG REG("sched_group_id", S_IRUGO|S_IWUGO, proc_pid_sched_group_id_operations), #endif diff --git a/kernel/exit.c b/kernel/exit.c index fca644befda446cb015c1a5bf64081629988ae1e..0dd3c80e5e4b86566352e5bafc802163f25db0dc 100644 --- a/kernel/exit.c +++ b/kernel/exit.c @@ -13,6 +13,11 @@ #include #include #include + +#ifdef CONFIG_QOS_CTRL +#include +#endif + #include #include #include @@ -832,6 +837,10 @@ void __noreturn do_exit(long code) exit_signals(tsk); /* sets PF_EXITING */ sched_exit(tsk); +#ifdef CONFIG_QOS_CTRL + sched_exit_qos_list(tsk); +#endif + /* sync mm's RSS info before statistics gathering */ if (tsk->mm) sync_mm_rss(tsk->mm); diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 84654c67d6945b1117c3bf1c9de0393b7930af89..1cd69897346a866d750f663606f04016d0223cc1 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -66,7 +66,9 @@ #include #include #include - +#ifdef CONFIG_QOS_CTRL +#include +#endif #ifdef CONFIG_PREEMPT_DYNAMIC # ifdef CONFIG_GENERIC_ENTRY # include @@ -4874,6 +4876,11 @@ late_initcall(sched_core_sysctl_init); int sched_fork(unsigned long clone_flags, struct task_struct *p) { init_new_task_load(p); + +#ifdef CONFIG_QOS_CTRL + init_task_qos(p); +#endif + __sched_fork(clone_flags, p); /* * We mark the process as NEW here. This guarantees that