diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-01-08 16:57:13 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-01-08 16:57:13 -0500 |
commit | de030179584833ddac77ab847d7083199e30a877 (patch) | |
tree | a5af7855370d86e6d0dba071a5b08e66839788a4 | |
parent | 3ab6d1ebd54bc377e9cd6c1792aaffa0a1fd11f8 (diff) | |
parent | 093e5840ae76f1082633503964d035f40ed0216d (diff) |
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
-rw-r--r-- | include/linux/sched.h | 16 | ||||
-rw-r--r-- | kernel/fork.c | 1 | ||||
-rw-r--r-- | kernel/sched/fair.c | 2 |
3 files changed, 11 insertions, 8 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h index edad7a43edea..fa39434e3fdd 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -1455,14 +1455,15 @@ struct task_struct { | |||
1455 | /* Used for emulating ABI behavior of previous Linux versions */ | 1455 | /* Used for emulating ABI behavior of previous Linux versions */ |
1456 | unsigned int personality; | 1456 | unsigned int personality; |
1457 | 1457 | ||
1458 | unsigned in_execve:1; /* Tell the LSMs that the process is doing an | 1458 | /* scheduler bits, serialized by scheduler locks */ |
1459 | * execve */ | ||
1460 | unsigned in_iowait:1; | ||
1461 | |||
1462 | /* Revert to default priority/policy when forking */ | ||
1463 | unsigned sched_reset_on_fork:1; | 1459 | unsigned sched_reset_on_fork:1; |
1464 | unsigned sched_contributes_to_load:1; | 1460 | unsigned sched_contributes_to_load:1; |
1465 | unsigned sched_migrated:1; | 1461 | 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; | ||
1466 | #ifdef CONFIG_MEMCG | 1467 | #ifdef CONFIG_MEMCG |
1467 | unsigned memcg_may_oom:1; | 1468 | unsigned memcg_may_oom:1; |
1468 | #endif | 1469 | #endif |
@@ -2002,7 +2003,8 @@ static inline int pid_alive(const struct task_struct *p) | |||
2002 | } | 2003 | } |
2003 | 2004 | ||
2004 | /** | 2005 | /** |
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. | ||
2006 | * @tsk: Task structure to be checked. | 2008 | * @tsk: Task structure to be checked. |
2007 | * | 2009 | * |
2008 | * Check if a task structure is the first user space task the kernel created. | 2010 | * 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) | |||
2011 | */ | 2013 | */ |
2012 | static inline int is_global_init(struct task_struct *tsk) | 2014 | static inline int is_global_init(struct task_struct *tsk) |
2013 | { | 2015 | { |
2014 | return tsk->pid == 1; | 2016 | return task_tgid_nr(tsk) == 1; |
2015 | } | 2017 | } |
2016 | 2018 | ||
2017 | extern struct pid *cad_pid; | 2019 | extern struct pid *cad_pid; |
diff --git a/kernel/fork.c b/kernel/fork.c index fce002ee3ddf..1155eac61687 100644 --- a/kernel/fork.c +++ b/kernel/fork.c | |||
@@ -380,6 +380,7 @@ static struct task_struct *dup_task_struct(struct task_struct *orig) | |||
380 | #endif | 380 | #endif |
381 | tsk->splice_pipe = NULL; | 381 | tsk->splice_pipe = NULL; |
382 | tsk->task_frag.page = NULL; | 382 | tsk->task_frag.page = NULL; |
383 | tsk->wake_q.next = NULL; | ||
383 | 384 | ||
384 | account_kernel_stack(ti, 1); | 385 | account_kernel_stack(ti, 1); |
385 | 386 | ||
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 90e26b11deaa..cfdc0e61066c 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c | |||
@@ -2689,7 +2689,7 @@ static inline int update_cfs_rq_load_avg(u64 now, struct cfs_rq *cfs_rq) | |||
2689 | int decayed, removed = 0; | 2689 | int decayed, removed = 0; |
2690 | 2690 | ||
2691 | if (atomic_long_read(&cfs_rq->removed_load_avg)) { | 2691 | 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); |
2693 | sa->load_avg = max_t(long, sa->load_avg - r, 0); | 2693 | sa->load_avg = max_t(long, sa->load_avg - r, 0); |
2694 | sa->load_sum = max_t(s64, sa->load_sum - r * LOAD_AVG_MAX, 0); | 2694 | sa->load_sum = max_t(s64, sa->load_sum - r * LOAD_AVG_MAX, 0); |
2695 | removed = 1; | 2695 | removed = 1; |