Skip to content

Commit de03017

Browse files
committed
Merge branch 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull scheduler fixes from Ingo Molnar: "Misc scheduler fixes" * 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: sched/core: Reset task's lockless wake-queues on fork() sched/core: Fix unserialized r-m-w scribbling stuff sched/core: Check tgid in is_global_init() sched/fair: Fix multiplication overflow on 32-bit systems
2 parents 3ab6d1e + 093e584 commit de03017

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

include/linux/sched.h

+9-7
Original file line numberDiff line numberDiff line change
@@ -1455,14 +1455,15 @@ struct task_struct {
14551455
/* Used for emulating ABI behavior of previous Linux versions */
14561456
unsigned int personality;
14571457

1458-
unsigned in_execve:1; /* Tell the LSMs that the process is doing an
1459-
* execve */
1460-
unsigned in_iowait:1;
1461-
1462-
/* Revert to default priority/policy when forking */
1458+
/* scheduler bits, serialized by scheduler locks */
14631459
unsigned sched_reset_on_fork:1;
14641460
unsigned sched_contributes_to_load:1;
14651461
unsigned sched_migrated:1;
1462+
unsigned :0; /* force alignment to the next boundary */
1463+
1464+
/* unserialized, strictly 'current' */
1465+
unsigned in_execve:1; /* bit to tell LSMs we're in execve */
1466+
unsigned in_iowait:1;
14661467
#ifdef CONFIG_MEMCG
14671468
unsigned memcg_may_oom:1;
14681469
#endif
@@ -2002,7 +2003,8 @@ static inline int pid_alive(const struct task_struct *p)
20022003
}
20032004

20042005
/**
2005-
* is_global_init - check if a task structure is init
2006+
* is_global_init - check if a task structure is init. Since init
2007+
* is free to have sub-threads we need to check tgid.
20062008
* @tsk: Task structure to be checked.
20072009
*
20082010
* Check if a task structure is the first user space task the kernel created.
@@ -2011,7 +2013,7 @@ static inline int pid_alive(const struct task_struct *p)
20112013
*/
20122014
static inline int is_global_init(struct task_struct *tsk)
20132015
{
2014-
return tsk->pid == 1;
2016+
return task_tgid_nr(tsk) == 1;
20152017
}
20162018

20172019
extern struct pid *cad_pid;

kernel/fork.c

+1
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,7 @@ static struct task_struct *dup_task_struct(struct task_struct *orig)
380380
#endif
381381
tsk->splice_pipe = NULL;
382382
tsk->task_frag.page = NULL;
383+
tsk->wake_q.next = NULL;
383384

384385
account_kernel_stack(ti, 1);
385386

kernel/sched/fair.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -2689,7 +2689,7 @@ static inline int update_cfs_rq_load_avg(u64 now, struct cfs_rq *cfs_rq)
26892689
int decayed, removed = 0;
26902690

26912691
if (atomic_long_read(&cfs_rq->removed_load_avg)) {
2692-
long r = atomic_long_xchg(&cfs_rq->removed_load_avg, 0);
2692+
s64 r = atomic_long_xchg(&cfs_rq->removed_load_avg, 0);
26932693
sa->load_avg = max_t(long, sa->load_avg - r, 0);
26942694
sa->load_sum = max_t(s64, sa->load_sum - r * LOAD_AVG_MAX, 0);
26952695
removed = 1;

0 commit comments

Comments
 (0)