Skip to content

Commit 777feab

Browse files
committed
Merge tag 'sched_urgent_for_v5.15_rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull scheduler fixes from Borislav Petkov: - Tell the compiler to always inline is_percpu_thread() - Make sure tunable_scaling buffer is null-terminated after an update in sysfs - Fix LTP named regression due to cgroup list ordering * tag 'sched_urgent_for_v5.15_rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: sched: Always inline is_percpu_thread() sched/fair: Null terminate buffer when updating tunable_scaling sched/fair: Add ancestors of unthrottled undecayed cfs_rq
2 parents 3a399a2 + 83d40a6 commit 777feab

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

include/linux/sched.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1720,7 +1720,7 @@ extern struct pid *cad_pid;
17201720
#define tsk_used_math(p) ((p)->flags & PF_USED_MATH)
17211721
#define used_math() tsk_used_math(current)
17221722

1723-
static inline bool is_percpu_thread(void)
1723+
static __always_inline bool is_percpu_thread(void)
17241724
{
17251725
#ifdef CONFIG_SMP
17261726
return (current->flags & PF_NO_SETAFFINITY) &&

kernel/sched/debug.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,16 +173,22 @@ static ssize_t sched_scaling_write(struct file *filp, const char __user *ubuf,
173173
size_t cnt, loff_t *ppos)
174174
{
175175
char buf[16];
176+
unsigned int scaling;
176177

177178
if (cnt > 15)
178179
cnt = 15;
179180

180181
if (copy_from_user(&buf, ubuf, cnt))
181182
return -EFAULT;
183+
buf[cnt] = '\0';
182184

183-
if (kstrtouint(buf, 10, &sysctl_sched_tunable_scaling))
185+
if (kstrtouint(buf, 10, &scaling))
184186
return -EINVAL;
185187

188+
if (scaling >= SCHED_TUNABLESCALING_END)
189+
return -EINVAL;
190+
191+
sysctl_sched_tunable_scaling = scaling;
186192
if (sched_update_scaling())
187193
return -EINVAL;
188194

kernel/sched/fair.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4936,8 +4936,12 @@ void unthrottle_cfs_rq(struct cfs_rq *cfs_rq)
49364936
/* update hierarchical throttle state */
49374937
walk_tg_tree_from(cfs_rq->tg, tg_nop, tg_unthrottle_up, (void *)rq);
49384938

4939-
if (!cfs_rq->load.weight)
4939+
/* Nothing to run but something to decay (on_list)? Complete the branch */
4940+
if (!cfs_rq->load.weight) {
4941+
if (cfs_rq->on_list)
4942+
goto unthrottle_throttle;
49404943
return;
4944+
}
49414945

49424946
task_delta = cfs_rq->h_nr_running;
49434947
idle_task_delta = cfs_rq->idle_h_nr_running;

0 commit comments

Comments
 (0)