aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/sched.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-09-04 12:10:24 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2017-09-04 12:10:24 -0400
commitf213a6c84c1b4b396a0713ee33cff0e02ba8235f (patch)
treed5c0893d171dce6b1f1cf259a0e59bf433da0839 /include/linux/sched.h
parent621bee34f6ed12d6d4f8896028333fc2200b4ced (diff)
parentbbdacdfed2f5fa50a2cc9f500a36e05990a0837d (diff)
Merge branch 'sched-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull scheduler updates from Ingo Molnar: "The main changes in this cycle were: - fix affine wakeups (Peter Zijlstra) - improve CPU onlining (and general bootup) scalability on systems with ridiculous number (thousands) of CPUs (Peter Zijlstra) - sched/numa updates (Rik van Riel) - sched/deadline updates (Byungchul Park) - sched/cpufreq enhancements and related cleanups (Viresh Kumar) - sched/debug enhancements (Xie XiuQi) - various fixes" * 'sched-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (27 commits) sched/debug: Optimize sched_domain sysctl generation sched/topology: Avoid pointless rebuild sched/topology, cpuset: Avoid spurious/wrong domain rebuilds sched/topology: Improve comments sched/topology: Fix memory leak in __sdt_alloc() sched/completion: Document that reinit_completion() must be called after complete_all() sched/autogroup: Fix error reporting printk text in autogroup_create() sched/fair: Fix wake_affine() for !NUMA_BALANCING sched/debug: Intruduce task_state_to_char() helper function sched/debug: Show task state in /proc/sched_debug sched/debug: Use task_pid_nr_ns in /proc/$pid/sched sched/core: Remove unnecessary initialization init_idle_bootup_task() sched/deadline: Change return value of cpudl_find() sched/deadline: Make find_later_rq() choose a closer CPU in topology sched/numa: Scale scan period with tasks in group and shared/private sched/numa: Slow down scan rate if shared faults dominate sched/pelt: Fix false running accounting sched: Mark pick_next_task_dl() and build_sched_domain() as static sched/cpupri: Don't re-initialize 'struct cpupri' sched/deadline: Don't re-initialize 'struct cpudl' ...
Diffstat (limited to 'include/linux/sched.h')
-rw-r--r--include/linux/sched.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h
index b57c7bedb534..e5fbce866073 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1233,6 +1233,19 @@ static inline pid_t task_pgrp_nr(struct task_struct *tsk)
1233 return task_pgrp_nr_ns(tsk, &init_pid_ns); 1233 return task_pgrp_nr_ns(tsk, &init_pid_ns);
1234} 1234}
1235 1235
1236static inline char task_state_to_char(struct task_struct *task)
1237{
1238 const char stat_nam[] = TASK_STATE_TO_CHAR_STR;
1239 unsigned long state = task->state;
1240
1241 state = state ? __ffs(state) + 1 : 0;
1242
1243 /* Make sure the string lines up properly with the number of task states: */
1244 BUILD_BUG_ON(sizeof(TASK_STATE_TO_CHAR_STR)-1 != ilog2(TASK_STATE_MAX)+1);
1245
1246 return state < sizeof(stat_nam) - 1 ? stat_nam[state] : '?';
1247}
1248
1236/** 1249/**
1237 * is_global_init - check if a task structure is init. Since init 1250 * is_global_init - check if a task structure is init. Since init
1238 * is free to have sub-threads we need to check tgid. 1251 * is free to have sub-threads we need to check tgid.