Major reorganization of <linux/sched.h>
Subsystems (316)
Ingo Molnar
maintainerPATCH 1/89 sched/core: Clean up comments
In reply to Ingo MolnarRefresh the comments in the core scheduler code:
- Capitalize sentences consistently
- Capitalize 'CPU' consistently
- ... and other small details.
--- kernel/sched/core.c | 358 +++++++++++++++++++++++++++++++++++++----------------------------------- 1 file changed, 182 insertions(+), 176 deletions(-)
kernel/sched/core.c +182 -176
@@ -1,31 +1,10 @@/* * kernel/sched/core.c * -* Kernel scheduler and related syscalls +* Core kernel scheduler code and related syscalls * * Copyright (C) 1991-2002 Linus Torvalds -* -* 1996-12-23 Modified by Dave Grothe to fix bugs in semaphores and -* make semaphores SMP safe -* 1998-11-19 Implemented schedule_timeout() and related stuff -* by Andrea Arcangeli -* 2002-01-04 New ultra-scalable O(1) scheduler by Ingo Molnar: -* hybrid priority-list and round-robin design with -* an array-switch method of distributing timeslices -* and per-CPU runqueues. Cleanups and useful suggestions -* by Davide Libenzi, preemptible kernel bits by Robert Love. -* 2003-09-03 Interactivity tuning by Con Kolivas. -* 2004-04-02 Scheduler domains code by Nick Piggin -* 2007-04-15 Work begun on replacing all interactivity tuning with a -* fair scheduling design by Con Kolivas. -* 2007-05-05 Load balancing (smp-nice) and other improvements -* by Peter Williams -* 2007-05-06 Interactivity improvements to CFS by Mike Galbraith -* 2007-07-01 Group scheduling enhancements by Srivatsa Vaddagiri -* 2007-11-29 RT balancing improvements by Steven Rostedt, Gregory Haskins, -* Thomas Gleixner, Mike Kravetz */ -#include <linux/kasan.h> #include <linux/mm.h> #include <linux/module.h>
@@ -143,7 +122,7 @@ const_debug unsigned int sysctl_sched_nr_migrate = 32; const_debug unsigned int sysctl_sched_time_avg = MSEC_PER_SEC;/* -* period over which we measure -rt task cpu usage in us. +* period over which we measure -rt task CPU usage in us. * default: 1s */ unsigned int sysctl_sched_rt_period =1000000 ;
@@ -156,7 +135,7 @@ __read_mostly int scheduler_running;*/ int sysctl_sched_rt_runtime =950000 ; -/* cpus with isolated domains */ +/* CPUs with isolated domains */ cpumask_var_t cpu_isolated_map;/*
@@ -224,7 +203,7 @@ struct rq *task_rq_lock(struct task_struct *p, struct rq_flags *rf)* If we observe the old cpu in task_rq_lock, the acquire of * the old rq->lock will fully serialize against the stores. * -* If we observe the new cpu in task_rq_lock, the acquire will +* If we observe the new CPU in task_rq_lock, the acquire will * pair with the WMB to ensure we must then also see migrating. */ if (likely (rq ==task_rq (p) && !task_on_rq_migrating (p))) {
@@ -461,7 +440,7 @@ void wake_up_q(struct wake_q_head *head) task = container_of(node, struct task_struct, wake_q);BUG_ON (!task); -/* task can safely be re-inserted now */ +/* Task can safely be re-inserted now: */ node = node->next; task->wake_q.next =NULL ;
@@ -519,12 +498,12 @@ void resched_cpu(int cpu) #ifdef CONFIG_SMP #ifdef CONFIG_NO_HZ_COMMON /* - * In the semi idle case, use the nearest busy cpu for migrating timers - * from an idle cpu. This is good for power-savings. + * In the semi idle case, use the nearest busy CPU for migrating timers + * from an idle CPU. This is good for power-savings. * * We don't do similar optimization for completely idle system, as - * selecting an idle cpu will add more delays to the timers than intended - * (as that cpu's timer base may not be uptodate wrt jiffies etc). + * selecting an idle CPU will add more delays to the timers than intended + * (as that CPU's timer base may not be uptodate wrt jiffies etc). */ int get_nohz_timer_target(void) {
@@ -553,6 +532,7 @@ int get_nohz_timer_target(void)rcu_read_unlock ();return cpu; } +/* * When add_timer_on() enqueues a timer into the timer wheel of an * idle CPU then this timer might expire before the next timer event
@@ -1021,7 +1001,7 @@ struct migration_arg { };/* -* Move (not current) task off this cpu, onto dest cpu. We're doing +* Move (not current) task off this CPU, onto the destination CPU. We're doing * this because either it can't run here any more (set_cpus_allowed() * away from this CPU, or CPU going down), or because we're * attempting to rebalance this task on exec (sched_exec).
@@ -1055,8 +1035,8 @@ static int migration_cpu_stop(void *data)struct rq *rq =this_rq ();/* -* The original target cpu might have gone down and we might -* be on another cpu but it doesn't matter. +* The original target CPU might have gone down and we might +* be on another CPU but it doesn't matter. */ local_irq_disable ();/*
@@ -1174,7 +1154,7 @@ static int __set_cpus_allowed_ptr(struct task_struct *p,if (p->flags &PF_KTHREAD ) {/* * For kernel threads that do indeed end up on online && -* !active we want to ensure they are strict per-cpu threads. +* !active we want to ensure they are strict per-CPU threads. */ WARN_ON(cpumask_intersects(new_mask, cpu_online_mask) && !cpumask_intersects(new_mask, cpu_active_mask) &&
@@ -1279,7 +1259,7 @@ static void __migrate_swap_task(struct task_struct *p, int cpu)/* * Task isn't running anymore; make it appear like we migrated * it before it went to sleep. This means on wakeup we make the -* previous cpu our target instead of where it really is. +* previous CPU our target instead of where it really is. */ p->wake_cpu = cpu; }
@@ -1511,12 +1491,12 @@ EXPORT_SYMBOL_GPL(kick_process);* * - on cpu-up we allow per-cpu kthreads on the online && !active cpu, * see __set_cpus_allowed_ptr(). At this point the newly online -* cpu isn't yet part of the sched domains, and balancing will not +* CPU isn't yet part of the sched domains, and balancing will not * see it. * -* - on cpu-down we clear cpu_active() to mask the sched domains and +* - on CPU-down we clear cpu_active() to mask the sched domains and * avoid the load balancer to place new tasks on the to be removed -* cpu. Existing tasks will remain running there and will be taken +* CPU. Existing tasks will remain running there and will be taken * off. * * This means that fallback selection must not select !active CPUs.
@@ -1532,9 +1512,9 @@ static int select_fallback_rq(int cpu, struct task_struct *p)int dest_cpu;/* -* If the node that the cpu is on has been offlined, cpu_to_node() -* will return -1. There is no cpu on the node, and we should -* select the cpu on the other node. +* If the node that the CPU is on has been offlined, cpu_to_node() +* will return -1. There is no CPU on the node, and we should +* select the CPU on the other node. */ if (nid !=-1 ) { nodemask =cpumask_of_node (nid);
@@ -1566,7 +1546,7 @@ static int select_fallback_rq(int cpu, struct task_struct *p) state = possible;break ; } -/* fall-through */ +/* Fall-through */ case possible:do_set_cpus_allowed (p, cpu_possible_mask); state = fail;
@@ -1610,7 +1590,7 @@ int select_task_rq(struct task_struct *p, int cpu, int sd_flags, int wake_flags)/* * In order not to call set_task_cpu() on a blocking task we need * to rely on ttwu() to place the task on a valid ->cpus_allowed -* cpu. +* CPU. * * Since this is common to all placement strategies, this lives here. *
@@ -1684,7 +1664,7 @@ static inline void ttwu_activate(struct rq *rq, struct task_struct *p, int en_flactivate_task (rq, p, en_flags); p->on_rq =TASK_ON_RQ_QUEUED ; -/* if a worker is waking up, notify workqueue */ +/* If a worker is waking up, notify the workqueue: */ if (p->flags &PF_WQ_WORKER )wq_worker_waking_up (p,cpu_of (rq)); }
@@ -1867,7 +1847,7 @@ void wake_up_if_idle(int cpu)raw_spin_lock_irqsave (&rq->lock, flags);if (is_idle_task (rq->curr))smp_send_reschedule (cpu); -/* Else cpu is not in idle, do nothing here */ +/* Else CPU is not idle, do nothing here: */ raw_spin_unlock_irqrestore (&rq->lock, flags); }
@@ -1888,7 +1868,7 @@ static void ttwu_queue(struct task_struct *p, int cpu, int wake_flags)#if defined(CONFIG_SMP )if (sched_feat (TTWU_QUEUE ) && !cpus_share_cache (smp_processor_id (), cpu)) { -sched_clock_cpu (cpu);/* sync clocks x-cpu */ +sched_clock_cpu (cpu);/* Sync clocks across CPUs */ ttwu_queue_remote (p, cpu, wake_flags);return ; }
@@ -1907,8 +1887,8 @@ static void ttwu_queue(struct task_struct *p, int cpu, int wake_flags)* MIGRATION * * The basic program-order guarantee on SMP systems is that when a task [t] -* migrates, all its activity on its old cpu [c0] happens-before any subsequent -* execution on its new cpu [c1]. +* migrates, all its activity on its old CPU [c0] happens-before any subsequent +* execution on its new CPU [c1]. * * For migration (of runnable tasks) this is provided by the following means: *
@@ -1919,7 +1899,7 @@ static void ttwu_queue(struct task_struct *p, int cpu, int wake_flags)* * Transitivity guarantees that B happens after A and C after B. * Note: we only require RCpc transitivity. -* Note: the cpu doing B need not be c0 or c1 +* Note: the CPU doing B need not be c0 or c1 * * Example: *
@@ -2027,7 +2007,8 @@ try_to_wake_up(struct task_struct *p, unsigned int state, int wake_flags)trace_sched_waking (p); - success =1 ;/* we're going to change ->state */ +/* We're going to change ->state: */ + success =1 ; cpu =task_cpu (p);/*
@@ -2076,7 +2057,7 @@ try_to_wake_up(struct task_struct *p, unsigned int state, int wake_flags)smp_rmb ();/* -* If the owning (remote) cpu is still in the middle of schedule() with +* If the owning (remote) CPU is still in the middle of schedule() with * this task as prev, wait until its done referencing the task. * * Pairs with the smp_store_release() in finish_lock_switch().
@@ -2448,7 +2429,7 @@ int sched_fork(unsigned long clone_flags, struct task_struct *p)*/ raw_spin_lock_irqsave (&p->pi_lock, flags);/* -* We're setting the cpu for the first time, we don't migrate, +* We're setting the CPU for the first time, we don't migrate, * so use __set_task_cpu(). */ __set_task_cpu (p, cpu);
@@ -2591,7 +2572,7 @@ void wake_up_new_task(struct task_struct *p)/* * Fork balancing, do it here and not earlier because: * - cpus_allowed can change in the fork path -* - any previously selected cpu might disappear through hotplug +* - any previously selected CPU might disappear through hotplug * * Use __set_task_cpu() to avoid calling sched_class::migrate_task_rq, * as we're not fully set-up yet.
@@ -2945,7 +2926,7 @@ unsigned long nr_running(void) }/* -* Check if only the current task is running on the cpu. +* Check if only the current task is running on the CPU. * * Caution: this function does not check that the caller has disabled * preemption, thus the result might have a time-of-check-to-time-of-use
@@ -3104,8 +3085,8 @@ unsigned long long task_sched_runtime(struct task_struct *p)* So we have a optimization chance when the task's delta_exec is 0. * Reading ->on_cpu is racy, but this is ok. * -* If we race with it leaving cpu, we'll take a lock. So we're correct. -* If we race with it entering cpu, unaccounted time is 0. This is +* If we race with it leaving CPU, we'll take a lock. So we're correct. +* If we race with it entering CPU, unaccounted time is 0. This is * indistinguishable from the read occurring a few cycles earlier. * If we see ->on_cpu without ->on_rq, the task is leaving, and has * been accounted, so we're correct here as well.
@@ -3333,7 +3314,7 @@ pick_next_task(struct rq *rq, struct task_struct *prev, struct rq_flags *rf)if (unlikely (p ==RETRY_TASK )) goto again; -/* assumes fair_sched_class->next == idle_sched_class */ +/* Assumes fair_sched_class->next == idle_sched_class */ if (unlikely (!p)) p = idle_sched_class.pick_next_task (rq, prev, rf);
@@ -3350,7 +3331,8 @@ pick_next_task(struct rq *rq, struct task_struct *prev, struct rq_flags *rf) } } -BUG ();/* the idle class will always have a runnable task */ +/* The idle class should always have a runnable task: */ +BUG (); }/*
@@ -3421,7 +3403,8 @@ static void __sched notrace __schedule(bool preempt)raw_spin_lock (&rq->lock);rq_pin_lock (rq, &rf); - rq->clock_update_flags <<=1 ;/* promote REQ to ACT */ +/* Promote REQ to ACT */ + rq->clock_update_flags <<=1 ; switch_count = &prev->nivcsw;if (!preempt && prev->state) {
@@ -3465,7 +3448,9 @@ static void __sched notrace __schedule(bool preempt) ++*switch_count;trace_sched_switch (preempt, prev, next); - rq =context_switch (rq, prev, next, &rf);/* unlocks the rq */ + +/* Also unlocks the rq: */ + rq =context_switch (rq, prev, next, &rf); }else { rq->clock_update_flags &= ~(RQCF_ACT_SKIP |RQCF_REQ_SKIP );rq_unpin_lock (rq, &rf);
@@ -3492,14 +3477,18 @@ void __noreturn do_task_dead(void)smp_mb ();raw_spin_unlock_wait (¤t->pi_lock); -/* causes final put_task_struct in finish_task_switch(). */ +/* Causes final put_task_struct in finish_task_switch(): */ __set_current_state (TASK_DEAD ); - current->flags |=PF_NOFREEZE ;/* tell freezer to ignore us */ + +/* Tell freezer to ignore us: */ + current->flags |=PF_NOFREEZE ; +__schedule (false);BUG (); -/* Avoid "noreturn function does return". */ + +/* Avoid "noreturn function does return" - but don't continue if BUG() is a NOP: */ for (;;) -cpu_relax ();/* For when BUG is null */ +cpu_relax (); }static inline void sched_submit_work (struct task_struct *tsk)
@@ -3792,7 +3781,8 @@ void rt_mutex_setprio(struct task_struct *p, int prio)check_class_changed (rq, p, prev_class, oldprio); out_unlock: -preempt_disable ();/* avoid rq from going away on us */ +/* Avoid rq from going away on us: */ +preempt_disable ();__task_rq_unlock (rq, &rf);balance_callback (rq);
@@ -3862,7 +3852,7 @@ EXPORT_SYMBOL(set_user_nice);*/ int can_nice (const struct task_struct *p,const int nice) { -/* convert nice value [19,-20] to rlimit style value [1,40] */ +/* Convert nice value [19,-20] to rlimit style value [1,40]: */ int nice_rlim =nice_to_rlimit (nice); return (nice_rlim <= task_rlimit(p, RLIMIT_NICE) ||
@@ -3918,7 +3908,7 @@ int task_prio(const struct task_struct *p) }/** -* idle_cpu - is a given cpu idle currently? +* idle_cpu - is a given CPU idle currently? * @cpu: the processor in question. * * Return: 1 if the CPU is currently idle. 0 otherwise.
@@ -3942,10 +3932,10 @@ int idle_cpu(int cpu) }/** -* idle_task - return the idle task for a given cpu. +* idle_task - return the idle task for a given CPU. * @cpu: the processor in question. * -* Return: The idle task for the cpu @cpu. +* Return: The idle task for the CPU @cpu. */ struct task_struct *idle_task (int cpu) {
@@ -4111,7 +4101,7 @@ __checkparam_dl(const struct sched_attr *attr) }/* -* check the target process has a UID that matches the current process's +* Check the target process has a UID that matches the current process's: */ static bool check_same_owner (struct task_struct *p) {
@@ -4126,8 +4116,7 @@ static bool check_same_owner(struct task_struct *p)return match; } -static bool dl_param_changed (struct task_struct *p, -const struct sched_attr *attr) +static bool dl_param_changed (struct task_struct *p,const struct sched_attr *attr) {struct sched_dl_entity *dl_se = &p->dl;
@@ -4154,10 +4143,10 @@ static int __sched_setscheduler(struct task_struct *p,int queue_flags =DEQUEUE_SAVE |DEQUEUE_MOVE ;struct rq *rq; -/* may grab non-irq protected spin_locks */ +/* May grab non-irq protected spin_locks: */ BUG_ON (in_interrupt ()); recheck: -/* double check policy once rq lock held */ +/* Double check policy once rq lock held: */ if (policy <0 ) { reset_on_fork = p->sched_reset_on_fork; policy = oldpolicy = p->policy;
@@ -4197,11 +4186,11 @@ static int __sched_setscheduler(struct task_struct *p,unsigned long rlim_rtprio =task_rlimit (p,RLIMIT_RTPRIO ); -/* can't set/change the rt policy */ +/* Can't set/change the rt policy: */ if (policy != p->policy && !rlim_rtprio)return -EPERM ; -/* can't increase priority */ +/* Can't increase priority: */ if (attr->sched_priority > p->rt_priority && attr->sched_priority > rlim_rtprio)return -EPERM ;
@@ -4225,11 +4214,11 @@ static int __sched_setscheduler(struct task_struct *p,return -EPERM ; } -/* can't change other user's priorities */ +/* Can't change other user's priorities: */ if (!check_same_owner (p))return -EPERM ; -/* Normal users shall not reset the sched_reset_on_fork flag */ +/* Normal users shall not reset the sched_reset_on_fork flag: */ if (p->sched_reset_on_fork && !reset_on_fork)return -EPERM ; }
@@ -4241,7 +4230,7 @@ static int __sched_setscheduler(struct task_struct *p, }/* -* make sure no PI-waiters arrive (or leave) while we are +* Make sure no PI-waiters arrive (or leave) while we are * changing the priority of the task: * * To be able to change p->policy safely, the appropriate
@@ -4251,7 +4240,7 @@ static int __sched_setscheduler(struct task_struct *p,update_rq_clock (rq);/* -* Changing the policy of the stop threads its a very bad idea +* Changing the policy of the stop threads its a very bad idea: */ if (p == rq->stop) {task_rq_unlock (rq, p, &rf);
@@ -4307,7 +4296,7 @@ static int __sched_setscheduler(struct task_struct *p,#endif } -/* recheck policy now with rq lock held */ +/* Re-check policy now with rq lock held: */ if (unlikely (oldpolicy !=-1 && oldpolicy != p->policy)) { policy = oldpolicy =-1 ;task_rq_unlock (rq, p, &rf);
@@ -4364,15 +4353,15 @@ static int __sched_setscheduler(struct task_struct *p,set_curr_task (rq, p);check_class_changed (rq, p, prev_class, oldprio); -preempt_disable ();/* avoid rq from going away on us */ + +/* Avoid rq from going away on us: */ +preempt_disable ();task_rq_unlock (rq, p, &rf);if (pi)rt_mutex_adjust_pi (p); -/* -* Run balance callbacks after we've adjusted the PI chain. -*/ +/* Run balance callbacks after we've adjusted the PI chain: */ balance_callback (rq);preempt_enable ();
@@ -4465,8 +4454,7 @@ do_sched_setscheduler(pid_t pid, int policy, struct sched_param __user *param)/* * Mimics kernel/events/core.c perf_copy_attr(). */ -static int sched_copy_attr (struct sched_attr __user *uattr, -struct sched_attr *attr) +static int sched_copy_attr (struct sched_attr __user *uattr,struct sched_attr *attr) {u32 size;int ret;
@@ -4474,19 +4462,19 @@ static int sched_copy_attr(struct sched_attr __user *uattr,if (!access_ok (VERIFY_WRITE , uattr,SCHED_ATTR_SIZE_VER0 ))return -EFAULT ; -/* -* zero the full structure, so that a short copy will be nice. -*/ +/* Zero the full structure, so that a short copy will be nice: */ memset (attr,0 ,sizeof (*attr)); ret =get_user (size, &uattr->size);if (ret)return ret; -if (size >PAGE_SIZE )/* silly large */ +/* Bail out on silly large: */ +if (size >PAGE_SIZE ) goto err_size; -if (!size)/* abi compat */ +/* ABI compatibility quirk: */ +if (!size) size =SCHED_ATTR_SIZE_VER0 ;if (size <SCHED_ATTR_SIZE_VER0 )
@@ -4521,7 +4509,7 @@ static int sched_copy_attr(struct sched_attr __user *uattr,return -EFAULT ;/* -* XXX: do we want to be lenient like existing syscalls; or do we want +* XXX: Do we want to be lenient like existing syscalls; or do we want * to be strict and return an error on out-of-bounds values? */ attr->sched_nice =clamp (attr->sched_nice,MIN_NICE ,MAX_NICE );
@@ -4541,10 +4529,8 @@ static int sched_copy_attr(struct sched_attr __user *uattr,* * Return: 0 on success. An error code otherwise. */ -SYSCALL_DEFINE3 (sched_setscheduler, pid_t, pid, int, policy, - struct sched_param __user *, param) +SYSCALL_DEFINE3(sched_setscheduler, pid_t, pid, int, policy, struct sched_param __user *, param) { -/* negative values for policy are not valid */ if (policy <0 )return -EINVAL ;
@@ -4854,10 +4840,10 @@ static int get_user_cpu_mask(unsigned long __user *user_mask_ptr, unsigned len, }/** -* sys_sched_setaffinity - set the cpu affinity of a process +* sys_sched_setaffinity - set the CPU affinity of a process * @pid: pid of the process * @len: length in bytes of the bitmask pointed to by user_mask_ptr -* @user_mask_ptr: user-space pointer to the new cpu mask +* @user_mask_ptr: user-space pointer to the new CPU mask * * Return: 0 on success. An error code otherwise. */
@@ -4905,10 +4891,10 @@ long sched_getaffinity(pid_t pid, struct cpumask *mask) }/** -* sys_sched_getaffinity - get the cpu affinity of a process +* sys_sched_getaffinity - get the CPU affinity of a process * @pid: pid of the process * @len: length in bytes of the bitmask pointed to by user_mask_ptr -* @user_mask_ptr: user-space pointer to hold the current cpu mask +* @user_mask_ptr: user-space pointer to hold the current CPU mask * * Return: size of CPU mask copied to user_mask_ptr on success. An * error code otherwise.
@@ -5036,7 +5022,7 @@ EXPORT_SYMBOL(__cond_resched_softirq);* Typical broken usage is: * * while (!event) -* yield(); +* yield(); * * where one assumes that yield() will let 'the other' process run that will * make event true. If the current task is a SCHED_FIFO task that will never
@@ -5351,7 +5337,7 @@ void init_idle_bootup_task(struct task_struct *idle)/** * init_idle - set up an idle thread for a given CPU * @idle: task in question -* @cpu: cpu the idle task belongs to +* @cpu: CPU the idle task belongs to * * NOTE: this function does not set the idle thread's NEED_RESCHED * flag, to make booting more robust.
@@ -5382,7 +5368,7 @@ void init_idle(struct task_struct *idle, int cpu)#endif /* * We're having a chicken and egg problem, even though we are -* holding rq->lock, the cpu isn't yet set to this cpu so the +* holding rq->lock, the CPU isn't yet set to this CPU so the * lockdep check in task_group() will fail. * * Similar case to sched_fork(). / Alternatively we could
@@ -5447,7 +5433,7 @@ int task_can_attach(struct task_struct *p,/* * Kthreads which disallow setaffinity shouldn't be moved -* to a new cpuset; we don't want to change their cpu +* to a new cpuset; we don't want to change their CPU * affinity and isolating such threads by their set of * allowed nodes is unnecessary. Thus, cpusets are not * applicable for such threads. This prevents checking for
@@ -5548,7 +5534,7 @@ void sched_setnuma(struct task_struct *p, int nid)#ifdef CONFIG_HOTPLUG_CPU /* -* Ensures that the idle task is using init_mm right before its cpu goes +* Ensure that the idle task is using init_mm right before its CPU goes * offline. */ void idle_task_exit (void )
@@ -5632,13 +5618,13 @@ static void migrate_tasks(struct rq *dead_rq)for (;;) {/* * There's this thread running, bail when that's the only -* remaining thread. +* remaining thread: */ if (rq->nr_running ==1 )break ;/* -* pick_next_task assumes pinned rq->lock. +* pick_next_task() assumes pinned rq->lock: */ rq_pin_lock (rq, &rf); next =pick_next_task (rq, &fake_task, &rf);
@@ -5730,7 +5716,8 @@ static void set_cpu_rq_start_time(unsigned int cpu) rq->age_stamp =sched_clock_cpu (cpu); } -static cpumask_var_t sched_domains_tmpmask;/* sched_domains_mutex */ +/* Protected by sched_domains_mutex: */ +static cpumask_var_t sched_domains_tmpmask;#ifdef CONFIG_SCHED_DEBUG
@@ -5997,7 +5984,7 @@ static int init_rootdomain(struct root_domain *rd) }/* -* By default the system creates a single root-domain with all cpus as +* By default the system creates a single root-domain with all CPUs as * members (mimicking the global state we have today). */ struct root_domain def_root_domain;
@@ -6083,9 +6070,9 @@ static void destroy_sched_domains(struct sched_domain *sd)* SD_SHARE_PKG_RESOURCE set (Last Level Cache Domain) for this * allows us to avoid some pointer chasing select_idle_sibling(). * -* Also keep a unique ID per domain (we use the first cpu number in +* Also keep a unique ID per domain (we use the first CPU number in * the cpumask of the domain), this allows us to quickly tell if -* two cpus are in the same cache domain, see cpus_share_cache(). +* two CPUs are in the same cache domain, see cpus_share_cache(). */ DEFINE_PER_CPU(struct sched_domain *, sd_llc);DEFINE_PER_CPU (int, sd_llc_size);
@@ -6170,7 +6157,7 @@ cpu_attach_domain(struct sched_domain *sd, struct root_domain *rd, int cpu)update_top_cache_domain (cpu); } -/* Setup the mask of cpus configured for isolated domains */ +/* Setup the mask of CPUs configured for isolated domains */ static int __init isolated_cpu_setup (char *str) {int ret;
@@ -6207,8 +6194,7 @@ enum s_alloc {* * In that case build_sched_domains() will have terminated the iteration early * and our sibling sd spans will be empty. Domains should always include the -* cpu they're built on, so check that. -* +* CPU they're built on, so check that. */ static void build_group_mask (struct sched_domain *sd,struct sched_group *sg) {
@@ -6227,7 +6213,7 @@ static void build_group_mask(struct sched_domain *sd, struct sched_group *sg) }/* -* Return the canonical balance cpu for this group, this is the first cpu +* Return the canonical balance CPU for this group, this is the first CPU * of this group that's also in the iteration mask. */ int group_balance_cpu (struct sched_group *sg)
@@ -6287,7 +6273,7 @@ build_overlap_sched_groups(struct sched_domain *sd, int cpu)/* * Make sure the first group of this domain contains the -* canonical balance cpu. Otherwise the sched_domain iteration +* canonical balance CPU. Otherwise the sched_domain iteration * breaks. See update_sg_lb_stats(). */ if ((!groups && cpumask_test_cpu(cpu, sg_span)) ||
@@ -6322,7 +6308,9 @@ static int get_group(int cpu, struct sd_data *sdd, struct sched_group **sg)if (sg) { *sg = *per_cpu_ptr (sdd->sg, cpu); (*sg)->sgc = *per_cpu_ptr (sdd->sgc, cpu); -atomic_set (&(*sg)->sgc->ref,1 );/* for claim_allocations */ + +/* For claim_allocations: */ +atomic_set (&(*sg)->sgc->ref,1 ); }return cpu;
@@ -6456,10 +6444,10 @@ static void set_domain_attribute(struct sched_domain *sd, }else request = attr->relax_domain_level;if (request < sd->level) { -/* turn off idle balance on this domain */ +/* Turn off idle balance on this domain: */ sd->flags &= ~(SD_BALANCE_WAKE |SD_BALANCE_NEWIDLE ); }else { -/* turn on idle balance on this domain */ +/* Turn on idle balance on this domain: */ sd->flags |= (SD_BALANCE_WAKE |SD_BALANCE_NEWIDLE ); } }
@@ -6473,18 +6461,21 @@ static void __free_domain_allocs(struct s_data *d, enum s_alloc what,switch (what) {case sa_rootdomain:if (!atomic_read (&d->rd->refcount)) -free_rootdomain (&d->rd->rcu);/* fall through */ +free_rootdomain (&d->rd->rcu); +/* Fall through */ case sa_sd: -free_percpu (d->sd);/* fall through */ +free_percpu (d->sd); +/* Fall through */ case sa_sd_storage: -__sdt_free (cpu_map);/* fall through */ +__sdt_free (cpu_map); +/* Fall through */ case sa_none:break ; } } -static enum s_alloc __visit_domain_allocation_hell (struct s_data *d, -const struct cpumask *cpu_map) +static enum s_alloc +__visit_domain_allocation_hell (struct s_data *d,const struct cpumask *cpu_map) {memset (d,0 ,sizeof (*d));
@@ -6883,7 +6874,7 @@ static void sched_init_numa(void)/* * Now for each level, construct a mask per node which contains all -* cpus of nodes that are that many hops away from us. +* CPUs of nodes that are that many hops away from us. */ for (i =0 ; i < level; i++) { sched_domains_numa_masks[i] =
@@ -7103,11 +7094,11 @@ struct sched_domain *build_sched_domain(struct sched_domain_topology_level *tl, }/* -* Build sched domains for a given set of cpus and attach the sched domains -* to the individual cpus +* Build sched domains for a given set of CPUs and attach the sched domains +* to the individual CPUs */ -static int build_sched_domains (const struct cpumask *cpu_map, -struct sched_domain_attr *attr) +static int +build_sched_domains (const struct cpumask *cpu_map,struct sched_domain_attr *attr) {enum s_alloc alloc_state;struct sched_domain *sd;
@@ -7119,7 +7110,7 @@ static int build_sched_domains(const struct cpumask *cpu_map,if (alloc_state != sa_rootdomain) goto error; -/* Set up domains for cpus specified by the cpu_map. */ +/* Set up domains for CPUs specified by the cpu_map: */ for_each_cpu (i, cpu_map) {struct sched_domain_topology_level *tl;
@@ -7185,21 +7176,25 @@ static int build_sched_domains(const struct cpumask *cpu_map,return ret; } -static cpumask_var_t *doms_cur;/* current sched domains */ -static int ndoms_cur;/* number of sched domains in 'doms_cur' */ -static struct sched_domain_attr *dattr_cur; -/* attribues of custom domains in 'doms_cur' */ +/* Current sched domains: */ +static cpumask_var_t *doms_cur; + +/* Number of sched domains in 'doms_cur': */ +static int ndoms_cur; + +/* Attribues of custom domains in 'doms_cur' */ +static struct sched_domain_attr *dattr_cur;/* -* Special case: If a kmalloc of a doms_cur partition (array of +* Special case: If a kmalloc() of a doms_cur partition (array of * cpumask) fails, then fallback to a single sched domain, * as determined by the single cpumask fallback_doms. */ -static cpumask_var_t fallback_doms; +static cpumask_var_t fallback_doms;/* * arch_update_cpu_topology lets virtualized architectures update the -* cpu core maps. It is supposed to return 1 if the topology changed +* CPU core maps. It is supposed to return 1 if the topology changed * or 0 if it stayed the same. */ int __weak arch_update_cpu_topology (void )
@@ -7234,7 +7229,7 @@ void free_sched_domains(cpumask_var_t doms[], unsigned int ndoms)/* * Set up scheduler domains and groups. Callers must hold the hotplug lock. -* For now this just excludes isolated cpus, but could be used to +* For now this just excludes isolated CPUs, but could be used to * exclude other special cases in the future. */ static int init_sched_domains (const struct cpumask *cpu_map)
@@ -7254,8 +7249,8 @@ static int init_sched_domains(const struct cpumask *cpu_map) }/* -* Detach sched domains from a group of cpus specified in cpu_map -* These cpus will now be attached to the NULL domain +* Detach sched domains from a group of CPUs specified in cpu_map +* These CPUs will now be attached to the NULL domain */ static void detach_destroy_domains (const struct cpumask *cpu_map) {
@@ -7273,7 +7268,7 @@ static int dattrs_equal(struct sched_domain_attr *cur, int idx_cur, {struct sched_domain_attr tmp; -/* fast path */ +/* Fast path: */ if (!new && !cur)return 1 ;
@@ -7317,22 +7312,22 @@ void partition_sched_domains(int ndoms_new, cpumask_var_t doms_new[],mutex_lock (&sched_domains_mutex); -/* always unregister in case we don't destroy any domains */ +/* Always unregister in case we don't destroy any domains: */ unregister_sched_domain_sysctl (); -/* Let architecture update cpu core mappings. */ +/* Let the architecture update CPU core mappings: */ new_topology =arch_update_cpu_topology (); n = doms_new ? ndoms_new :0 ; -/* Destroy deleted domains */ +/* Destroy deleted domains: */ for (i =0 ; i < ndoms_cur; i++) {for (j =0 ; j < n && !new_topology; j++) {if (cpumask_equal (doms_cur[i], doms_new[j]) &&dattrs_equal (dattr_cur, i, dattr_new, j)) goto match1; } -/* no match - a current sched domain not in new doms_new[] */ +/* No match - a current sched domain not in new doms_new[] */ detach_destroy_domains (doms_cur[i]); match1: ;
@@ -7346,23 +7341,24 @@ void partition_sched_domains(int ndoms_new, cpumask_var_t doms_new[],WARN_ON_ONCE (dattr_new); } -/* Build new domains */ +/* Build new domains: */ for (i =0 ; i < ndoms_new; i++) {for (j =0 ; j < n && !new_topology; j++) {if (cpumask_equal (doms_new[i], doms_cur[j]) &&dattrs_equal (dattr_new, i, dattr_cur, j)) goto match2; } -/* no match - add a new doms_new */ +/* No match - add a new doms_new */ build_sched_domains (doms_new[i], dattr_new ? dattr_new + i :NULL ); match2: ; } -/* Remember the new sched domains */ +/* Remember the new sched domains: */ if (doms_cur != &fallback_doms)free_sched_domains (doms_cur, ndoms_cur); -kfree (dattr_cur);/* kfree(NULL) is safe */ + +kfree (dattr_cur); doms_cur = doms_new; dattr_cur = dattr_new; ndoms_cur = ndoms_new;
@@ -7372,7 +7368,10 @@ void partition_sched_domains(int ndoms_new, cpumask_var_t doms_new[],mutex_unlock (&sched_domains_mutex); } -static int num_cpus_frozen;/* used to mark begin/end of suspend/resume */ +/* +* used to mark begin/end of suspend/resume: +*/ +static int num_cpus_frozen;/* * Update cpusets according to cpu_active mask. If cpusets are
@@ -7449,7 +7448,7 @@ int sched_cpu_activate(unsigned int cpu)* Put the rq online, if not already. This happens: * * 1) In the early boot process, because we build the real domains -* after all cpus have been brought up. +* after all CPUs have been brought up. * * 2) At runtime, if cpuset_cpu_active() fails to rebuild the * domains.
@@ -7564,7 +7563,7 @@ void __init sched_init_smp(void)/* * There's no userspace yet to cause hotplug operations; hence all the -* cpu masks are stable and all blatant races in the below code cannot +* CPU masks are stable and all blatant races in the below code cannot * happen. */ mutex_lock (&sched_domains_mutex);
@@ -7684,10 +7683,8 @@ void __init sched_init(void) }#endif /* CONFIG_CPUMASK_OFFSTACK */ -init_rt_bandwidth (&def_rt_bandwidth, -global_rt_period (),global_rt_runtime ()); -init_dl_bandwidth (&def_dl_bandwidth, -global_rt_period (),global_rt_runtime ()); +init_rt_bandwidth (&def_rt_bandwidth,global_rt_period (),global_rt_runtime ()); +init_dl_bandwidth (&def_dl_bandwidth,global_rt_period (),global_rt_runtime ());#ifdef CONFIG_SMP init_defrootdomain ();
@@ -7723,18 +7720,18 @@ void __init sched_init(void)INIT_LIST_HEAD (&rq->leaf_cfs_rq_list); rq->tmp_alone_branch = &rq->leaf_cfs_rq_list;/* -* How much cpu bandwidth does root_task_group get? +* How much CPU bandwidth does root_task_group get? * * In case of task-groups formed thr' the cgroup filesystem, it -* gets 100% of the cpu resources in the system. This overall -* system cpu resource is divided among the tasks of +* gets 100% of the CPU resources in the system. This overall +* system CPU resource is divided among the tasks of * root_task_group and its child task-groups in a fair manner, * based on each entity's (task or task-group's) weight * (se->load.weight). * * In other words, if root_task_group has 10 tasks of weight * 1024) and two child groups A0 and A1 (of weight 1024 each), -* then A0's share of the cpu resource is: +* then A0's share of the CPU resource is: * * A0's bandwidth = 1024 / (10*1024 + 1024 + 1024) = 8.33% *
@@ -7843,10 +7840,14 @@ EXPORT_SYMBOL(__might_sleep);void ___might_sleep (const char *file,int line,int preempt_offset) { -static unsigned long prev_jiffy;/* ratelimiting */ +/* Ratelimiting timestamp: */ +static unsigned long prev_jiffy; +unsigned long preempt_disable_ip; -rcu_sleep_check ();/* WARN_ON_ONCE() by default, no rate limit reqd. */ +/* WARN_ON_ONCE() by default, no rate limit required: */ +rcu_sleep_check (); +if ((preempt_count_equals (preempt_offset) && !irqs_disabled () && !is_idle_task (current)) || system_state !=SYSTEM_RUNNING || oops_in_progress)
@@ -7855,7 +7856,7 @@ void ___might_sleep(const char *file, int line, int preempt_offset)return ; prev_jiffy = jiffies; -/* Save this before calling printk(), since that will clobber it */ +/* Save this before calling printk(), since that will clobber it: */ preempt_disable_ip =get_preempt_disable_ip (current); printk(KERN_ERR
@@ -7934,7 +7935,7 @@ void normalize_rt_tasks(void)*/ /** -* curr_task - return the current task for a given cpu. +* curr_task - return the current task for a given CPU. * @cpu: the processor in question. * * ONLY VALID WHEN THE WHOLE SYSTEM IS STOPPED!
@@ -7950,13 +7951,13 @@ struct task_struct *curr_task(int cpu)#ifdef CONFIG_IA64 /** -* set_curr_task - set the current task for a given cpu. +* set_curr_task - set the current task for a given CPU. * @cpu: the processor in question. * @p: the task pointer to set. * * Description: This function must only be used when non-maskable interrupts * are serviced on a separate stack. It allows the architecture to switch the -* notion of the current task on a cpu in a non-blocking manner. This function +* notion of the current task on a CPU in a non-blocking manner. This function * must be called with all CPU's synchronized, and interrupts disabled, the * and caller must save the original value of the current task (see * curr_task() above) and restore that value before reenabling interrupts and
@@ -8012,7 +8013,8 @@ void sched_online_group(struct task_group *tg, struct task_group *parent)spin_lock_irqsave (&task_group_lock, flags);list_add_rcu (&tg->list, &task_groups); -WARN_ON (!parent);/* root should already exist */ +/* Root should already exist: */ +WARN_ON (!parent); tg->parent = parent;INIT_LIST_HEAD (&tg->children);
@@ -8025,13 +8027,13 @@ void sched_online_group(struct task_group *tg, struct task_group *parent)/* rcu callback to free various structures associated with a task group */ static void sched_free_group_rcu (struct rcu_head *rhp) { -/* now it should be safe to free those cfs_rqs */ +/* Now it should be safe to free those cfs_rqs: */ sched_free_group (container_of(rhp ,struct task_group ,rcu )); }void sched_destroy_group (struct task_group *tg) { -/* wait for possible concurrent references to cfs_rqs complete */ +/* Wait for possible concurrent references to cfs_rqs complete: */ call_rcu (&tg->rcu, sched_free_group_rcu); }
@@ -8039,7 +8041,7 @@ void sched_offline_group(struct task_group *tg) {unsigned long flags; -/* end participation in shares distribution */ +/* End participation in shares distribution: */ unregister_fair_sched_group (tg);spin_lock_irqsave (&task_group_lock, flags);
@@ -8468,8 +8470,10 @@ int sched_rr_handler(struct ctl_table *table, int write,mutex_lock (&mutex); ret =proc_dointvec (table, write, buffer, lenp, ppos); -/* make sure that internally we keep jiffies */ -/* also, writing zero resets timeslice to default */ +/* +* Make sure that internally we keep jiffies. +* Also, writing zero resets the timeslice to default: +*/ if (!ret && write) { sched_rr_timeslice = sysctl_sched_rr_timeslice <= 0 ? RR_TIMESLICE :
@@ -8654,9 +8658,11 @@ static int tg_set_cfs_bandwidth(struct task_group *tg, u64 period, u64 quota) cfs_b->quota = quota;__refill_cfs_bandwidth_runtime (cfs_b); -/* restart the period timer (if active) to handle new period expiry */ + +/* Restart the period timer (if active) to handle new period expiry: */ if (runtime_enabled)start_cfs_bandwidth (cfs_b); +raw_spin_unlock_irq (&cfs_b->lock);for_each_online_cpu (i) {
@@ -8794,8 +8800,8 @@ static int tg_cfs_schedulable_down(struct task_group *tg, void *data) parent_quota = parent_b->hierarchical_quota;/* -* ensure max(child_quota) <= parent_quota, inherit when no -* limit is set +* Ensure max(child_quota) <= parent_quota, inherit when no +* limit is set: */ if (quota ==RUNTIME_INF ) quota = parent_quota;
@@ -8904,7 +8910,7 @@ static struct cftype cpu_files[] = { .write_u64 = cpu_rt_period_write_uint, },#endif - { }/* terminate */ + { }/* Terminate */ }; struct cgroup_subsys cpu_cgrp_subsys = {
Signature · 1 line
2.7.4
Ingo Molnar
maintainerPATCH 2/89 delayacct: Include <uapi/linux/taskstats.h>
In reply to Ingo Molnarinclude/linux/delayacct.h relies on 'struct taskstats' but does not include the header that defines it.
This worked so far because files that included <linux/taskstats.h> also happened to include other headers that included uapi/linux/taskstats.h.
Fix it.
--- include/linux/delayacct.h | 1 + 1 file changed, 1 insertion(+)
include/linux/delayacct.h +1 -0
@@ -17,6 +17,7 @@#ifndef _LINUX_DELAYACCT_H#define _LINUX_DELAYACCT_H +#include <uapi/linux/taskstats.h> #include <linux/sched.h> #include <linux/slab.h>
Signature · 1 line
2.7.4
Ingo Molnar
maintainerPATCH 5/89 sched/topology: Split out scheduler topology code from core.c into topology.c
In reply to Ingo Molnar--- kernel/sched/Makefile | 2 +- kernel/sched/core.c | 1659 +------------------------------------------------------------------ kernel/sched/sched.h | 23 +- kernel/sched/topology.c | 1658 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 1684 insertions(+), 1658 deletions(-)
kernel/sched/Makefile +1 -1
@@ -18,7 +18,7 @@ endif obj-y += core.o loadavg.o clock.o cputime.o obj-y += idle_task.o fair.o rt.o deadline.o stop_task.o obj-y += wait.o swait.o completion.o idle.o -obj-$(CONFIG_SMP) += cpupri.o cpudeadline.o +obj-$(CONFIG_SMP) += cpupri.o cpudeadline.o topology.o obj-$(CONFIG_SCHED_AUTOGROUP) += auto_group.o obj-$(CONFIG_SCHEDSTATS) += stats.o obj-$(CONFIG_SCHED_DEBUG) += debug.o
kernel/sched/core.c +3 -1656
1,689 lines not on this page · raw message
kernel/sched/sched.h +22 -1
@@ -223,7 +223,7 @@ bool __dl_overflow(struct dl_bw *dl_b, int cpus, u64 old_bw, u64 new_bw) dl_b->bw * cpus < dl_b->total_bw - old_bw + new_bw; } -extern struct mutex sched_domains_mutex; +extern void init_dl_bw (struct dl_bw *dl_b);#ifdef CONFIG_CGROUP_SCHED
@@ -584,6 +584,13 @@ struct root_domain { };extern struct root_domain def_root_domain; +extern struct mutex sched_domains_mutex; +extern cpumask_var_t fallback_doms; +extern cpumask_var_t sched_domains_tmpmask; + +extern void init_defrootdomain (void ); +extern int init_sched_domains (const struct cpumask *cpu_map); +extern void rq_attach_root (struct rq *rq,struct root_domain *rd);#endif /* CONFIG_SMP */
@@ -886,6 +893,16 @@ extern int sched_max_numa_distance;extern bool find_numa_distance (int distance);#endif +#ifdef CONFIG_NUMA +extern void sched_init_numa (void ); +extern void sched_domains_numa_masks_set (unsigned int cpu); +extern void sched_domains_numa_masks_clear (unsigned int cpu); +#else +static inline void sched_init_numa (void ) { } +static inline void sched_domains_numa_masks_set (unsigned int cpu) { } +static inline void sched_domains_numa_masks_clear (unsigned int cpu) { } +#endif +#ifdef CONFIG_NUMA_BALANCING /* The regions in numa_faults array from task_struct */ enum numa_faults_stats {
@@ -1752,6 +1769,10 @@ static inline void double_rq_unlock(struct rq *rq1, struct rq *rq2) __release(rq2->lock); } +extern void set_rq_online (struct rq *rq); +extern void set_rq_offline (struct rq *rq); +extern bool sched_smp_initialized; +#else /* CONFIG_SMP */ /*
kernel/sched/topology.c new file +1658 -0
1,256 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.7.4
Part of the diff is not shown here. View the raw message.
Ingo Molnar
maintainerPATCH 6/89 sched/topology: Split out scheduler topology interfaces from <linux/sched.h> into <linux/sched/topology.h>
In reply to Ingo MolnarThe vast majority of sched.h users does not require the topology types and interfaces, so split them out into a separate header, and include them in the .c files that require them.
This reduces the size of linux/sched.h by ~6%.
--- arch/arm/kernel/topology.c | 1 + arch/arm64/kernel/topology.c | 1 + arch/powerpc/kernel/smp.c | 1 + arch/s390/kernel/topology.c | 1 + arch/x86/kernel/smpboot.c | 1 + block/blk-mq.c | 1 + block/blk-softirq.c | 1 + include/linux/cpuset.h | 1 + include/linux/sched.h | 212 ----------------------------------------------------------- include/linux/sched/topology.h | 217 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ kernel/sched/fair.c | 2 + kernel/sched/sched.h | 1 + 12 files changed, 228 insertions(+), 212 deletions(-)
arch/arm/kernel/topology.c +1 -0
@@ -21,6 +21,7 @@#include <linux/nodemask.h> #include <linux/of.h> #include <linux/sched.h> +#include <linux/sched/topology.h> #include <linux/slab.h> #include <linux/string.h>
arch/arm64/kernel/topology.c +1 -0
@@ -20,6 +20,7 @@#include <linux/nodemask.h> #include <linux/of.h> #include <linux/sched.h> +#include <linux/sched/topology.h> #include <linux/slab.h> #include <linux/string.h> #include <linux/cpufreq.h>
arch/powerpc/kernel/smp.c +1 -0
@@ -20,6 +20,7 @@#include <linux/kernel.h> #include <linux/export.h> #include <linux/sched.h> +#include <linux/sched/topology.h> #include <linux/smp.h> #include <linux/interrupt.h> #include <linux/delay.h>
arch/s390/kernel/topology.c +1 -0
@@ -13,6 +13,7 @@#include <linux/export.h> #include <linux/kernel.h> #include <linux/sched.h> +#include <linux/sched/topology.h> #include <linux/delay.h> #include <linux/init.h> #include <linux/slab.h>
arch/x86/kernel/smpboot.c +1 -0
@@ -45,6 +45,7 @@#include <linux/smp.h> #include <linux/export.h> #include <linux/sched.h> +#include <linux/sched/topology.h> #include <linux/percpu.h> #include <linux/bootmem.h> #include <linux/err.h>
block/blk-mq.c +1 -0
@@ -20,6 +20,7 @@#include <linux/cpu.h> #include <linux/cache.h> #include <linux/sched/sysctl.h> +#include <linux/sched/topology.h> #include <linux/delay.h> #include <linux/crash_dump.h> #include <linux/prefetch.h>
block/blk-softirq.c +1 -0
@@ -9,6 +9,7 @@#include <linux/interrupt.h> #include <linux/cpu.h> #include <linux/sched.h> +#include <linux/sched/topology.h> #include "blk.h"
include/linux/cpuset.h +1 -0
@@ -9,6 +9,7 @@*/ #include <linux/sched.h> +#include <linux/sched/topology.h> #include <linux/cpumask.h> #include <linux/nodemask.h> #include <linux/mm.h>
include/linux/sched.h +0 -212
226 lines not on this page · raw message
include/linux/sched/topology.h new file +217 -0
217 lines not on this page · raw message
kernel/sched/fair.c +2 -0
@@ -21,6 +21,8 @@*/ #include <linux/sched.h> +#include <linux/sched/topology.h> +#include <linux/latencytop.h> #include <linux/cpumask.h> #include <linux/cpuidle.h>
kernel/sched/sched.h +1 -0
@@ -1,6 +1,7 @@#include <linux/sched.h> #include <linux/sched/sysctl.h> +#include <linux/sched/topology.h> #include <linux/sched/rt.h> #include <linux/u64_stats_sync.h> #include <linux/sched/deadline.h>
Signature · 1 line
2.7.4
Ingo Molnar
maintainerPATCH 8/89 sched/idle: Move wake_up_if_idle prototype to <linux/sched/idle.h>
In reply to Ingo MolnarNo need to clutter <linux/sched.h> with this rarely used prototype.
--- include/linux/sched.h | 2 -- include/linux/sched/idle.h | 2 ++ kernel/smp.c | 1 + 3 files changed, 3 insertions(+), 2 deletions(-)
include/linux/sched.h +0 -2
@@ -1011,8 +1011,6 @@ extern void wake_q_add(struct wake_q_head *head, struct task_struct *task);extern void wake_up_q (struct wake_q_head *head); -extern void wake_up_if_idle (int cpu); -struct io_context ;/* See blkdev.h */
include/linux/sched/idle.h +2 -0
@@ -8,4 +8,6 @@ enum cpu_idle_type {CPU_MAX_IDLE_TYPES }; +extern void wake_up_if_idle (int cpu); +#endif /* _LINUX_SCHED_IDLE_H */
kernel/smp.c +1 -0
@@ -17,6 +17,7 @@#include <linux/smp.h> #include <linux/cpu.h> #include <linux/sched.h> +#include <linux/sched/idle.h> #include <linux/hypervisor.h> #include "smpboot.h"
Signature · 1 line
2.7.4
Ingo Molnar
maintainerPATCH 18/89 sched/core: Move task->mm handling methods to <linux/sched/mm.h>
In reply to Ingo MolnarMove the following task->mm helper APIs into a new header file, <linux/sched/mm.h>, to further reduce the size and complexity of <linux/sched.h>:
# mm_alloc():
arch/arm/mach-rpc/ecard.c
fs/exec.c
include/linux/sched/mm.h
kernel/fork.c
# __mmdrop():
arch/arc/include/asm/mmu_context.h
include/linux/sched/mm.h
kernel/fork.c
# mmdrop():
arch/arm/mach-rpc/ecard.c
arch/m68k/sun3/mmu_emu.c
arch/x86/mm/tlb.c
drivers/gpu/drm/amd/amdkfd/kfd_process.c
drivers/gpu/drm/i915/i915_gem_userptr.c
drivers/infiniband/hw/hfi1/file_ops.c
drivers/vfio/vfio_iommu_spapr_tce.c
fs/exec.c
fs/proc/base.c
fs/proc/task_mmu.c
fs/proc/task_nommu.c
fs/userfaultfd.c
include/linux/mmu_notifier.h
include/linux/sched/mm.h
kernel/fork.c
kernel/futex.c
kernel/sched/core.c
mm/khugepaged.c
mm/ksm.c
mm/mmu_context.c
mm/mmu_notifier.c
mm/oom_kill.c
virt/kvm/kvm_main.c
# mmdrop_async_fn():
include/linux/sched/mm.h
# mmdrop_async():
include/linux/sched/mm.h
kernel/fork.c
# mmget_not_zero():
fs/userfaultfd.c
include/linux/sched/mm.h
mm/oom_kill.c
# mmput():
arch/arc/include/asm/mmu_context.h
arch/arc/kernel/troubleshoot.c
arch/frv/mm/mmu-context.c
arch/powerpc/platforms/cell/spufs/context.c
arch/sparc/include/asm/mmu_context_32.h
drivers/android/binder.c
drivers/gpu/drm/etnaviv/etnaviv_gem.c
drivers/gpu/drm/i915/i915_gem_userptr.c
drivers/infiniband/core/umem.c
drivers/infiniband/core/umem_odp.c
drivers/infiniband/core/uverbs_main.c
drivers/infiniband/hw/mlx4/main.c
drivers/infiniband/hw/mlx5/main.c
drivers/infiniband/hw/usnic/usnic_uiom.c
drivers/iommu/amd_iommu_v2.c
drivers/iommu/intel-svm.c
drivers/lguest/lguest_user.c
drivers/misc/cxl/fault.c
drivers/misc/mic/scif/scif_rma.c
drivers/oprofile/buffer_sync.c
drivers/vfio/vfio_iommu_type1.c
drivers/vhost/vhost.c
drivers/xen/gntdev.c
fs/exec.c
fs/proc/array.c
fs/proc/base.c
fs/proc/task_mmu.c
fs/proc/task_nommu.c
fs/userfaultfd.c
include/linux/sched/mm.h
kernel/cpuset.c
kernel/events/core.c
kernel/events/uprobes.c
kernel/exit.c
kernel/fork.c
kernel/ptrace.c
kernel/sys.c
kernel/trace/trace_output.c
kernel/tsacct.c
mm/memcontrol.c
mm/memory.c
mm/mempolicy.c
mm/migrate.c
mm/mmu_notifier.c
mm/nommu.c
mm/oom_kill.c
mm/process_vm_access.c
mm/rmap.c
mm/swapfile.c
mm/util.c
virt/kvm/async_pf.c
# mmput_async():
include/linux/sched/mm.h
kernel/fork.c
mm/oom_kill.c
# get_task_mm():
arch/arc/kernel/troubleshoot.c
arch/powerpc/platforms/cell/spufs/context.c
drivers/android/binder.c
drivers/gpu/drm/etnaviv/etnaviv_gem.c
drivers/infiniband/core/umem.c
drivers/infiniband/core/umem_odp.c
drivers/infiniband/hw/mlx4/main.c
drivers/infiniband/hw/mlx5/main.c
drivers/infiniband/hw/usnic/usnic_uiom.c
drivers/iommu/amd_iommu_v2.c
drivers/iommu/intel-svm.c
drivers/lguest/lguest_user.c
drivers/misc/cxl/fault.c
drivers/misc/mic/scif/scif_rma.c
drivers/oprofile/buffer_sync.c
drivers/vfio/vfio_iommu_type1.c
drivers/vhost/vhost.c
drivers/xen/gntdev.c
fs/proc/array.c
fs/proc/base.c
fs/proc/task_mmu.c
include/linux/sched/mm.h
kernel/cpuset.c
kernel/events/core.c
kernel/exit.c
kernel/fork.c
kernel/ptrace.c
kernel/sys.c
kernel/trace/trace_output.c
kernel/tsacct.c
mm/memcontrol.c
mm/memory.c
mm/mempolicy.c
mm/migrate.c
mm/mmu_notifier.c
mm/nommu.c
mm/util.c
# mm_access():
fs/proc/base.c
include/linux/sched/mm.h
kernel/fork.c
mm/process_vm_access.c
# mm_release():
arch/arc/include/asm/mmu_context.h
fs/exec.c
include/linux/sched/mm.h
include/uapi/linux/sched.h
kernel/exit.c
kernel/fork.c
--- arch/arc/include/asm/mmu_context.h | 1 + arch/arc/kernel/troubleshoot.c | 2 ++ arch/arm/mach-rpc/ecard.c | 1 + arch/frv/mm/mmu-context.c | 1 + arch/m68k/sun3/mmu_emu.c | 1 + arch/powerpc/platforms/cell/spufs/context.c | 2 ++ drivers/android/binder.c | 1 + drivers/gpu/drm/amd/amdkfd/kfd_process.c | 1 + drivers/gpu/drm/etnaviv/etnaviv_gem.c | 1 + drivers/gpu/drm/i915/i915_gem_userptr.c | 1 + drivers/infiniband/core/umem.c | 1 + drivers/infiniband/core/umem_odp.c | 1 + drivers/infiniband/hw/hfi1/file_ops.c | 1 + drivers/infiniband/hw/mlx4/main.c | 2 ++ drivers/infiniband/hw/mlx5/main.c | 1 + drivers/infiniband/hw/usnic/usnic_uiom.c | 1 + drivers/iommu/amd_iommu_v2.c | 1 + drivers/iommu/intel-svm.c | 1 + drivers/lguest/lguest_user.c | 1 + drivers/misc/cxl/fault.c | 1 + drivers/misc/mic/scif/scif_rma.c | 2 ++ drivers/oprofile/buffer_sync.c | 1 + drivers/vfio/vfio_iommu_spapr_tce.c | 2 ++ drivers/vfio/vfio_iommu_type1.c | 1 + drivers/vhost/vhost.c | 1 + drivers/xen/gntdev.c | 1 + fs/exec.c | 1 + fs/proc/array.c | 1 + fs/proc/base.c | 1 + fs/proc/task_mmu.c | 1 + fs/proc/task_nommu.c | 2 ++ fs/userfaultfd.c | 1 + include/linux/sched.h | 52 ------------------------------------------- include/linux/sched/mm.h | 59 +++++++++++++++++++++++++++++++++++++++++++++++++ kernel/cpuset.c | 1 + kernel/events/core.c | 1 + kernel/events/uprobes.c | 1 + kernel/exit.c | 1 + kernel/fork.c | 1 + kernel/futex.c | 1 + kernel/ptrace.c | 1 + kernel/sched/sched.h | 1 + kernel/sys.c | 1 + kernel/trace/trace_output.c | 1 + kernel/tsacct.c | 1 + mm/khugepaged.c | 1 + mm/ksm.c | 1 + mm/memcontrol.c | 1 + mm/memory.c | 1 + mm/mempolicy.c | 1 + mm/migrate.c | 1 + mm/mmu_context.c | 1 + mm/mmu_notifier.c | 1 + mm/nommu.c | 1 + mm/oom_kill.c | 1 + mm/process_vm_access.c | 1 + mm/rmap.c | 1 + mm/swapfile.c | 1 + mm/util.c | 1 + virt/kvm/async_pf.c | 1 + virt/kvm/kvm_main.c | 1 + 61 files changed, 124 insertions(+), 52 deletions(-)
arch/arc/include/asm/mmu_context.h +1 -0
@@ -20,6 +20,7 @@#include <asm/arcregs.h> #include <asm/tlb.h> +#include <linux/sched/mm.h> #include <asm-generic/mm_hooks.h>
arch/arc/kernel/troubleshoot.c +2 -0
@@ -13,6 +13,8 @@#include <linux/fs_struct.h> #include <linux/proc_fs.h> #include <linux/file.h> +#include <linux/sched/mm.h> +#include <asm/arcregs.h> #include <asm/irqflags.h>
arch/arm/mach-rpc/ecard.c +1 -0
@@ -31,6 +31,7 @@#include <linux/kernel.h> #include <linux/types.h> #include <linux/sched.h> +#include <linux/sched/mm.h> #include <linux/interrupt.h> #include <linux/completion.h> #include <linux/reboot.h>
arch/frv/mm/mmu-context.c +1 -0
@@ -10,6 +10,7 @@*/ #include <linux/sched.h> +#include <linux/sched/mm.h> #include <linux/mm.h> #include <asm/tlbflush.h>
arch/m68k/sun3/mmu_emu.c +1 -0
@@ -15,6 +15,7 @@#include <linux/bootmem.h> #include <linux/bitops.h> #include <linux/module.h> +#include <linux/sched/mm.h> #include <asm/setup.h> #include <asm/traps.h>
arch/powerpc/platforms/cell/spufs/context.c +2 -0
@@ -25,6 +25,8 @@#include <linux/slab.h> #include <linux/atomic.h> #include <linux/sched.h> +#include <linux/sched/mm.h> +#include <asm/spu.h> #include <asm/spu_csa.h> #include "spufs.h"
drivers/android/binder.c +1 -0
@@ -32,6 +32,7 @@#include <linux/debugfs.h> #include <linux/rbtree.h> #include <linux/sched.h> +#include <linux/sched/mm.h> #include <linux/seq_file.h> #include <linux/uaccess.h> #include <linux/vmalloc.h>
drivers/gpu/drm/amd/amdkfd/kfd_process.c +1 -0
@@ -23,6 +23,7 @@#include <linux/mutex.h> #include <linux/log2.h> #include <linux/sched.h> +#include <linux/sched/mm.h> #include <linux/slab.h> #include <linux/amd-iommu.h> #include <linux/notifier.h>
drivers/gpu/drm/etnaviv/etnaviv_gem.c +1 -0
@@ -16,6 +16,7 @@#include <linux/spinlock.h> #include <linux/shmem_fs.h> +#include <linux/sched/mm.h> #include "etnaviv_drv.h" #include "etnaviv_gem.h"
drivers/gpu/drm/i915/i915_gem_userptr.c +1 -0
@@ -31,6 +31,7 @@#include <linux/mmu_notifier.h> #include <linux/mempolicy.h> #include <linux/swap.h> +#include <linux/sched/mm.h> struct i915_mm_struct {struct mm_struct *mm;
drivers/infiniband/core/umem.c +1 -0
@@ -35,6 +35,7 @@#include <linux/mm.h> #include <linux/dma-mapping.h> #include <linux/sched.h> +#include <linux/sched/mm.h> #include <linux/export.h> #include <linux/hugetlb.h> #include <linux/slab.h>
drivers/infiniband/core/umem_odp.c +1 -0
@@ -32,6 +32,7 @@#include <linux/types.h> #include <linux/sched.h> +#include <linux/sched/mm.h> #include <linux/pid.h> #include <linux/slab.h> #include <linux/export.h>
drivers/infiniband/hw/hfi1/file_ops.c +1 -0
@@ -48,6 +48,7 @@#include <linux/cdev.h> #include <linux/vmalloc.h> #include <linux/io.h> +#include <linux/sched/mm.h> #include <rdma/ib.h>
drivers/infiniband/hw/mlx4/main.c +2 -0
@@ -39,6 +39,8 @@#include <linux/inetdevice.h> #include <linux/rtnetlink.h> #include <linux/if_vlan.h> +#include <linux/sched/mm.h> +#include <net/ipv6.h> #include <net/addrconf.h> #include <net/devlink.h>
drivers/infiniband/hw/mlx5/main.c +1 -0
@@ -41,6 +41,7 @@#include <asm/pat.h> #endif #include <linux/sched.h> +#include <linux/sched/mm.h> #include <linux/delay.h> #include <rdma/ib_user_verbs.h> #include <rdma/ib_addr.h>
drivers/infiniband/hw/usnic/usnic_uiom.c +1 -0
@@ -35,6 +35,7 @@#include <linux/mm.h> #include <linux/dma-mapping.h> #include <linux/sched.h> +#include <linux/sched/mm.h> #include <linux/hugetlb.h> #include <linux/iommu.h> #include <linux/workqueue.h>
drivers/iommu/amd_iommu_v2.c +1 -0
@@ -22,6 +22,7 @@#include <linux/profile.h> #include <linux/module.h> #include <linux/sched.h> +#include <linux/sched/mm.h> #include <linux/iommu.h> #include <linux/wait.h> #include <linux/pci.h>
drivers/iommu/intel-svm.c +1 -0
@@ -16,6 +16,7 @@#include <linux/intel-iommu.h> #include <linux/mmu_notifier.h> #include <linux/sched.h> +#include <linux/sched/mm.h> #include <linux/slab.h> #include <linux/intel-svm.h> #include <linux/rculist.h>
drivers/lguest/lguest_user.c +1 -0
@@ -8,6 +8,7 @@#include <linux/miscdevice.h> #include <linux/fs.h> #include <linux/sched.h> +#include <linux/sched/mm.h> #include <linux/file.h> #include <linux/slab.h> #include <linux/export.h>
drivers/misc/cxl/fault.c +1 -0
@@ -9,6 +9,7 @@#include <linux/workqueue.h> #include <linux/sched.h> +#include <linux/sched/mm.h> #include <linux/pid.h> #include <linux/mm.h> #include <linux/moduleparam.h>
drivers/misc/mic/scif/scif_rma.c +2 -0
@@ -17,6 +17,8 @@*/ #include <linux/dma_remapping.h> #include <linux/pagemap.h> +#include <linux/sched/mm.h> +#include "scif_main.h" #include "scif_map.h"
drivers/oprofile/buffer_sync.c +1 -0
@@ -31,6 +31,7 @@#include <linux/fs.h> #include <linux/oprofile.h> #include <linux/sched.h> +#include <linux/sched/mm.h> #include <linux/gfp.h> #include "oprofile_stats.h"
drivers/vfio/vfio_iommu_spapr_tce.c +2 -0
@@ -20,6 +20,8 @@#include <linux/err.h> #include <linux/vfio.h> #include <linux/vmalloc.h> +#include <linux/sched/mm.h> +#include <asm/iommu.h> #include <asm/tce.h> #include <asm/mmu_context.h>
drivers/vfio/vfio_iommu_type1.c +1 -0
@@ -32,6 +32,7 @@#include <linux/mm.h> #include <linux/rbtree.h> #include <linux/sched.h> +#include <linux/sched/mm.h> #include <linux/slab.h> #include <linux/uaccess.h> #include <linux/vfio.h>
drivers/vhost/vhost.c +1 -0
@@ -27,6 +27,7 @@#include <linux/cgroup.h> #include <linux/module.h> #include <linux/sort.h> +#include <linux/sched/mm.h> #include <linux/interval_tree_generic.h> #include "vhost.h"
drivers/xen/gntdev.c +1 -0
@@ -32,6 +32,7 @@#include <linux/types.h> #include <linux/uaccess.h> #include <linux/sched.h> +#include <linux/sched/mm.h> #include <linux/spinlock.h> #include <linux/slab.h> #include <linux/highmem.h>
fs/exec.c +1 -0
@@ -32,6 +32,7 @@#include <linux/swap.h> #include <linux/string.h> #include <linux/init.h> +#include <linux/sched/mm.h> #include <linux/pagemap.h> #include <linux/perf_event.h> #include <linux/highmem.h>
fs/proc/array.c +1 -0
@@ -60,6 +60,7 @@#include <linux/tty.h> #include <linux/string.h> #include <linux/mman.h> +#include <linux/sched/mm.h> #include <linux/proc_fs.h> #include <linux/ioport.h> #include <linux/uaccess.h>
fs/proc/base.c +1 -0
@@ -86,6 +86,7 @@#include <linux/fs_struct.h> #include <linux/slab.h> #include <linux/sched/autogroup.h> +#include <linux/sched/mm.h> #include <linux/flex_array.h> #include <linux/posix-timers.h> #ifdef CONFIG_HARDWALL
fs/proc/task_mmu.c +1 -0
@@ -11,6 +11,7 @@#include <linux/mempolicy.h> #include <linux/rmap.h> #include <linux/swap.h> +#include <linux/sched/mm.h> #include <linux/swapops.h> #include <linux/mmu_notifier.h> #include <linux/page_idle.h>
fs/proc/task_nommu.c +2 -0
@@ -7,6 +7,8 @@#include <linux/ptrace.h> #include <linux/slab.h> #include <linux/seq_file.h> +#include <linux/sched/mm.h> +#include "internal.h" /*
fs/userfaultfd.c +1 -0
@@ -14,6 +14,7 @@#include <linux/hashtable.h> #include <linux/sched.h> +#include <linux/sched/mm.h> #include <linux/mm.h> #include <linux/poll.h> #include <linux/slab.h>
include/linux/sched.h +0 -52
58 lines not on this page · raw message
include/linux/sched/mm.h new file +59 -0
59 lines not on this page · raw message
kernel/cpuset.c +1 -0
@@ -44,6 +44,7 @@#include <linux/proc_fs.h> #include <linux/rcupdate.h> #include <linux/sched.h> +#include <linux/sched/mm.h> #include <linux/seq_file.h> #include <linux/security.h> #include <linux/slab.h>
kernel/events/core.c +1 -0
@@ -47,6 +47,7 @@#include <linux/namei.h> #include <linux/parser.h> #include <linux/sched/clock.h> +#include <linux/sched/mm.h> #include "internal.h"
kernel/events/uprobes.c +1 -0
@@ -27,6 +27,7 @@#include <linux/pagemap.h> /* read_mapping_page */ #include <linux/slab.h> #include <linux/sched.h> +#include <linux/sched/mm.h> #include <linux/export.h> #include <linux/rmap.h> /* anon_vma_prepare */ #include <linux/mmu_notifier.h> /* set_pte_at_notify */
kernel/exit.c +1 -0
@@ -7,6 +7,7 @@#include <linux/mm.h> #include <linux/slab.h> #include <linux/sched/autogroup.h> +#include <linux/sched/mm.h> #include <linux/interrupt.h> #include <linux/module.h> #include <linux/capability.h>
kernel/fork.c +1 -0
@@ -13,6 +13,7 @@#include <linux/slab.h> #include <linux/sched/autogroup.h> +#include <linux/sched/mm.h> #include <linux/init.h> #include <linux/unistd.h> #include <linux/module.h>
kernel/futex.c +1 -0
@@ -62,6 +62,7 @@#include <linux/ptrace.h> #include <linux/sched/rt.h> #include <linux/sched/wake_q.h> +#include <linux/sched/mm.h> #include <linux/hugetlb.h> #include <linux/freezer.h> #include <linux/bootmem.h>
kernel/ptrace.c +1 -0
@@ -10,6 +10,7 @@#include <linux/capability.h> #include <linux/export.h> #include <linux/sched.h> +#include <linux/sched/mm.h> #include <linux/errno.h> #include <linux/mm.h> #include <linux/highmem.h>
kernel/sched/sched.h +1 -0
@@ -5,6 +5,7 @@#include <linux/sched/rt.h> #include <linux/sched/clock.h> #include <linux/sched/wake_q.h> +#include <linux/sched/mm.h> #include <linux/u64_stats_sync.h> #include <linux/sched/deadline.h> #include <linux/kernel_stat.h>
kernel/sys.c +1 -0
@@ -51,6 +51,7 @@#include <linux/sched.h> #include <linux/sched/autogroup.h> #include <linux/sched/loadavg.h> +#include <linux/sched/mm.h> #include <linux/rcupdate.h> #include <linux/uidgid.h> #include <linux/cred.h>
kernel/trace/trace_output.c +1 -0
@@ -9,6 +9,7 @@#include <linux/mutex.h> #include <linux/ftrace.h> #include <linux/sched/clock.h> +#include <linux/sched/mm.h> #include "trace_output.h"
kernel/tsacct.c +1 -0
@@ -18,6 +18,7 @@#include <linux/kernel.h> #include <linux/sched.h> +#include <linux/sched/mm.h> #include <linux/tsacct_kern.h> #include <linux/acct.h> #include <linux/jiffies.h>
mm/khugepaged.c +1 -0
@@ -2,6 +2,7 @@#include <linux/mm.h> #include <linux/sched.h> +#include <linux/sched/mm.h> #include <linux/mmu_notifier.h> #include <linux/rmap.h> #include <linux/swap.h>
mm/ksm.c +1 -0
@@ -19,6 +19,7 @@#include <linux/fs.h> #include <linux/mman.h> #include <linux/sched.h> +#include <linux/sched/mm.h> #include <linux/rwsem.h> #include <linux/pagemap.h> #include <linux/rmap.h>
mm/memcontrol.c +1 -0
@@ -35,6 +35,7 @@#include <linux/memcontrol.h> #include <linux/cgroup.h> #include <linux/mm.h> +#include <linux/sched/mm.h> #include <linux/hugetlb.h> #include <linux/pagemap.h> #include <linux/smp.h>
mm/memory.c +1 -0
@@ -40,6 +40,7 @@#include <linux/kernel_stat.h> #include <linux/mm.h> +#include <linux/sched/mm.h> #include <linux/hugetlb.h> #include <linux/mman.h> #include <linux/swap.h>
mm/mempolicy.c +1 -0
@@ -73,6 +73,7 @@#include <linux/hugetlb.h> #include <linux/kernel.h> #include <linux/sched.h> +#include <linux/sched/mm.h> #include <linux/nodemask.h> #include <linux/cpuset.h> #include <linux/slab.h>
mm/migrate.c +1 -0
@@ -40,6 +40,7 @@#include <linux/mmu_notifier.h> #include <linux/page_idle.h> #include <linux/page_owner.h> +#include <linux/sched/mm.h> #include <asm/tlbflush.h>
mm/mmu_context.c +1 -0
@@ -5,6 +5,7 @@#include <linux/mm.h> #include <linux/sched.h> +#include <linux/sched/mm.h> #include <linux/mmu_context.h> #include <linux/export.h>
mm/mmu_notifier.c +1 -0
@@ -17,6 +17,7 @@#include <linux/srcu.h> #include <linux/rcupdate.h> #include <linux/sched.h> +#include <linux/sched/mm.h> #include <linux/slab.h> /* global SRCU for all MMs */
mm/nommu.c +1 -0
@@ -17,6 +17,7 @@#include <linux/export.h> #include <linux/mm.h> +#include <linux/sched/mm.h> #include <linux/vmacache.h> #include <linux/mman.h> #include <linux/swap.h>
mm/oom_kill.c +1 -0
@@ -22,6 +22,7 @@#include <linux/err.h> #include <linux/gfp.h> #include <linux/sched.h> +#include <linux/sched/mm.h> #include <linux/swap.h> #include <linux/timex.h> #include <linux/jiffies.h>
mm/process_vm_access.c +1 -0
@@ -12,6 +12,7 @@#include <linux/mm.h> #include <linux/uio.h> #include <linux/sched.h> +#include <linux/sched/mm.h> #include <linux/highmem.h> #include <linux/ptrace.h> #include <linux/slab.h>
mm/rmap.c +1 -0
@@ -46,6 +46,7 @@*/ #include <linux/mm.h> +#include <linux/sched/mm.h> #include <linux/pagemap.h> #include <linux/swap.h> #include <linux/swapops.h>
mm/swapfile.c +1 -0
@@ -6,6 +6,7 @@*/ #include <linux/mm.h> +#include <linux/sched/mm.h> #include <linux/hugetlb.h> #include <linux/mman.h> #include <linux/slab.h>
mm/util.c +1 -0
@@ -5,6 +5,7 @@#include <linux/export.h> #include <linux/err.h> #include <linux/sched.h> +#include <linux/sched/mm.h> #include <linux/security.h> #include <linux/swap.h> #include <linux/swapops.h>
virt/kvm/async_pf.c +1 -0
@@ -24,6 +24,7 @@#include <linux/slab.h> #include <linux/module.h> #include <linux/mmu_context.h> +#include <linux/sched/mm.h> #include "async_pf.h" #include <trace/events/kvm.h>
virt/kvm/kvm_main.c +1 -0
@@ -33,6 +33,7 @@#include <linux/syscore_ops.h> #include <linux/cpu.h> #include <linux/sched.h> +#include <linux/sched/mm.h> #include <linux/cpumask.h> #include <linux/smp.h> #include <linux/anon_inodes.h>
Signature · 1 line
2.7.4
Ingo Molnar
maintainerPATCH 24/89 sched/headers: Remove #include <linux/capability.h> from <linux/sched.h>
In reply to Ingo MolnarThe <linux/sched.h> header does not actually make use of any types or APIs defined in <linux/capability.h>, so remove its inclusion.
--- include/linux/sched.h | 1 - 1 file changed, 1 deletion(-)
include/linux/sched.h +0 -1
@@ -7,7 +7,6 @@#include <asm/param.h> /* for HZ */ -#include <linux/capability.h> #include <linux/threads.h> #include <linux/kernel.h> #include <linux/types.h>
Signature · 1 line
2.7.4
Ingo Molnar
maintainerPATCH 23/89 sched/headers, softlockup: Move softlockup detector watchdog methods to <linux/nmi.h>
In reply to Ingo MolnarThese methods don't belong into <linux/sched.h>, they are neither directly related to task_struct or are scheduler functionality.
Put them next to the other watchdog methods in <linux/nmi.h>.
( Arguably that header's name is a misnomer, and this patch makes it
more so - but it should be renamed in another patch. )
--- arch/ia64/kernel/time.c | 1 + arch/ia64/kernel/uncached.c | 1 + arch/powerpc/kernel/swsusp_64.c | 1 + arch/x86/kernel/pvclock.c | 2 ++ arch/x86/xen/smp.c | 1 + drivers/ide/ide-taskfile.c | 1 + drivers/mtd/nand/nand_base.c | 1 + drivers/video/fbdev/nvidia/nv_accel.c | 2 ++ include/linux/nmi.h | 37 +++++++++++++++++++++++++++++++++++++ include/linux/sched.h | 37 ------------------------------------- init/main.c | 1 + kernel/debug/debug_core.c | 1 + kernel/power/hibernate.c | 1 + kernel/power/snapshot.c | 1 + kernel/sched/clock.c | 1 + kernel/time/tick-sched.c | 1 + kernel/time/timekeeping.c | 1 + 17 files changed, 54 insertions(+), 37 deletions(-)
arch/ia64/kernel/time.c +1 -0
@@ -16,6 +16,7 @@#include <linux/profile.h> #include <linux/sched.h> #include <linux/time.h> +#include <linux/nmi.h> #include <linux/interrupt.h> #include <linux/efi.h> #include <linux/timex.h>
arch/ia64/kernel/uncached.c +1 -0
@@ -19,6 +19,7 @@#include <linux/errno.h> #include <linux/string.h> #include <linux/efi.h> +#include <linux/nmi.h> #include <linux/genalloc.h> #include <linux/gfp.h> #include <asm/page.h>
arch/powerpc/kernel/swsusp_64.c +1 -0
@@ -10,6 +10,7 @@#include <linux/irq.h> #include <linux/sched.h> #include <linux/interrupt.h> +#include <linux/nmi.h> void do_after_copyback (void ) {
arch/x86/kernel/pvclock.c +2 -0
@@ -21,6 +21,8 @@#include <linux/sched.h> #include <linux/gfp.h> #include <linux/bootmem.h> +#include <linux/nmi.h> +#include <asm/fixmap.h> #include <asm/pvclock.h>
arch/x86/xen/smp.c +1 -0
@@ -18,6 +18,7 @@#include <linux/smp.h> #include <linux/irq_work.h> #include <linux/tick.h> +#include <linux/nmi.h> #include <asm/paravirt.h> #include <asm/desc.h>
drivers/ide/ide-taskfile.c +1 -0
@@ -19,6 +19,7 @@#include <linux/delay.h> #include <linux/hdreg.h> #include <linux/ide.h> +#include <linux/nmi.h> #include <linux/scatterlist.h> #include <linux/uaccess.h>
drivers/mtd/nand/nand_base.c +1 -0
@@ -36,6 +36,7 @@#include <linux/sched.h> #include <linux/slab.h> #include <linux/mm.h> +#include <linux/nmi.h> #include <linux/types.h> #include <linux/mtd/mtd.h> #include <linux/mtd/nand.h>
drivers/video/fbdev/nvidia/nv_accel.c +2 -0
@@ -48,6 +48,8 @@*/ #include <linux/fb.h> +#include <linux/nmi.h> +#include "nv_type.h" #include "nv_proto.h" #include "nv_dma.h"
include/linux/nmi.h +37 -0
@@ -7,6 +7,43 @@#include <linux/sched.h> #include <asm/irq.h> +#ifdef CONFIG_LOCKUP_DETECTOR +extern void touch_softlockup_watchdog_sched (void ); +extern void touch_softlockup_watchdog (void ); +extern void touch_softlockup_watchdog_sync (void ); +extern void touch_all_softlockup_watchdogs (void ); +extern int proc_dowatchdog_thresh (struct ctl_table *table,int write, +void __user *buffer, +size_t *lenp,loff_t *ppos); +extern unsigned int softlockup_panic; +extern unsigned int hardlockup_panic; +void lockup_detector_init (void ); +#else +static inline void touch_softlockup_watchdog_sched (void ) +{ +} +static inline void touch_softlockup_watchdog (void ) +{ +} +static inline void touch_softlockup_watchdog_sync (void ) +{ +} +static inline void touch_all_softlockup_watchdogs (void ) +{ +} +static inline void lockup_detector_init (void ) +{ +} +#endif + +#ifdef CONFIG_DETECT_HUNG_TASK +void reset_hung_task_detector (void ); +#else +static inline void reset_hung_task_detector (void ) +{ +} +#endif +/* * The run state of the lockup detectors is controlled by the content of the * 'watchdog_enabled' variable. Each lockup detector has its dedicated bit -
include/linux/sched.h +0 -37
@@ -290,43 +290,6 @@ extern int sched_cpu_dying(unsigned int cpu);extern void sched_show_task (struct task_struct *p); -#ifdef CONFIG_LOCKUP_DETECTOR -extern void touch_softlockup_watchdog_sched (void ); -extern void touch_softlockup_watchdog (void ); -extern void touch_softlockup_watchdog_sync (void ); -extern void touch_all_softlockup_watchdogs (void ); -extern int proc_dowatchdog_thresh (struct ctl_table *table,int write, -void __user *buffer, -size_t *lenp,loff_t *ppos); -extern unsigned int softlockup_panic; -extern unsigned int hardlockup_panic; -void lockup_detector_init (void ); -#else -static inline void touch_softlockup_watchdog_sched (void ) -{ -} -static inline void touch_softlockup_watchdog (void ) -{ -} -static inline void touch_softlockup_watchdog_sync (void ) -{ -} -static inline void touch_all_softlockup_watchdogs (void ) -{ -} -static inline void lockup_detector_init (void ) -{ -} -#endif - -#ifdef CONFIG_DETECT_HUNG_TASK -void reset_hung_task_detector (void ); -#else -static inline void reset_hung_task_detector (void ) -{ -} -#endif -/* Attach to any functions which should be ignored in wchan output. */ #define __sched __attribute__((__section__(".sched.text")))
init/main.c +1 -0
@@ -26,6 +26,7 @@#include <linux/bootmem.h> #include <linux/acpi.h> #include <linux/tty.h> +#include <linux/nmi.h> #include <linux/percpu.h> #include <linux/kmod.h> #include <linux/vmalloc.h>
kernel/debug/debug_core.c +1 -0
@@ -49,6 +49,7 @@#include <linux/init.h> #include <linux/kgdb.h> #include <linux/kdb.h> +#include <linux/nmi.h> #include <linux/pid.h> #include <linux/smp.h> #include <linux/mm.h>
kernel/power/hibernate.c +1 -0
@@ -21,6 +21,7 @@#include <linux/fs.h> #include <linux/mount.h> #include <linux/pm.h> +#include <linux/nmi.h> #include <linux/console.h> #include <linux/cpu.h> #include <linux/freezer.h>
kernel/power/snapshot.c +1 -0
@@ -22,6 +22,7 @@#include <linux/device.h> #include <linux/init.h> #include <linux/bootmem.h> +#include <linux/nmi.h> #include <linux/syscalls.h> #include <linux/console.h> #include <linux/highmem.h>
kernel/sched/clock.c +1 -0
@@ -58,6 +58,7 @@#include <linux/percpu.h> #include <linux/ktime.h> #include <linux/sched.h> +#include <linux/nmi.h> #include <linux/sched/clock.h> #include <linux/static_key.h> #include <linux/workqueue.h>
kernel/time/tick-sched.c +1 -0
@@ -17,6 +17,7 @@#include <linux/interrupt.h> #include <linux/kernel_stat.h> #include <linux/percpu.h> +#include <linux/nmi.h> #include <linux/profile.h> #include <linux/sched/signal.h> #include <linux/sched/clock.h>
kernel/time/timekeeping.c +1 -0
@@ -14,6 +14,7 @@#include <linux/percpu.h> #include <linux/init.h> #include <linux/mm.h> +#include <linux/nmi.h> #include <linux/sched.h> #include <linux/sched/loadavg.h> #include <linux/syscore_ops.h>
Signature · 1 line
2.7.4
Ingo Molnar
maintainerPATCH 25/89 sched/headers, cgroups: Remove the threadgroup_change_*() wrappery
In reply to Ingo Molnarthreadgroup_change_begin()/end() is a pointless wrapper around cgroup_threadgroup_change_begin()/end(), minus a might_sleep() in the !CONFIG_CGROUPS=y case.
Remove the wrappery, move the might_sleep() (the down_read() already has a might_sleep() check).
This debloats <linux/sched.h> a bit and simplifies this API.
Update all call sites.
No change in functionality.
--- fs/exec.c | 6 +++--- include/linux/cgroup-defs.h | 13 ++++++++----- include/linux/sched.h | 28 ---------------------------- kernel/cgroup_pids.c | 2 +- kernel/fork.c | 6 +++--- kernel/signal.c | 6 +++--- 6 files changed, 18 insertions(+), 43 deletions(-)
fs/exec.c +3 -3
@@ -1091,7 +1091,7 @@ static int de_thread(struct task_struct *tsk)struct task_struct *leader = tsk->group_leader;for (;;) { -threadgroup_change_begin (tsk); +cgroup_threadgroup_change_begin (tsk);write_lock_irq (&tasklist_lock);/* * Do this under tasklist_lock to ensure that
@@ -1102,7 +1102,7 @@ static int de_thread(struct task_struct *tsk)break ;__set_current_state (TASK_KILLABLE );write_unlock_irq (&tasklist_lock); -threadgroup_change_end (tsk); +cgroup_threadgroup_change_end (tsk);schedule ();if (unlikely (__fatal_signal_pending (tsk))) goto killed;
@@ -1160,7 +1160,7 @@ static int de_thread(struct task_struct *tsk)if (unlikely (leader->ptrace))__wake_up_parent (leader, leader->parent);write_unlock_irq (&tasklist_lock); -threadgroup_change_end (tsk); +cgroup_threadgroup_change_end (tsk);release_task (leader); }
include/linux/cgroup-defs.h +8 -5
@@ -528,8 +528,8 @@ extern struct percpu_rw_semaphore cgroup_threadgroup_rwsem;* cgroup_threadgroup_change_begin - threadgroup exclusion for cgroups * @tsk: target task * -* Called from threadgroup_change_begin() and allows cgroup operations to -* synchronize against threadgroup changes using a percpu_rw_semaphore. +* Allows cgroup operations to synchronize against threadgroup changes +* using a percpu_rw_semaphore. */ static inline void cgroup_threadgroup_change_begin (struct task_struct *tsk) {
@@ -540,8 +540,7 @@ static inline void cgroup_threadgroup_change_begin(struct task_struct *tsk)* cgroup_threadgroup_change_end - threadgroup exclusion for cgroups * @tsk: target task * -* Called from threadgroup_change_end(). Counterpart of -* cgroup_threadcgroup_change_begin(). +* Counterpart of cgroup_threadcgroup_change_begin(). */ static inline void cgroup_threadgroup_change_end (struct task_struct *tsk) {
@@ -552,7 +551,11 @@ static inline void cgroup_threadgroup_change_end(struct task_struct *tsk)#define CGROUP_SUBSYS_COUNT 0 -static inline void cgroup_threadgroup_change_begin (struct task_struct *tsk) {} +static inline void cgroup_threadgroup_change_begin (struct task_struct *tsk) +{ +might_sleep (); +} +static inline void cgroup_threadgroup_change_end (struct task_struct *tsk) {}#endif /* CONFIG_CGROUPS */
include/linux/sched.h +0 -28
@@ -1933,34 +1933,6 @@ static inline void task_unlock(struct task_struct *p)spin_unlock (&p->alloc_lock); } -/** -* threadgroup_change_begin - mark the beginning of changes to a threadgroup -* @tsk: task causing the changes -* -* All operations which modify a threadgroup - a new thread joining the -* group, death of a member thread (the assertion of PF_EXITING) and -* exec(2) dethreading the process and replacing the leader - are wrapped -* by threadgroup_change_{begin|end}(). This is to provide a place which -* subsystems needing threadgroup stability can hook into for -* synchronization. -*/ -static inline void threadgroup_change_begin (struct task_struct *tsk) -{ -might_sleep (); -cgroup_threadgroup_change_begin (tsk); -} - -/** -* threadgroup_change_end - mark the end of changes to a threadgroup -* @tsk: task causing the changes -* -* See threadgroup_change_begin(). -*/ -static inline void threadgroup_change_end (struct task_struct *tsk) -{ -cgroup_threadgroup_change_end (tsk); -} -#ifdef CONFIG_THREAD_INFO_IN_TASK static inline struct thread_info *task_thread_info (struct task_struct *task)
kernel/cgroup_pids.c +1 -1
@@ -214,7 +214,7 @@ static void pids_cancel_attach(struct cgroup_taskset *tset)/* * task_css_check(true) in pids_can_fork() and pids_cancel_fork() relies -* on threadgroup_change_begin() held by the copy_process(). +* on cgroup_threadgroup_change_begin() held by the copy_process(). */ static int pids_can_fork (struct task_struct *task) {
kernel/fork.c +3 -3
@@ -1749,7 +1749,7 @@ static __latent_entropy struct task_struct *copy_process(INIT_LIST_HEAD (&p->thread_group); p->task_works =NULL ; -threadgroup_change_begin (current); +cgroup_threadgroup_change_begin (current);/* * Ensure that the cgroup subsystem policies allow the new process to be * forked. It should be noted the the new process's css_set can be changed
@@ -1839,7 +1839,7 @@ static __latent_entropy struct task_struct *copy_process(proc_fork_connector (p);cgroup_post_fork (p); -threadgroup_change_end (current); +cgroup_threadgroup_change_end (current);perf_event_fork (p);trace_task_newtask (p, clone_flags);
@@ -1850,7 +1850,7 @@ static __latent_entropy struct task_struct *copy_process( bad_fork_cancel_cgroup:cgroup_cancel_fork (p); bad_fork_free_pid: -threadgroup_change_end (current); +cgroup_threadgroup_change_end (current);if (pid != &init_struct_pid)free_pid (pid); bad_fork_cleanup_thread:
kernel/signal.c +3 -3
@@ -2396,11 +2396,11 @@ void exit_signals(struct task_struct *tsk)* @tsk is about to have PF_EXITING set - lock out users which * expect stable threadgroup. */ -threadgroup_change_begin (tsk); +cgroup_threadgroup_change_begin (tsk);if (thread_group_empty (tsk) ||signal_group_exit (tsk->signal)) { tsk->flags |=PF_EXITING ; -threadgroup_change_end (tsk); +cgroup_threadgroup_change_end (tsk);return ; }
@@ -2411,7 +2411,7 @@ void exit_signals(struct task_struct *tsk)*/ tsk->flags |=PF_EXITING ; -threadgroup_change_end (tsk); +cgroup_threadgroup_change_end (tsk);if (!signal_pending (tsk)) goto out;
Signature · 1 line
2.7.4
Ingo Molnar
maintainerPATCH 33/89 sched/headers: Move the JOBCTL_ defines and methods from <linux/sched.h> to <linux/sched/jobctl.h>
In reply to Ingo MolnarOnly a small fraction of sched.h users actually utilizes these defines, and they are not scheduler functionality in any case, so move them into their separate header.
--- include/linux/sched.h | 30 ------------------------------ include/linux/sched/jobctl.h | 32 ++++++++++++++++++++++++++++++++ include/linux/sched/signal.h | 1 + 3 files changed, 33 insertions(+), 30 deletions(-)
include/linux/sched.h +0 -30
@@ -1552,36 +1552,6 @@ TASK_PFA_CLEAR(SPREAD_SLAB, spread_slab) TASK_PFA_TEST(LMK_WAITING, lmk_waiting) TASK_PFA_SET(LMK_WAITING, lmk_waiting) -/* -* task->jobctl flags - */ -#define JOBCTL_STOP_SIGMASK 0xffff/* signr of the last group stop */ - -#define JOBCTL_STOP_DEQUEUED_BIT 16/* stop signal dequeued */ -#define JOBCTL_STOP_PENDING_BIT 17/* task should stop for group stop */ -#define JOBCTL_STOP_CONSUME_BIT 18/* consume group stop count */ -#define JOBCTL_TRAP_STOP_BIT 19/* trap for STOP */ -#define JOBCTL_TRAP_NOTIFY_BIT 20/* trap for NOTIFY */ -#define JOBCTL_TRAPPING_BIT 21/* switching to TRACED */ -#define JOBCTL_LISTENING_BIT 22/* ptracer is listening for events */ - -#define JOBCTL_STOP_DEQUEUED (1UL << JOBCTL_STOP_DEQUEUED_BIT) -#define JOBCTL_STOP_PENDING (1UL << JOBCTL_STOP_PENDING_BIT) -#define JOBCTL_STOP_CONSUME (1UL << JOBCTL_STOP_CONSUME_BIT) -#define JOBCTL_TRAP_STOP (1UL << JOBCTL_TRAP_STOP_BIT) -#define JOBCTL_TRAP_NOTIFY (1UL << JOBCTL_TRAP_NOTIFY_BIT) -#define JOBCTL_TRAPPING (1UL << JOBCTL_TRAPPING_BIT) -#define JOBCTL_LISTENING (1UL << JOBCTL_LISTENING_BIT) - -#define JOBCTL_TRAP_MASK (JOBCTL_TRAP_STOP | JOBCTL_TRAP_NOTIFY) -#define JOBCTL_PENDING_MASK (JOBCTL_STOP_PENDING | JOBCTL_TRAP_MASK) - -extern bool task_set_jobctl_pending (struct task_struct *task, -unsigned long mask); -extern void task_clear_jobctl_trapping (struct task_struct *task); -extern void task_clear_jobctl_pending (struct task_struct *task, -unsigned long mask); -static inline void rcu_copy_process (struct task_struct *p) {#ifdef CONFIG_PREEMPT_RCU
include/linux/sched/jobctl.h new file +32 -0
@@ -0,0 +1,32 @@ +#ifndef _LINUX_SCHED_JOBCTL_H +#define _LINUX_SCHED_JOBCTL_H + +/* +* task->jobctl flags +*/ +#define JOBCTL_STOP_SIGMASK 0xffff/* signr of the last group stop */ + +#define JOBCTL_STOP_DEQUEUED_BIT 16/* stop signal dequeued */ +#define JOBCTL_STOP_PENDING_BIT 17/* task should stop for group stop */ +#define JOBCTL_STOP_CONSUME_BIT 18/* consume group stop count */ +#define JOBCTL_TRAP_STOP_BIT 19/* trap for STOP */ +#define JOBCTL_TRAP_NOTIFY_BIT 20/* trap for NOTIFY */ +#define JOBCTL_TRAPPING_BIT 21/* switching to TRACED */ +#define JOBCTL_LISTENING_BIT 22/* ptracer is listening for events */ + +#define JOBCTL_STOP_DEQUEUED (1UL << JOBCTL_STOP_DEQUEUED_BIT) +#define JOBCTL_STOP_PENDING (1UL << JOBCTL_STOP_PENDING_BIT) +#define JOBCTL_STOP_CONSUME (1UL << JOBCTL_STOP_CONSUME_BIT) +#define JOBCTL_TRAP_STOP (1UL << JOBCTL_TRAP_STOP_BIT) +#define JOBCTL_TRAP_NOTIFY (1UL << JOBCTL_TRAP_NOTIFY_BIT) +#define JOBCTL_TRAPPING (1UL << JOBCTL_TRAPPING_BIT) +#define JOBCTL_LISTENING (1UL << JOBCTL_LISTENING_BIT) + +#define JOBCTL_TRAP_MASK (JOBCTL_TRAP_STOP | JOBCTL_TRAP_NOTIFY) +#define JOBCTL_PENDING_MASK (JOBCTL_STOP_PENDING | JOBCTL_TRAP_MASK) + +extern bool task_set_jobctl_pending (struct task_struct *task,unsigned long mask); +extern void task_clear_jobctl_trapping (struct task_struct *task); +extern void task_clear_jobctl_pending (struct task_struct *task,unsigned long mask); + +#endif /* _LINUX_SCHED_JOBCTL_H */
include/linux/sched/signal.h +1 -0
@@ -2,6 +2,7 @@#define _LINUX_SCHED_SIGNAL_H#include <linux/sched.h> +#include <linux/sched/jobctl.h> /* * Types defining task->signal and task->sighand and APIs using them:
Signature · 1 line
2.7.4
Ingo Molnar
maintainerPATCH 38/89 sched/headers: Remove <linux/rtmutex.h> from <linux/sched.h>
In reply to Ingo Molnar... and fix up missing #includes in other places that relied on sched.h doing that for them.
--- include/linux/i2c.h | 1 + include/linux/sched.h | 1 - kernel/fork.c | 1 + kernel/locking/locktorture.c | 1 + kernel/rcu/tree.h | 1 + 5 files changed, 4 insertions(+), 1 deletion(-)
include/linux/i2c.h +1 -0
@@ -30,6 +30,7 @@#include <linux/device.h> /* for struct device */ #include <linux/sched.h> /* for completion */ #include <linux/mutex.h> +#include <linux/rtmutex.h> #include <linux/irqdomain.h> /* for Host Notify IRQ */ #include <linux/of.h> /* for struct device_node */ #include <linux/swab.h> /* for swab16 */
include/linux/sched.h +0 -1
@@ -35,7 +35,6 @@#include <linux/seccomp.h> #include <linux/rcupdate.h> #include <linux/rculist.h> -#include <linux/rtmutex.h> #include <linux/time.h> #include <linux/param.h>
kernel/fork.c +1 -0
@@ -17,6 +17,7 @@#include <linux/sched/coredump.h> #include <linux/sched/user.h> #include <linux/sched/numa_balancing.h> +#include <linux/rtmutex.h> #include <linux/init.h> #include <linux/unistd.h> #include <linux/module.h>
kernel/locking/locktorture.c +1 -0
@@ -33,6 +33,7 @@#include <linux/interrupt.h> #include <linux/sched.h> #include <uapi/linux/sched/types.h> +#include <linux/rtmutex.h> #include <linux/atomic.h> #include <linux/moduleparam.h> #include <linux/delay.h>
kernel/rcu/tree.h +1 -0
@@ -24,6 +24,7 @@#include <linux/cache.h> #include <linux/spinlock.h> +#include <linux/rtmutex.h> #include <linux/threads.h> #include <linux/cpumask.h> #include <linux/seqlock.h>
Signature · 1 line
2.7.4
Ingo Molnar
maintainerPATCH 37/89 sched/headers: Remove <asm/ptrace.h> from <linux/sched.h>
In reply to Ingo Molnar... and fix up missing #includes in other places that relied on sched.h doing that for them.
--- arch/alpha/math-emu/math.c | 1 + arch/sh/kernel/cpu/fpu.c | 1 + arch/sh/kernel/process.c | 1 + drivers/oprofile/cpu_buffer.c | 2 ++ include/linux/sched.h | 1 - 5 files changed, 5 insertions(+), 1 deletion(-)
arch/alpha/math-emu/math.c +1 -0
@@ -2,6 +2,7 @@#include <linux/types.h> #include <linux/kernel.h> #include <linux/sched.h> +#include <asm/ptrace.h> #include <linux/uaccess.h>
arch/sh/kernel/cpu/fpu.c +1 -0
@@ -3,6 +3,7 @@#include <asm/processor.h> #include <asm/fpu.h> #include <asm/traps.h> +#include <asm/ptrace.h> int init_fpu (struct task_struct *tsk) {
arch/sh/kernel/process.c +1 -0
@@ -5,6 +5,7 @@#include <linux/export.h> #include <linux/stackprotector.h> #include <asm/fpu.h> +#include <asm/ptrace.h> struct kmem_cache *task_xstate_cachep =NULL ;unsigned int xstate_size;
drivers/oprofile/cpu_buffer.c +2 -0
@@ -23,6 +23,8 @@#include <linux/oprofile.h> #include <linux/errno.h> +#include <asm/ptrace.h> +#include "event_buffer.h" #include "cpu_buffer.h" #include "buffer_sync.h"
include/linux/sched.h +0 -1
@@ -22,7 +22,6 @@#include <linux/preempt.h> #include <asm/page.h> -#include <asm/ptrace.h> #include <linux/smp.h> #include <linux/sem.h>
Signature · 1 line
2.7.4
Ingo Molnar
maintainerPATCH 31/89 sched/headers: Move in_vfork() from <linux/sched.h> to <linux/sched/mm.h>
In reply to Ingo MolnarThe in_vfork() function deals with task->mm, so it better belongs into <linux/sched/mm.h>.
--- include/linux/sched.h | 26 -------------------------- include/linux/sched/mm.h | 27 +++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 26 deletions(-)
include/linux/sched.h +0 -26
@@ -1245,32 +1245,6 @@ static inline int tsk_nr_cpus_allowed(struct task_struct *p)#define TNF_FAULT_LOCAL 0x08#define TNF_MIGRATE_FAIL 0x10 -static inline bool in_vfork (struct task_struct *tsk) -{ -bool ret; - -/* -* need RCU to access ->real_parent if CLONE_VM was used along with -* CLONE_PARENT. -* -* We check real_parent->mm == tsk->mm because CLONE_VFORK does not -* imply CLONE_VM -* -* CLONE_VFORK can be used with CLONE_PARENT/CLONE_THREAD and thus -* ->real_parent is not necessarily the task doing vfork(), so in -* theory we can't rely on task_lock() if we want to dereference it. -* -* And in this case we can't trust the real_parent->mm == tsk->mm -* check, it can be false negative. But we do not care, if init or -* another oom-unkillable task does this it should blame itself. -*/ -rcu_read_lock (); - ret = tsk->vfork_done && tsk->real_parent->mm == tsk->mm; -rcu_read_unlock (); - -return ret; -} -#ifdef CONFIG_NUMA_BALANCING extern void task_numa_fault (int last_node,int node,int pages,int flags);extern pid_t task_numa_group_id (struct task_struct *p);
include/linux/sched/mm.h +27 -0
@@ -3,6 +3,7 @@#include <linux/kernel.h> #include <linux/atomic.h> +#include <linux/sched.h> /* * Routines for handling mm_structs
@@ -77,4 +78,30 @@ arch_get_unmapped_area_topdown(struct file *filp, unsigned long addr,static inline void arch_pick_mmap_layout (struct mm_struct *mm) {}#endif +static inline bool in_vfork (struct task_struct *tsk) +{ +bool ret; + +/* +* need RCU to access ->real_parent if CLONE_VM was used along with +* CLONE_PARENT. +* +* We check real_parent->mm == tsk->mm because CLONE_VFORK does not +* imply CLONE_VM +* +* CLONE_VFORK can be used with CLONE_PARENT/CLONE_THREAD and thus +* ->real_parent is not necessarily the task doing vfork(), so in +* theory we can't rely on task_lock() if we want to dereference it. +* +* And in this case we can't trust the real_parent->mm == tsk->mm +* check, it can be false negative. But we do not care, if init or +* another oom-unkillable task does this it should blame itself. +*/ +rcu_read_lock (); + ret = tsk->vfork_done && tsk->real_parent->mm == tsk->mm; +rcu_read_unlock (); + +return ret; +} +#endif /* _LINUX_SCHED_MM_H */
Signature · 1 line
2.7.4
Ingo Molnar
maintainerPATCH 43/89 sched/headers: Remove <linux/gfp.h> include from <linux/sched.h>
In reply to Ingo Molnar<linux/topology.h> is still needed - but we at least don't have MM headers in sched.h anymore, except <linux/mm_types.h>.
Fix dependencies in files that depended on this include.
--- include/linux/sched.h | 2 +- include/linux/sched/mm.h | 1 + lib/percpu_ida.c | 1 + 3 files changed, 3 insertions(+), 1 deletion(-)
include/linux/sched.h +1 -1
@@ -20,7 +20,7 @@#include <linux/kcov.h> #include <linux/task_io_accounting.h> #include <linux/latencytop.h> -#include <linux/gfp.h> +#include <linux/topology.h> #include <linux/magic.h> struct sched_attr ;
include/linux/sched/mm.h +1 -0
@@ -4,6 +4,7 @@#include <linux/kernel.h> #include <linux/atomic.h> #include <linux/sched.h> +#include <linux/gfp.h> /* * Routines for handling mm_structs
lib/percpu_ida.c +1 -0
@@ -14,6 +14,7 @@* General Public License for more details. */ +#include <linux/mm.h> #include <linux/bitmap.h> #include <linux/bitops.h> #include <linux/bug.h>
Signature · 1 line
2.7.4
Ingo Molnar
maintainerPATCH 47/89 sched/headers: Move debugging functions from <linux/sched.h> to <linux/sched/debug.h>
In reply to Ingo MolnarCollect the various scheduler and task state debugging APIs scattered around <linux/sched.h> into the new <linux/sched/debug.h> header.
In particular the show_regs() and show_stack() prototype affects many files, update them.
--- arch/alpha/kernel/process.c | 1 + arch/alpha/kernel/traps.c | 1 + arch/arc/kernel/ctx_sw.c | 1 + arch/arc/kernel/stacktrace.c | 2 ++ arch/arc/kernel/troubleshoot.c | 1 + arch/arm/kernel/process.c | 1 + arch/arm/kernel/stacktrace.c | 1 + arch/arm/kernel/traps.c | 1 + arch/arm/mm/alignment.c | 1 + arch/arm/mm/fault.c | 1 + arch/arm/probes/kprobes/core.c | 1 + arch/arm64/kernel/probes/kprobes.c | 1 + arch/arm64/kernel/process.c | 1 + arch/arm64/kernel/stacktrace.c | 1 + arch/arm64/kernel/traps.c | 1 + arch/arm64/mm/fault.c | 1 + arch/avr32/kernel/nmi_debug.c | 1 + arch/avr32/kernel/process.c | 1 + arch/blackfin/kernel/dumpstack.c | 2 ++ arch/blackfin/kernel/early_printk.c | 1 + arch/blackfin/kernel/nmi.c | 1 + arch/blackfin/kernel/process.c | 1 + arch/blackfin/kernel/trace.c | 1 + arch/blackfin/kernel/traps.c | 1 + arch/blackfin/mach-common/ints-priority.c | 1 + arch/blackfin/mm/isram-driver.c | 1 + arch/c6x/kernel/traps.c | 1 + arch/cris/arch-v10/kernel/process.c | 1 + arch/cris/arch-v10/kernel/traps.c | 2 ++ arch/cris/arch-v32/kernel/process.c | 1 + arch/cris/arch-v32/kernel/traps.c | 2 ++ arch/cris/kernel/irq.c | 1 + arch/cris/kernel/stacktrace.c | 2 +- arch/cris/kernel/traps.c | 1 + arch/frv/kernel/process.c | 1 + arch/frv/kernel/traps.c | 1 + arch/h8300/kernel/process.c | 1 + arch/h8300/kernel/traps.c | 1 + arch/hexagon/kernel/process.c | 1 + arch/hexagon/kernel/traps.c | 1 + arch/hexagon/kernel/vm_events.c | 1 + arch/ia64/hp/sim/simserial.c | 1 + arch/ia64/kernel/mca.c | 1 + arch/ia64/kernel/process.c | 1 + arch/ia64/kernel/traps.c | 1 + arch/m32r/kernel/process.c | 1 + arch/m32r/kernel/traps.c | 1 + arch/m68k/kernel/process.c | 1 + arch/m68k/kernel/traps.c | 1 + arch/m68k/mac/macints.c | 1 + arch/metag/kernel/process.c | 1 + arch/metag/kernel/stacktrace.c | 1 + arch/metag/kernel/traps.c | 1 + arch/metag/mm/fault.c | 1 + arch/microblaze/kernel/exceptions.c | 1 + arch/microblaze/kernel/process.c | 1 + arch/microblaze/kernel/traps.c | 1 + arch/mips/kernel/process.c | 1 + arch/mips/kernel/stacktrace.c | 1 + arch/mips/kernel/traps.c | 1 + arch/mips/sgi-ip22/ip28-berr.c | 1 + arch/mips/sgi-ip27/ip27-berr.c | 1 + arch/mips/sgi-ip32/ip32-berr.c | 1 + arch/mips/sgi-ip32/ip32-irq.c | 1 + arch/mn10300/kernel/process.c | 1 + arch/mn10300/kernel/traps.c | 1 + arch/nios2/kernel/process.c | 1 + arch/nios2/kernel/traps.c | 1 + arch/nios2/mm/fault.c | 1 + arch/openrisc/kernel/process.c | 1 + arch/openrisc/kernel/traps.c | 1 + arch/parisc/kernel/pa7300lc.c | 1 + arch/parisc/kernel/process.c | 1 + arch/parisc/kernel/signal.c | 1 + arch/parisc/kernel/traps.c | 1 + arch/parisc/kernel/unaligned.c | 1 + arch/parisc/mm/fault.c | 1 + arch/powerpc/kernel/process.c | 1 + arch/powerpc/kernel/stacktrace.c | 1 + arch/powerpc/kernel/traps.c | 1 + arch/s390/kernel/dumpstack.c | 1 + arch/s390/kernel/process.c | 1 + arch/s390/kernel/stacktrace.c | 1 + arch/s390/kernel/traps.c | 1 + arch/s390/mm/fault.c | 1 + arch/score/kernel/traps.c | 1 + arch/sh/kernel/dumpstack.c | 1 + arch/sh/kernel/nmi_debug.c | 1 + arch/sh/kernel/process_32.c | 1 + arch/sh/kernel/process_64.c | 1 + arch/sh/kernel/stacktrace.c | 1 + arch/sh/kernel/traps.c | 1 + arch/sh/kernel/traps_64.c | 1 + arch/sparc/kernel/process_32.c | 1 + arch/sparc/kernel/process_64.c | 1 + arch/sparc/kernel/stacktrace.c | 1 + arch/sparc/kernel/sun4m_irq.c | 1 + arch/sparc/kernel/sys_sparc_32.c | 1 + arch/sparc/kernel/sys_sparc_64.c | 1 + arch/sparc/kernel/traps_32.c | 1 + arch/sparc/kernel/traps_64.c | 1 + arch/sparc/mm/fault_64.c | 1 + arch/tile/include/asm/stack.h | 2 ++ arch/tile/kernel/process.c | 1 + arch/tile/kernel/signal.c | 1 + arch/tile/kernel/stack.c | 1 + arch/tile/kernel/traps.c | 1 + arch/tile/kernel/unaligned.c | 1 + arch/tile/mm/fault.c | 1 + arch/um/drivers/mconsole_kern.c | 1 + arch/um/kernel/process.c | 1 + arch/um/kernel/sysrq.c | 2 ++ arch/um/kernel/trap.c | 1 + arch/unicore32/kernel/process.c | 1 + arch/unicore32/kernel/stacktrace.c | 1 + arch/unicore32/kernel/traps.c | 1 + arch/unicore32/mm/alignment.c | 1 + arch/x86/kernel/amd_gart_64.c | 1 + arch/x86/kernel/doublefault.c | 1 + arch/x86/kernel/dumpstack.c | 1 + arch/x86/kernel/dumpstack_32.c | 1 + arch/x86/kernel/dumpstack_64.c | 1 + arch/x86/kernel/kprobes/core.c | 1 + arch/x86/kernel/nmi.c | 1 + arch/x86/kernel/process.c | 1 + arch/x86/kernel/stacktrace.c | 1 + arch/x86/mm/extable.c | 2 ++ arch/x86/platform/uv/uv_nmi.c | 1 + arch/x86/um/sysrq_32.c | 1 + arch/x86/um/sysrq_64.c | 1 + arch/xtensa/kernel/process.c | 1 + arch/xtensa/kernel/traps.c | 1 + drivers/base/power/main.c | 1 + drivers/tty/sysrq.c | 2 ++ drivers/tty/tty_ldsem.c | 1 + drivers/tty/vt/keyboard.c | 2 ++ fs/proc/base.c | 1 + include/linux/sched.h | 36 ------------------------------------ include/linux/sched/debug.h | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ kernel/debug/kdb/kdb_bt.c | 1 + kernel/debug/kdb/kdb_main.c | 1 + kernel/hung_task.c | 1 + kernel/latencytop.c | 1 + kernel/locking/mutex.c | 1 + kernel/locking/rtmutex-debug.c | 1 + kernel/locking/rtmutex.c | 1 + kernel/locking/rwsem-spinlock.c | 1 + kernel/locking/rwsem-xadd.c | 1 + kernel/locking/rwsem.c | 1 + kernel/locking/semaphore.c | 1 + kernel/panic.c | 1 + kernel/power/process.c | 1 + kernel/printk/printk.c | 1 + kernel/rcu/tree.c | 1 + kernel/rcu/tree_plugin.h | 1 + kernel/rcu/update.c | 1 + kernel/sched/completion.c | 1 + kernel/sched/sched.h | 2 +- kernel/sched/wait.c | 1 + kernel/signal.c | 1 + kernel/time/alarmtimer.c | 1 + kernel/time/hrtimer.c | 1 + kernel/time/timer.c | 1 + kernel/watchdog.c | 1 + kernel/watchdog_hld.c | 2 ++ lib/dump_stack.c | 1 + lib/nmi_backtrace.c | 1 + 167 files changed, 225 insertions(+), 38 deletions(-)
arch/alpha/kernel/process.c +1 -0
@@ -11,6 +11,7 @@#include <linux/errno.h> #include <linux/module.h> #include <linux/sched.h> +#include <linux/sched/debug.h> #include <linux/kernel.h> #include <linux/mm.h> #include <linux/smp.h>
arch/alpha/kernel/traps.c +1 -0
@@ -11,6 +11,7 @@#include <linux/jiffies.h> #include <linux/mm.h> #include <linux/sched/signal.h> +#include <linux/sched/debug.h> #include <linux/tty.h> #include <linux/delay.h> #include <linux/module.h>
arch/arc/kernel/ctx_sw.c +1 -0
@@ -16,6 +16,7 @@#include <asm/asm-offsets.h> #include <linux/sched.h> +#include <linux/sched/debug.h> #ifdef CONFIG_ARC_PLAT_EZNPS #include <plat/ctop.h> #endif
arch/arc/kernel/stacktrace.c +2 -0
@@ -28,6 +28,8 @@#include <linux/export.h> #include <linux/stacktrace.h> #include <linux/kallsyms.h> +#include <linux/sched/debug.h> +#include <asm/arcregs.h> #include <asm/unwind.h> #include <asm/switch_to.h>
arch/arc/kernel/troubleshoot.c +1 -0
@@ -14,6 +14,7 @@#include <linux/proc_fs.h> #include <linux/file.h> #include <linux/sched/mm.h> +#include <linux/sched/debug.h> #include <asm/arcregs.h> #include <asm/irqflags.h>
arch/arm/kernel/process.c +1 -0
@@ -12,6 +12,7 @@#include <linux/export.h> #include <linux/sched.h> +#include <linux/sched/debug.h> #include <linux/kernel.h> #include <linux/mm.h> #include <linux/stddef.h>
arch/arm/kernel/stacktrace.c +1 -0
@@ -1,5 +1,6 @@#include <linux/export.h> #include <linux/sched.h> +#include <linux/sched/debug.h> #include <linux/stacktrace.h> #include <asm/stacktrace.h>
arch/arm/kernel/traps.c +1 -0
@@ -25,6 +25,7 @@#include <linux/delay.h> #include <linux/init.h> #include <linux/sched/signal.h> +#include <linux/sched/debug.h> #include <linux/irq.h> #include <linux/atomic.h>
arch/arm/mm/alignment.c +1 -0
@@ -14,6 +14,7 @@#include <linux/moduleparam.h> #include <linux/compiler.h> #include <linux/kernel.h> +#include <linux/sched/debug.h> #include <linux/errno.h> #include <linux/string.h> #include <linux/proc_fs.h>
arch/arm/mm/fault.c +1 -0
@@ -17,6 +17,7 @@#include <linux/uaccess.h> #include <linux/page-flags.h> #include <linux/sched/signal.h> +#include <linux/sched/debug.h> #include <linux/highmem.h> #include <linux/perf_event.h>
arch/arm/probes/kprobes/core.c +1 -0
@@ -24,6 +24,7 @@#include <linux/module.h> #include <linux/slab.h> #include <linux/stop_machine.h> +#include <linux/sched/debug.h> #include <linux/stringify.h> #include <asm/traps.h> #include <asm/opcodes.h>
arch/arm64/kernel/probes/kprobes.c +1 -0
@@ -22,6 +22,7 @@#include <linux/extable.h> #include <linux/slab.h> #include <linux/stop_machine.h> +#include <linux/sched/debug.h> #include <linux/stringify.h> #include <asm/traps.h> #include <asm/ptrace.h>
arch/arm64/kernel/process.c +1 -0
@@ -24,6 +24,7 @@#include <linux/efi.h> #include <linux/export.h> #include <linux/sched.h> +#include <linux/sched/debug.h> #include <linux/kernel.h> #include <linux/mm.h> #include <linux/stddef.h>
arch/arm64/kernel/stacktrace.c +1 -0
@@ -19,6 +19,7 @@#include <linux/export.h> #include <linux/ftrace.h> #include <linux/sched.h> +#include <linux/sched/debug.h> #include <linux/stacktrace.h> #include <asm/irq.h>
arch/arm64/kernel/traps.c +1 -0
@@ -30,6 +30,7 @@#include <linux/delay.h> #include <linux/init.h> #include <linux/sched/signal.h> +#include <linux/sched/debug.h> #include <linux/syscalls.h> #include <asm/atomic.h>
arch/arm64/mm/fault.c +1 -0
@@ -27,6 +27,7 @@#include <linux/uaccess.h> #include <linux/page-flags.h> #include <linux/sched/signal.h> +#include <linux/sched/debug.h> #include <linux/highmem.h> #include <linux/perf_event.h> #include <linux/preempt.h>
arch/avr32/kernel/nmi_debug.c +1 -0
@@ -9,6 +9,7 @@#include <linux/kdebug.h> #include <linux/notifier.h> #include <linux/sched.h> +#include <linux/sched/debug.h> #include <asm/irq.h>
arch/avr32/kernel/process.c +1 -0
@@ -6,6 +6,7 @@* published by the Free Software Foundation. */ #include <linux/sched.h> +#include <linux/sched/debug.h> #include <linux/module.h> #include <linux/kallsyms.h> #include <linux/fs.h>
arch/blackfin/kernel/dumpstack.c +2 -0
@@ -10,6 +10,8 @@#include <linux/mm.h> #include <linux/uaccess.h> #include <linux/module.h> +#include <linux/sched/debug.h> +#include <asm/trace.h> /*
arch/blackfin/kernel/early_printk.c +1 -0
@@ -8,6 +8,7 @@*/ #include <linux/kernel.h> +#include <linux/sched/debug.h> #include <linux/init.h> #include <linux/serial_core.h> #include <linux/console.h>
arch/blackfin/kernel/nmi.c +1 -0
@@ -17,6 +17,7 @@#include <linux/nmi.h> #include <linux/smp.h> #include <linux/timer.h> +#include <linux/sched/debug.h> #include <asm/blackfin.h> #include <linux/atomic.h> #include <asm/cacheflush.h>
arch/blackfin/kernel/process.c +1 -0
@@ -12,6 +12,7 @@#include <linux/uaccess.h> #include <linux/slab.h> #include <linux/sched.h> +#include <linux/sched/debug.h> #include <linux/tick.h> #include <linux/fs.h> #include <linux/err.h>
arch/blackfin/kernel/trace.c +1 -0
@@ -12,6 +12,7 @@#include <linux/mm.h> #include <linux/oom.h> #include <linux/sched/signal.h> +#include <linux/sched/debug.h> #include <linux/uaccess.h> #include <linux/module.h> #include <linux/kallsyms.h>
arch/blackfin/kernel/traps.c +1 -0
@@ -10,6 +10,7 @@#include <linux/uaccess.h> #include <linux/module.h> #include <linux/sched/signal.h> +#include <linux/sched/debug.h> #include <asm/traps.h> #include <asm/cplb.h> #include <asm/blackfin.h>
arch/blackfin/mach-common/ints-priority.c +1 -0
@@ -16,6 +16,7 @@#include <linux/seq_file.h> #include <linux/irq.h> #include <linux/sched.h> +#include <linux/sched/debug.h> #include <linux/syscore_ops.h> #include <linux/gpio.h> #include <asm/delay.h>
arch/blackfin/mm/isram-driver.c +1 -0
@@ -14,6 +14,7 @@#include <linux/slab.h> #include <linux/spinlock.h> #include <linux/sched.h> +#include <linux/sched/debug.h> #include <asm/blackfin.h> #include <asm/dma.h>
arch/c6x/kernel/traps.c +1 -0
@@ -10,6 +10,7 @@*/ #include <linux/module.h> #include <linux/ptrace.h> +#include <linux/sched/debug.h> #include <linux/kallsyms.h> #include <linux/bug.h>
arch/cris/arch-v10/kernel/process.c +1 -0
@@ -11,6 +11,7 @@*/ #include <linux/sched.h> +#include <linux/sched/debug.h> #include <linux/slab.h> #include <linux/err.h> #include <linux/fs.h>
arch/cris/arch-v10/kernel/traps.c +2 -0
@@ -10,6 +10,8 @@#include <linux/ptrace.h> #include <linux/uaccess.h> +#include <linux/sched/debug.h> +#include <arch/sv_addr_ag.h> #include <arch/system.h>
arch/cris/arch-v32/kernel/process.c +1 -0
@@ -9,6 +9,7 @@*/ #include <linux/sched.h> +#include <linux/sched/debug.h> #include <linux/slab.h> #include <linux/err.h> #include <linux/fs.h>
arch/cris/arch-v32/kernel/traps.c +2 -0
@@ -5,6 +5,8 @@#include <linux/ptrace.h> #include <linux/module.h> #include <linux/uaccess.h> +#include <linux/sched/debug.h> +#include <hwregs/supp_reg.h> #include <hwregs/intr_vect_defs.h> #include <asm/irq.h>
arch/cris/kernel/irq.c +1 -0
@@ -22,6 +22,7 @@#include <linux/module.h> #include <linux/ptrace.h> #include <linux/irq.h> +#include <linux/sched/debug.h> #include <linux/kernel_stat.h> #include <linux/signal.h>
arch/cris/kernel/stacktrace.c +1 -1
@@ -1,5 +1,5 @@#include <linux/sched.h> -#include <linux/stacktrace.h> +#include <linux/sched/debug.h> #include <linux/stacktrace.h> #include <asm/stacktrace.h>
arch/cris/kernel/traps.c +1 -0
@@ -15,6 +15,7 @@#include <linux/init.h> #include <linux/module.h> #include <linux/utsname.h> +#include <linux/sched/debug.h> #ifdef CONFIG_KALLSYMS #include <linux/kallsyms.h> #endif
arch/frv/kernel/process.c +1 -0
@@ -13,6 +13,7 @@#include <linux/module.h> #include <linux/errno.h> #include <linux/sched.h> +#include <linux/sched/debug.h> #include <linux/kernel.h> #include <linux/mm.h> #include <linux/smp.h>
arch/frv/kernel/traps.c +1 -0
@@ -10,6 +10,7 @@*/ #include <linux/sched/signal.h> +#include <linux/sched/debug.h> #include <linux/signal.h> #include <linux/kernel.h> #include <linux/mm.h>
arch/h8300/kernel/process.c +1 -0
@@ -25,6 +25,7 @@#include <linux/errno.h> #include <linux/module.h> #include <linux/sched.h> +#include <linux/sched/debug.h> #include <linux/kernel.h> #include <linux/mm.h> #include <linux/smp.h>
arch/h8300/kernel/traps.c +1 -0
@@ -16,6 +16,7 @@#include <linux/types.h> #include <linux/sched.h> +#include <linux/sched/debug.h> #include <linux/kernel.h> #include <linux/errno.h> #include <linux/init.h>
arch/hexagon/kernel/process.c +1 -0
@@ -19,6 +19,7 @@*/ #include <linux/sched.h> +#include <linux/sched/debug.h> #include <linux/types.h> #include <linux/module.h> #include <linux/tick.h>
arch/hexagon/kernel/traps.c +1 -0
@@ -20,6 +20,7 @@#include <linux/init.h> #include <linux/sched/signal.h> +#include <linux/sched/debug.h> #include <linux/module.h> #include <linux/kallsyms.h> #include <linux/kdebug.h>
arch/hexagon/kernel/vm_events.c +1 -0
@@ -19,6 +19,7 @@*/ #include <linux/kernel.h> +#include <linux/sched/debug.h> #include <asm/registers.h> #include <linux/irq.h> #include <linux/hardirq.h>
arch/ia64/hp/sim/simserial.c +1 -0
@@ -14,6 +14,7 @@#include <linux/init.h> #include <linux/errno.h> #include <linux/sched.h> +#include <linux/sched/debug.h> #include <linux/tty.h> #include <linux/tty_flip.h> #include <linux/major.h>
arch/ia64/kernel/mca.c +1 -0
@@ -73,6 +73,7 @@#include <linux/types.h> #include <linux/init.h> #include <linux/sched/signal.h> +#include <linux/sched/debug.h> #include <linux/interrupt.h> #include <linux/irq.h> #include <linux/bootmem.h>
arch/ia64/kernel/process.c +1 -0
@@ -20,6 +20,7 @@#include <linux/notifier.h> #include <linux/personality.h> #include <linux/sched.h> +#include <linux/sched/debug.h> #include <linux/stddef.h> #include <linux/thread_info.h> #include <linux/unistd.h>
arch/ia64/kernel/traps.c +1 -0
@@ -10,6 +10,7 @@#include <linux/kernel.h> #include <linux/init.h> #include <linux/sched/signal.h> +#include <linux/sched/debug.h> #include <linux/tty.h> #include <linux/vt_kern.h> /* For unblank_screen() */ #include <linux/module.h> /* for EXPORT_SYMBOL */
arch/m32r/kernel/process.c +1 -0
@@ -22,6 +22,7 @@#include <linux/fs.h> #include <linux/slab.h> +#include <linux/sched/debug.h> #include <linux/module.h> #include <linux/ptrace.h> #include <linux/unistd.h>
arch/m32r/kernel/traps.c +1 -0
@@ -14,6 +14,7 @@#include <linux/kallsyms.h> #include <linux/stddef.h> #include <linux/ptrace.h> +#include <linux/sched/debug.h> #include <linux/mm.h> #include <asm/page.h> #include <asm/processor.h>
arch/m68k/kernel/process.c +1 -0
@@ -13,6 +13,7 @@#include <linux/errno.h> #include <linux/module.h> #include <linux/sched.h> +#include <linux/sched/debug.h> #include <linux/kernel.h> #include <linux/mm.h> #include <linux/slab.h>
arch/m68k/kernel/traps.c +1 -0
@@ -19,6 +19,7 @@*/ #include <linux/sched.h> +#include <linux/sched/debug.h> #include <linux/signal.h> #include <linux/kernel.h> #include <linux/mm.h>
arch/m68k/mac/macints.c +1 -0
@@ -110,6 +110,7 @@#include <linux/types.h> #include <linux/kernel.h> #include <linux/sched.h> +#include <linux/sched/debug.h> #include <linux/interrupt.h> #include <linux/irq.h> #include <linux/delay.h>
arch/metag/kernel/process.c +1 -0
@@ -8,6 +8,7 @@#include <linux/errno.h> #include <linux/export.h> #include <linux/sched.h> +#include <linux/sched/debug.h> #include <linux/kernel.h> #include <linux/mm.h> #include <linux/unistd.h>
arch/metag/kernel/stacktrace.c +1 -0
@@ -1,5 +1,6 @@#include <linux/export.h> #include <linux/sched.h> +#include <linux/sched/debug.h> #include <linux/stacktrace.h> #include <asm/stacktrace.h>
arch/metag/kernel/traps.c +1 -0
@@ -10,6 +10,7 @@#include <linux/export.h> #include <linux/sched.h> +#include <linux/sched/debug.h> #include <linux/signal.h> #include <linux/kernel.h> #include <linux/mm.h>
arch/metag/mm/fault.c +1 -0
@@ -8,6 +8,7 @@#include <linux/mm.h> #include <linux/kernel.h> #include <linux/ptrace.h> +#include <linux/sched/debug.h> #include <linux/interrupt.h> #include <linux/uaccess.h>
arch/microblaze/kernel/exceptions.c +1 -0
@@ -17,6 +17,7 @@#include <linux/kernel.h> #include <linux/signal.h> #include <linux/sched.h> +#include <linux/sched/debug.h> #include <linux/kallsyms.h> #include <asm/exceptions.h>
arch/microblaze/kernel/process.c +1 -0
@@ -11,6 +11,7 @@#include <linux/cpu.h> #include <linux/export.h> #include <linux/sched.h> +#include <linux/sched/debug.h> #include <linux/pm.h> #include <linux/tick.h> #include <linux/bitops.h>
arch/microblaze/kernel/traps.c +1 -0
@@ -12,6 +12,7 @@#include <linux/kernel.h> #include <linux/kallsyms.h> #include <linux/sched.h> +#include <linux/sched/debug.h> #include <linux/debug_locks.h> #include <asm/exceptions.h>
arch/mips/kernel/process.c +1 -0
@@ -11,6 +11,7 @@*/ #include <linux/errno.h> #include <linux/sched.h> +#include <linux/sched/debug.h> #include <linux/tick.h> #include <linux/kernel.h> #include <linux/mm.h>
arch/mips/kernel/stacktrace.c +1 -0
@@ -4,6 +4,7 @@* Copyright (C) 2006 Atsushi Nemoto <[email protected]> */ #include <linux/sched.h> +#include <linux/sched/debug.h> #include <linux/stacktrace.h> #include <linux/export.h> #include <asm/stacktrace.h>
arch/mips/kernel/traps.c +1 -0
@@ -24,6 +24,7 @@#include <linux/extable.h> #include <linux/mm.h> #include <linux/sched.h> +#include <linux/sched/debug.h> #include <linux/smp.h> #include <linux/spinlock.h> #include <linux/kallsyms.h>
arch/mips/sgi-ip22/ip28-berr.c +1 -0
@@ -8,6 +8,7 @@#include <linux/init.h> #include <linux/kernel.h> #include <linux/sched.h> +#include <linux/sched/debug.h> #include <linux/seq_file.h> #include <asm/addrspace.h>
arch/mips/sgi-ip27/ip27-berr.c +1 -0
@@ -12,6 +12,7 @@#include <linux/module.h> #include <linux/signal.h> /* for SIGBUS */ #include <linux/sched.h> /* schow_regs(), force_sig() */ +#include <linux/sched/debug.h> #include <asm/module.h> #include <asm/sn/addrs.h>
arch/mips/sgi-ip32/ip32-berr.c +1 -0
@@ -10,6 +10,7 @@#include <linux/init.h> #include <linux/kernel.h> #include <linux/sched.h> +#include <linux/sched/debug.h> #include <asm/traps.h> #include <linux/uaccess.h> #include <asm/addrspace.h>
arch/mips/sgi-ip32/ip32-irq.c +1 -0
@@ -18,6 +18,7 @@#include <linux/mm.h> #include <linux/random.h> #include <linux/sched.h> +#include <linux/sched/debug.h> #include <asm/irq_cpu.h> #include <asm/mipsregs.h>
arch/mn10300/kernel/process.c +1 -0
@@ -11,6 +11,7 @@#include <linux/module.h> #include <linux/errno.h> #include <linux/sched.h> +#include <linux/sched/debug.h> #include <linux/kernel.h> #include <linux/mm.h> #include <linux/smp.h>
arch/mn10300/kernel/traps.c +1 -0
@@ -10,6 +10,7 @@* 2 of the Licence, or (at your option) any later version. */ #include <linux/sched.h> +#include <linux/sched/debug.h> #include <linux/kernel.h> #include <linux/string.h> #include <linux/errno.h>
arch/nios2/kernel/process.c +1 -0
@@ -14,6 +14,7 @@#include <linux/export.h> #include <linux/sched.h> +#include <linux/sched/debug.h> #include <linux/tick.h> #include <linux/uaccess.h>
arch/nios2/kernel/traps.c +1 -0
@@ -11,6 +11,7 @@*/ #include <linux/sched.h> +#include <linux/sched/debug.h> #include <linux/kernel.h> #include <linux/signal.h> #include <linux/export.h>
arch/nios2/mm/fault.c +1 -0
@@ -13,6 +13,7 @@#include <linux/signal.h> #include <linux/sched.h> +#include <linux/sched/debug.h> #include <linux/interrupt.h> #include <linux/kernel.h> #include <linux/errno.h>
arch/openrisc/kernel/process.c +1 -0
@@ -22,6 +22,7 @@#include <linux/errno.h> #include <linux/sched.h> +#include <linux/sched/debug.h> #include <linux/kernel.h> #include <linux/module.h> #include <linux/mm.h>
arch/openrisc/kernel/traps.c +1 -0
@@ -22,6 +22,7 @@#include <linux/init.h> #include <linux/sched.h> +#include <linux/sched/debug.h> #include <linux/kernel.h> #include <linux/module.h> #include <linux/kmod.h>
arch/parisc/kernel/pa7300lc.c +1 -0
@@ -5,6 +5,7 @@* Copyright (C) 2000 Philipp Rumpf */ #include <linux/sched.h> +#include <linux/sched/debug.h> #include <linux/smp.h> #include <linux/kernel.h> #include <asm/io.h>
arch/parisc/kernel/process.c +1 -0
@@ -43,6 +43,7 @@#include <linux/personality.h> #include <linux/ptrace.h> #include <linux/sched.h> +#include <linux/sched/debug.h> #include <linux/slab.h> #include <linux/stddef.h> #include <linux/unistd.h>
arch/parisc/kernel/signal.c +1 -0
@@ -13,6 +13,7 @@*/ #include <linux/sched.h> +#include <linux/sched/debug.h> #include <linux/mm.h> #include <linux/smp.h> #include <linux/kernel.h>
arch/parisc/kernel/traps.c +1 -0
@@ -11,6 +11,7 @@*/ #include <linux/sched.h> +#include <linux/sched/debug.h> #include <linux/kernel.h> #include <linux/string.h> #include <linux/errno.h>
arch/parisc/kernel/unaligned.c +1 -0
@@ -24,6 +24,7 @@#include <linux/kernel.h> #include <linux/module.h> #include <linux/sched/signal.h> +#include <linux/sched/debug.h> #include <linux/signal.h> #include <linux/ratelimit.h> #include <linux/uaccess.h>
arch/parisc/mm/fault.c +1 -0
@@ -13,6 +13,7 @@#include <linux/mm.h> #include <linux/ptrace.h> #include <linux/sched.h> +#include <linux/sched/debug.h> #include <linux/interrupt.h> #include <linux/extable.h> #include <linux/uaccess.h>
arch/powerpc/kernel/process.c +1 -0
@@ -16,6 +16,7 @@#include <linux/errno.h> #include <linux/sched.h> +#include <linux/sched/debug.h> #include <linux/kernel.h> #include <linux/mm.h> #include <linux/smp.h>
arch/powerpc/kernel/stacktrace.c +1 -0
@@ -12,6 +12,7 @@#include <linux/export.h> #include <linux/sched.h> +#include <linux/sched/debug.h> #include <linux/stacktrace.h> #include <asm/ptrace.h> #include <asm/processor.h>
arch/powerpc/kernel/traps.c +1 -0
@@ -17,6 +17,7 @@#include <linux/errno.h> #include <linux/sched.h> +#include <linux/sched/debug.h> #include <linux/kernel.h> #include <linux/mm.h> #include <linux/stddef.h>
arch/s390/kernel/dumpstack.c +1 -0
@@ -14,6 +14,7 @@#include <linux/mm.h> #include <linux/module.h> #include <linux/sched.h> +#include <linux/sched/debug.h> #include <asm/processor.h> #include <asm/debug.h> #include <asm/dis.h>
arch/s390/kernel/process.c +1 -0
@@ -11,6 +11,7 @@#include <linux/compiler.h> #include <linux/cpu.h> #include <linux/sched.h> +#include <linux/sched/debug.h> #include <linux/kernel.h> #include <linux/mm.h> #include <linux/elfcore.h>
arch/s390/kernel/stacktrace.c +1 -0
@@ -6,6 +6,7 @@*/ #include <linux/sched.h> +#include <linux/sched/debug.h> #include <linux/stacktrace.h> #include <linux/kallsyms.h> #include <linux/module.h>
arch/s390/kernel/traps.c +1 -0
@@ -17,6 +17,7 @@#include <linux/extable.h> #include <linux/ptrace.h> #include <linux/sched.h> +#include <linux/sched/debug.h> #include <linux/mm.h> #include <linux/slab.h> #include <linux/uaccess.h>
arch/s390/mm/fault.c +1 -0
@@ -12,6 +12,7 @@#include <linux/perf_event.h> #include <linux/signal.h> #include <linux/sched.h> +#include <linux/sched/debug.h> #include <linux/kernel.h> #include <linux/errno.h> #include <linux/string.h>
arch/score/kernel/traps.c +1 -0
@@ -25,6 +25,7 @@#include <linux/module.h> #include <linux/sched/signal.h> +#include <linux/sched/debug.h> #include <asm/cacheflush.h> #include <asm/irq.h>
arch/sh/kernel/dumpstack.c +1 -0
@@ -11,6 +11,7 @@#include <linux/kallsyms.h> #include <linux/ftrace.h> #include <linux/debug_locks.h> +#include <linux/sched/debug.h> #include <linux/kdebug.h> #include <linux/export.h> #include <linux/uaccess.h>
arch/sh/kernel/nmi_debug.c +1 -0
@@ -9,6 +9,7 @@#include <linux/kdebug.h> #include <linux/notifier.h> #include <linux/sched.h> +#include <linux/sched/debug.h> #include <linux/hardirq.h> enum nmi_action {
arch/sh/kernel/process_32.c +1 -0
@@ -15,6 +15,7 @@*/ #include <linux/module.h> #include <linux/mm.h> +#include <linux/sched/debug.h> #include <linux/slab.h> #include <linux/elfcore.h> #include <linux/kallsyms.h>
arch/sh/kernel/process_64.c +1 -0
@@ -25,6 +25,7 @@#include <linux/init.h> #include <linux/module.h> #include <linux/io.h> +#include <linux/sched/debug.h> #include <asm/syscalls.h> #include <linux/uaccess.h> #include <asm/pgtable.h>
arch/sh/kernel/stacktrace.c +1 -0
@@ -10,6 +10,7 @@* for more details. */ #include <linux/sched.h> +#include <linux/sched/debug.h> #include <linux/stacktrace.h> #include <linux/thread_info.h> #include <linux/module.h>
arch/sh/kernel/traps.c +1 -0
@@ -4,6 +4,7 @@#include <linux/kdebug.h> #include <linux/signal.h> #include <linux/sched.h> +#include <linux/sched/debug.h> #include <linux/uaccess.h> #include <linux/hardirq.h> #include <linux/kernel.h>
arch/sh/kernel/traps_64.c +1 -0
@@ -10,6 +10,7 @@* for more details. */ #include <linux/sched.h> +#include <linux/sched/debug.h> #include <linux/kernel.h> #include <linux/string.h> #include <linux/errno.h>
arch/sparc/kernel/process_32.c +1 -0
@@ -14,6 +14,7 @@#include <linux/errno.h> #include <linux/module.h> #include <linux/sched.h> +#include <linux/sched/debug.h> #include <linux/kernel.h> #include <linux/mm.h> #include <linux/stddef.h>
arch/sparc/kernel/process_64.c +1 -0
@@ -14,6 +14,7 @@#include <linux/errno.h> #include <linux/export.h> #include <linux/sched.h> +#include <linux/sched/debug.h> #include <linux/kernel.h> #include <linux/mm.h> #include <linux/fs.h>
arch/sparc/kernel/stacktrace.c +1 -0
@@ -1,4 +1,5 @@#include <linux/sched.h> +#include <linux/sched/debug.h> #include <linux/stacktrace.h> #include <linux/thread_info.h> #include <linux/ftrace.h>
arch/sparc/kernel/sun4m_irq.c +1 -0
@@ -10,6 +10,7 @@*/ #include <linux/slab.h> +#include <linux/sched/debug.h> #include <asm/timer.h> #include <asm/traps.h>
arch/sparc/kernel/sys_sparc_32.c +1 -0
@@ -9,6 +9,7 @@#include <linux/types.h> #include <linux/sched/signal.h> #include <linux/sched/mm.h> +#include <linux/sched/debug.h> #include <linux/mm.h> #include <linux/fs.h> #include <linux/file.h>
arch/sparc/kernel/sys_sparc_64.c +1 -0
@@ -9,6 +9,7 @@#include <linux/types.h> #include <linux/sched/signal.h> #include <linux/sched/mm.h> +#include <linux/sched/debug.h> #include <linux/fs.h> #include <linux/file.h> #include <linux/mm.h>
arch/sparc/kernel/traps_32.c +1 -0
@@ -10,6 +10,7 @@*/ #include <linux/sched.h> /* for jiffies */ +#include <linux/sched/debug.h> #include <linux/kernel.h> #include <linux/signal.h> #include <linux/smp.h>
arch/sparc/kernel/traps_64.c +1 -0
@@ -10,6 +10,7 @@#include <linux/extable.h> #include <linux/sched.h> +#include <linux/sched/debug.h> #include <linux/linkage.h> #include <linux/kernel.h> #include <linux/signal.h>
arch/sparc/mm/fault_64.c +1 -0
@@ -10,6 +10,7 @@#include <linux/string.h> #include <linux/types.h> #include <linux/sched.h> +#include <linux/sched/debug.h> #include <linux/ptrace.h> #include <linux/mman.h> #include <linux/signal.h>
arch/tile/include/asm/stack.h +2 -0
@@ -17,6 +17,8 @@#include <linux/types.h> #include <linux/sched.h> +#include <linux/sched/debug.h> +#include <asm/backtrace.h> #include <asm/page.h> #include <hv/hypervisor.h>
arch/tile/kernel/process.c +1 -0
@@ -13,6 +13,7 @@*/ #include <linux/sched.h> +#include <linux/sched/debug.h> #include <linux/preempt.h> #include <linux/module.h> #include <linux/fs.h>
arch/tile/kernel/signal.c +1 -0
@@ -14,6 +14,7 @@*/ #include <linux/sched.h> +#include <linux/sched/debug.h> #include <linux/mm.h> #include <linux/smp.h> #include <linux/kernel.h>
arch/tile/kernel/stack.c +1 -0
@@ -13,6 +13,7 @@*/ #include <linux/sched.h> +#include <linux/sched/debug.h> #include <linux/kernel.h> #include <linux/kprobes.h> #include <linux/module.h>
arch/tile/kernel/traps.c +1 -0
@@ -13,6 +13,7 @@*/ #include <linux/sched.h> +#include <linux/sched/debug.h> #include <linux/kernel.h> #include <linux/kprobes.h> #include <linux/kdebug.h>
arch/tile/kernel/unaligned.c +1 -0
@@ -17,6 +17,7 @@#include <linux/smp.h> #include <linux/ptrace.h> #include <linux/slab.h> +#include <linux/sched/debug.h> #include <linux/thread_info.h> #include <linux/uaccess.h> #include <linux/mman.h>
arch/tile/mm/fault.c +1 -0
@@ -16,6 +16,7 @@#include <linux/signal.h> #include <linux/sched.h> +#include <linux/sched/debug.h> #include <linux/kernel.h> #include <linux/errno.h> #include <linux/string.h>
arch/um/drivers/mconsole_kern.c +1 -0
@@ -13,6 +13,7 @@#include <linux/module.h> #include <linux/notifier.h> #include <linux/reboot.h> +#include <linux/sched/debug.h> #include <linux/proc_fs.h> #include <linux/slab.h> #include <linux/syscalls.h>
arch/um/kernel/process.c +1 -0
@@ -17,6 +17,7 @@#include <linux/random.h> #include <linux/slab.h> #include <linux/sched.h> +#include <linux/sched/debug.h> #include <linux/seq_file.h> #include <linux/tick.h> #include <linux/threads.h>
arch/um/kernel/sysrq.c +2 -0
@@ -11,6 +11,8 @@#include <linux/kernel.h> #include <linux/module.h> #include <linux/sched.h> +#include <linux/sched/debug.h> +#include <asm/sysrq.h> #include <asm/stacktrace.h> #include <os.h>
arch/um/kernel/trap.c +1 -0
@@ -8,6 +8,7 @@#include <linux/hardirq.h> #include <linux/module.h> #include <linux/uaccess.h> +#include <linux/sched/debug.h> #include <asm/current.h> #include <asm/pgtable.h> #include <asm/tlbflush.h>
arch/unicore32/kernel/process.c +1 -0
@@ -13,6 +13,7 @@#include <linux/module.h> #include <linux/sched.h> +#include <linux/sched/debug.h> #include <linux/kernel.h> #include <linux/mm.h> #include <linux/stddef.h>
arch/unicore32/kernel/stacktrace.c +1 -0
@@ -11,6 +11,7 @@*/ #include <linux/module.h> #include <linux/sched.h> +#include <linux/sched/debug.h> #include <linux/stacktrace.h> #include <asm/stacktrace.h>
arch/unicore32/kernel/traps.c +1 -0
@@ -15,6 +15,7 @@#include <linux/module.h> #include <linux/signal.h> #include <linux/sched/signal.h> +#include <linux/sched/debug.h> #include <linux/spinlock.h> #include <linux/personality.h> #include <linux/kallsyms.h>
arch/unicore32/mm/alignment.c +1 -0
@@ -15,6 +15,7 @@*/ #include <linux/compiler.h> #include <linux/kernel.h> +#include <linux/sched/debug.h> #include <linux/errno.h> #include <linux/string.h> #include <linux/init.h>
arch/x86/kernel/amd_gart_64.c +1 -0
@@ -17,6 +17,7 @@#include <linux/init.h> #include <linux/mm.h> #include <linux/sched.h> +#include <linux/sched/debug.h> #include <linux/string.h> #include <linux/spinlock.h> #include <linux/pci.h>
arch/x86/kernel/doublefault.c +1 -0
@@ -1,5 +1,6 @@#include <linux/mm.h> #include <linux/sched.h> +#include <linux/sched/debug.h> #include <linux/init_task.h> #include <linux/fs.h>
arch/x86/kernel/dumpstack.c +1 -0
@@ -10,6 +10,7 @@#include <linux/kdebug.h> #include <linux/module.h> #include <linux/ptrace.h> +#include <linux/sched/debug.h> #include <linux/ftrace.h> #include <linux/kexec.h> #include <linux/bug.h>
arch/x86/kernel/dumpstack_32.c +1 -0
@@ -2,6 +2,7 @@* Copyright (C) 1991, 1992 Linus Torvalds * Copyright (C) 2000, 2001, 2002 Andi Kleen, SuSE Labs */ +#include <linux/sched/debug.h> #include <linux/kallsyms.h> #include <linux/kprobes.h> #include <linux/uaccess.h>
arch/x86/kernel/dumpstack_64.c +1 -0
@@ -2,6 +2,7 @@* Copyright (C) 1991, 1992 Linus Torvalds * Copyright (C) 2000, 2001, 2002 Andi Kleen, SuSE Labs */ +#include <linux/sched/debug.h> #include <linux/kallsyms.h> #include <linux/kprobes.h> #include <linux/uaccess.h>
arch/x86/kernel/kprobes/core.c +1 -0
@@ -45,6 +45,7 @@#include <linux/slab.h> #include <linux/hardirq.h> #include <linux/preempt.h> +#include <linux/sched/debug.h> #include <linux/extable.h> #include <linux/kdebug.h> #include <linux/kallsyms.h>
arch/x86/kernel/nmi.c +1 -0
@@ -13,6 +13,7 @@#include <linux/spinlock.h> #include <linux/kprobes.h> #include <linux/kdebug.h> +#include <linux/sched/debug.h> #include <linux/nmi.h> #include <linux/debugfs.h> #include <linux/delay.h>
arch/x86/kernel/process.c +1 -0
@@ -8,6 +8,7 @@#include <linux/slab.h> #include <linux/sched.h> #include <linux/sched/idle.h> +#include <linux/sched/debug.h> #include <linux/init.h> #include <linux/export.h> #include <linux/pm.h>
arch/x86/kernel/stacktrace.c +1 -0
@@ -4,6 +4,7 @@* Copyright (C) 2006-2009 Red Hat, Inc., Ingo Molnar <[email protected]> */ #include <linux/sched.h> +#include <linux/sched/debug.h> #include <linux/stacktrace.h> #include <linux/export.h> #include <linux/uaccess.h>
arch/x86/mm/extable.c +2 -0
@@ -1,5 +1,7 @@#include <linux/extable.h> #include <linux/uaccess.h> +#include <linux/sched/debug.h> +#include <asm/traps.h> #include <asm/kdebug.h>
arch/x86/platform/uv/uv_nmi.c +1 -0
@@ -27,6 +27,7 @@#include <linux/moduleparam.h> #include <linux/nmi.h> #include <linux/sched.h> +#include <linux/sched/debug.h> #include <linux/slab.h> #include <linux/clocksource.h>
arch/x86/um/sysrq_32.c +1 -0
@@ -6,6 +6,7 @@#include <linux/kernel.h> #include <linux/smp.h> #include <linux/sched.h> +#include <linux/sched/debug.h> #include <linux/kallsyms.h> #include <asm/ptrace.h> #include <asm/sysrq.h>
arch/x86/um/sysrq_64.c +1 -0
@@ -7,6 +7,7 @@#include <linux/kernel.h> #include <linux/module.h> #include <linux/sched.h> +#include <linux/sched/debug.h> #include <linux/utsname.h> #include <asm/current.h> #include <asm/ptrace.h>
arch/xtensa/kernel/process.c +1 -0
@@ -17,6 +17,7 @@#include <linux/errno.h> #include <linux/sched.h> +#include <linux/sched/debug.h> #include <linux/kernel.h> #include <linux/mm.h> #include <linux/smp.h>
arch/xtensa/kernel/traps.c +1 -0
@@ -25,6 +25,7 @@#include <linux/kernel.h> #include <linux/sched/signal.h> +#include <linux/sched/debug.h> #include <linux/init.h> #include <linux/module.h> #include <linux/stringify.h>
drivers/base/power/main.c +1 -0
@@ -27,6 +27,7 @@#include <linux/pm_wakeirq.h> #include <linux/interrupt.h> #include <linux/sched.h> +#include <linux/sched/debug.h> #include <linux/async.h> #include <linux/suspend.h> #include <trace/events/power.h>
drivers/tty/sysrq.c +2 -0
@@ -16,6 +16,8 @@#include <linux/sched/signal.h> #include <linux/sched/rt.h> +#include <linux/sched/debug.h> +#include <linux/sched/debug.h> #include <linux/interrupt.h> #include <linux/mm.h> #include <linux/fs.h>
drivers/tty/tty_ldsem.c +1 -0
@@ -32,6 +32,7 @@#include <linux/atomic.h> #include <linux/tty.h> #include <linux/sched.h> +#include <linux/sched/debug.h> #ifdef CONFIG_DEBUG_LOCK_ALLOC
drivers/tty/vt/keyboard.c +2 -0
@@ -27,6 +27,8 @@#include <linux/consolemap.h> #include <linux/module.h> #include <linux/sched/signal.h> +#include <linux/sched/debug.h> +#include <linux/sched/debug.h> #include <linux/tty.h> #include <linux/tty_flip.h> #include <linux/mm.h>
fs/proc/base.c +1 -0
@@ -88,6 +88,7 @@#include <linux/sched/autogroup.h> #include <linux/sched/mm.h> #include <linux/sched/coredump.h> +#include <linux/sched/debug.h> #include <linux/flex_array.h> #include <linux/posix-timers.h> #ifdef CONFIG_HARDWALL
include/linux/sched.h +0 -36
@@ -38,15 +38,9 @@ struct nameidata;struct signal_struct ;struct sighand_struct ; -extern void dump_cpu_task (int cpu); -struct seq_file ;struct cfs_rq ;struct task_group ; -#ifdef CONFIG_SCHED_DEBUG -extern void proc_sched_show_task (struct task_struct *p,struct seq_file *m); -extern void proc_sched_set_task (struct task_struct *p); -#endif /* * Task state bitmask. NOTE! These bits are also
@@ -191,25 +185,6 @@ extern cpumask_var_t cpu_isolated_map;extern int runqueue_is_locked (int cpu); -/* -* Only dump TASK_* tasks. (0 for all tasks) -*/ -extern void show_state_filter (unsigned long state_filter); - -static inline void show_state (void ) -{ -show_state_filter (0 ); -} - -extern void show_regs (struct pt_regs *); - -/* -* TASK is a pointer to the task whose backtrace we want to see (or NULL for current -* task), SP is the stack pointer of the first frame that should be shown in the back -* trace (or NULL if the entire call-chain of the task should be shown). -*/ -extern void show_stack (struct task_struct *task,unsigned long *sp); -extern void cpu_init (void );extern void trap_init (void );extern void update_process_times (int user);
@@ -224,17 +199,6 @@ extern int sched_cpu_dying(unsigned int cpu);# define sched_cpu_dying NULL#endif -extern void sched_show_task (struct task_struct *p); - -/* Attach to any functions which should be ignored in wchan output. */ -#define __sched __attribute__((__section__(".sched.text"))) - -/* Linker adds these: start and end of __sched functions */ -extern char __sched_text_start[], __sched_text_end[]; - -/* Is this address in the __sched functions? */ -extern int in_sched_functions (unsigned long addr); -#define MAX_SCHEDULE_TIMEOUT LONG_MAXextern signed long schedule_timeout (signed long timeout);extern signed long schedule_timeout_interruptible (signed long timeout);
include/linux/sched/debug.h new file +50 -0
50 lines not on this page · raw message
kernel/debug/kdb/kdb_bt.c +1 -0
@@ -13,6 +13,7 @@#include <linux/string.h> #include <linux/kernel.h> #include <linux/sched/signal.h> +#include <linux/sched/debug.h> #include <linux/kdb.h> #include <linux/nmi.h> #include "kdb_private.h"
kernel/debug/kdb/kdb_main.c +1 -0
@@ -20,6 +20,7 @@#include <linux/sched.h> #include <linux/sched/loadavg.h> #include <linux/sched/stat.h> +#include <linux/sched/debug.h> #include <linux/sysrq.h> #include <linux/smp.h> #include <linux/utsname.h>
kernel/hung_task.c +1 -0
@@ -17,6 +17,7 @@#include <linux/sysctl.h> #include <linux/utsname.h> #include <linux/sched/signal.h> +#include <linux/sched/debug.h> #include <trace/events/sched.h>
kernel/latencytop.c +1 -0
@@ -55,6 +55,7 @@#include <linux/latencytop.h> #include <linux/export.h> #include <linux/sched.h> +#include <linux/sched/debug.h> #include <linux/list.h> #include <linux/stacktrace.h>
kernel/locking/mutex.c +1 -0
@@ -22,6 +22,7 @@#include <linux/sched/signal.h> #include <linux/sched/rt.h> #include <linux/sched/wake_q.h> +#include <linux/sched/debug.h> #include <linux/export.h> #include <linux/spinlock.h> #include <linux/interrupt.h>
kernel/locking/rtmutex-debug.c +1 -0
@@ -18,6 +18,7 @@*/ #include <linux/sched.h> #include <linux/sched/rt.h> +#include <linux/sched/debug.h> #include <linux/delay.h> #include <linux/export.h> #include <linux/spinlock.h>
kernel/locking/rtmutex.c +1 -0
@@ -16,6 +16,7 @@#include <linux/sched/rt.h> #include <linux/sched/deadline.h> #include <linux/sched/wake_q.h> +#include <linux/sched/debug.h> #include <linux/timer.h> #include "rtmutex_common.h"
kernel/locking/rwsem-spinlock.c +1 -0
@@ -7,6 +7,7 @@*/ #include <linux/rwsem.h> #include <linux/sched/signal.h> +#include <linux/sched/debug.h> #include <linux/export.h> enum rwsem_waiter_type {
kernel/locking/rwsem-xadd.c +1 -0
@@ -15,6 +15,7 @@#include <linux/sched/signal.h> #include <linux/sched/rt.h> #include <linux/sched/wake_q.h> +#include <linux/sched/debug.h> #include <linux/osq_lock.h> #include "rwsem.h"
kernel/locking/rwsem.c +1 -0
@@ -7,6 +7,7 @@#include <linux/types.h> #include <linux/kernel.h> #include <linux/sched.h> +#include <linux/sched/debug.h> #include <linux/export.h> #include <linux/rwsem.h> #include <linux/atomic.h>
kernel/locking/semaphore.c +1 -0
@@ -29,6 +29,7 @@#include <linux/kernel.h> #include <linux/export.h> #include <linux/sched.h> +#include <linux/sched/debug.h> #include <linux/semaphore.h> #include <linux/spinlock.h> #include <linux/ftrace.h>
kernel/panic.c +1 -0
@@ -9,6 +9,7 @@* to indicate a major problem. */ #include <linux/debug_locks.h> +#include <linux/sched/debug.h> #include <linux/interrupt.h> #include <linux/kmsg_dump.h> #include <linux/kallsyms.h>
kernel/power/process.c +1 -0
@@ -12,6 +12,7 @@#include <linux/oom.h> #include <linux/suspend.h> #include <linux/module.h> +#include <linux/sched/debug.h> #include <linux/syscalls.h> #include <linux/freezer.h> #include <linux/delay.h>
kernel/printk/printk.c +1 -0
@@ -46,6 +46,7 @@#include <linux/ctype.h> #include <linux/uio.h> #include <linux/sched/clock.h> +#include <linux/sched/debug.h> #include <linux/uaccess.h> #include <asm/sections.h>
kernel/rcu/tree.c +1 -0
@@ -35,6 +35,7 @@#include <linux/rcupdate.h> #include <linux/interrupt.h> #include <linux/sched.h> +#include <linux/sched/debug.h> #include <linux/nmi.h> #include <linux/atomic.h> #include <linux/bitops.h>
kernel/rcu/tree_plugin.h +1 -0
@@ -27,6 +27,7 @@#include <linux/delay.h> #include <linux/gfp.h> #include <linux/oom.h> +#include <linux/sched/debug.h> #include <linux/smpboot.h> #include <uapi/linux/sched/types.h> #include "../time/tick-internal.h"
kernel/rcu/update.c +1 -0
@@ -37,6 +37,7 @@#include <linux/smp.h> #include <linux/interrupt.h> #include <linux/sched/signal.h> +#include <linux/sched/debug.h> #include <linux/atomic.h> #include <linux/bitops.h> #include <linux/percpu.h>
kernel/sched/completion.c +1 -0
@@ -12,6 +12,7 @@*/ #include <linux/sched/signal.h> +#include <linux/sched/debug.h> #include <linux/completion.h> /**
kernel/sched/sched.h +1 -1
@@ -11,6 +11,7 @@#include <linux/sched/cpufreq.h> #include <linux/sched/stat.h> #include <linux/sched/nohz.h> +#include <linux/sched/debug.h> #include <linux/u64_stats_sync.h> #include <linux/sched/deadline.h> #include <linux/kernel_stat.h>
@@ -1830,7 +1831,6 @@ extern void print_rt_stats(struct seq_file *m, int cpu);extern void print_dl_stats (struct seq_file *m,int cpu);extern void print_cfs_rq (struct seq_file *m,int cpu,struct cfs_rq *cfs_rq); -#ifdef CONFIG_NUMA_BALANCING extern void show_numa_stats (struct task_struct *p,struct seq_file *m);
kernel/sched/wait.c +1 -0
@@ -6,6 +6,7 @@#include <linux/init.h> #include <linux/export.h> #include <linux/sched/signal.h> +#include <linux/sched/debug.h> #include <linux/mm.h> #include <linux/wait.h> #include <linux/hash.h>
kernel/signal.c +1 -0
@@ -15,6 +15,7 @@#include <linux/init.h> #include <linux/sched.h> #include <linux/sched/user.h> +#include <linux/sched/debug.h> #include <linux/fs.h> #include <linux/tty.h> #include <linux/binfmts.h>
kernel/time/alarmtimer.c +1 -0
@@ -20,6 +20,7 @@#include <linux/timerqueue.h> #include <linux/rtc.h> #include <linux/sched/signal.h> +#include <linux/sched/debug.h> #include <linux/alarmtimer.h> #include <linux/mutex.h> #include <linux/platform_device.h>
kernel/time/hrtimer.c +1 -0
@@ -48,6 +48,7 @@#include <linux/sched/rt.h> #include <linux/sched/deadline.h> #include <linux/sched/nohz.h> +#include <linux/sched/debug.h> #include <linux/timer.h> #include <linux/freezer.h>
kernel/time/timer.c +1 -0
@@ -41,6 +41,7 @@#include <linux/sched/signal.h> #include <linux/sched/sysctl.h> #include <linux/sched/nohz.h> +#include <linux/sched/debug.h> #include <linux/slab.h> #include <linux/compat.h>
kernel/watchdog.c +1 -0
@@ -23,6 +23,7 @@#include <linux/tick.h> #include <linux/workqueue.h> #include <linux/sched/clock.h> +#include <linux/sched/debug.h> #include <asm/irq_regs.h> #include <linux/kvm_para.h>
kernel/watchdog_hld.c +2 -0
@@ -13,6 +13,8 @@#include <linux/nmi.h> #include <linux/module.h> +#include <linux/sched/debug.h> +#include <asm/irq_regs.h> #include <linux/perf_event.h>
lib/dump_stack.c +1 -0
@@ -6,6 +6,7 @@#include <linux/kernel.h> #include <linux/export.h> #include <linux/sched.h> +#include <linux/sched/debug.h> #include <linux/smp.h> #include <linux/atomic.h>
lib/nmi_backtrace.c +1 -0
@@ -17,6 +17,7 @@#include <linux/kprobes.h> #include <linux/nmi.h> #include <linux/cpu.h> +#include <linux/sched/debug.h> #ifdef arch_trigger_cpumask_backtrace/* For reliability, we're prepared to waste bits here. */
Signature · 1 line
2.7.4
Ingo Molnar
maintainerPATCH 51/89 sched/headers: Split hotplug CPU interfaces out of <linux/sched.h> into <linux/sched/hotplug.h>
In reply to Ingo MolnarSplit the CPU hotplug scheduler APIs out of the common header and update the usage sites.
--- arch/arm/kernel/smp.c | 1 + arch/arm64/include/asm/mmu_context.h | 1 + arch/arm64/kernel/smp.c | 1 + arch/ia64/kernel/process.c | 1 + arch/metag/kernel/smp.c | 1 + arch/mips/cavium-octeon/smp.c | 1 + arch/mips/kernel/smp-bmips.c | 1 + arch/mips/kernel/smp-cps.c | 1 + arch/mips/loongson64/loongson-3/smp.c | 1 + arch/powerpc/platforms/85xx/smp.c | 1 + arch/powerpc/platforms/powermac/smp.c | 1 + arch/powerpc/platforms/powernv/smp.c | 1 + arch/powerpc/platforms/pseries/hotplug-cpu.c | 1 + arch/s390/kernel/smp.c | 1 + arch/sh/kernel/smp.c | 1 + arch/sparc/kernel/smp_64.c | 1 + arch/x86/kernel/smpboot.c | 1 + arch/xtensa/kernel/smp.c | 1 + include/linux/sched.h | 15 --------------- include/linux/sched/hotplug.h | 24 ++++++++++++++++++++++++ kernel/cpu.c | 1 + kernel/sched/core.c | 1 + kernel/sched/sched.h | 4 +++- 23 files changed, 47 insertions(+), 16 deletions(-)
arch/arm/kernel/smp.c +1 -0
@@ -12,6 +12,7 @@#include <linux/init.h> #include <linux/spinlock.h> #include <linux/sched.h> +#include <linux/sched/hotplug.h> #include <linux/interrupt.h> #include <linux/cache.h> #include <linux/profile.h>
arch/arm64/include/asm/mmu_context.h +1 -0
@@ -21,6 +21,7 @@#include <linux/compiler.h> #include <linux/sched.h> +#include <linux/sched/hotplug.h> #include <asm/cacheflush.h> #include <asm/cpufeature.h>
arch/arm64/kernel/smp.c +1 -0
@@ -22,6 +22,7 @@#include <linux/init.h> #include <linux/spinlock.h> #include <linux/sched.h> +#include <linux/sched/hotplug.h> #include <linux/interrupt.h> #include <linux/cache.h> #include <linux/profile.h>
arch/ia64/kernel/process.c +1 -0
@@ -21,6 +21,7 @@#include <linux/personality.h> #include <linux/sched.h> #include <linux/sched/debug.h> +#include <linux/sched/hotplug.h> #include <linux/stddef.h> #include <linux/thread_info.h> #include <linux/unistd.h>
arch/metag/kernel/smp.c +1 -0
@@ -13,6 +13,7 @@#include <linux/init.h> #include <linux/spinlock.h> #include <linux/sched.h> +#include <linux/sched/hotplug.h> #include <linux/interrupt.h> #include <linux/cache.h> #include <linux/profile.h>
arch/mips/cavium-octeon/smp.c +1 -0
@@ -11,6 +11,7 @@#include <linux/interrupt.h> #include <linux/kernel_stat.h> #include <linux/sched.h> +#include <linux/sched/hotplug.h> #include <linux/module.h> #include <asm/mmu_context.h>
arch/mips/kernel/smp-bmips.c +1 -0
@@ -10,6 +10,7 @@#include <linux/init.h> #include <linux/sched.h> +#include <linux/sched/hotplug.h> #include <linux/mm.h> #include <linux/delay.h> #include <linux/smp.h>
arch/mips/kernel/smp-cps.c +1 -0
@@ -12,6 +12,7 @@#include <linux/io.h> #include <linux/irqchip/mips-gic.h> #include <linux/sched.h> +#include <linux/sched/hotplug.h> #include <linux/slab.h> #include <linux/smp.h> #include <linux/types.h>
arch/mips/loongson64/loongson-3/smp.c +1 -0
@@ -17,6 +17,7 @@#include <linux/init.h> #include <linux/cpu.h> #include <linux/sched.h> +#include <linux/sched/hotplug.h> #include <linux/smp.h> #include <linux/cpufreq.h> #include <asm/processor.h>
arch/powerpc/platforms/85xx/smp.c +1 -0
@@ -12,6 +12,7 @@#include <linux/stddef.h> #include <linux/kernel.h> +#include <linux/sched/hotplug.h> #include <linux/init.h> #include <linux/delay.h> #include <linux/of.h>
arch/powerpc/platforms/powermac/smp.c +1 -0
@@ -23,6 +23,7 @@*/ #include <linux/kernel.h> #include <linux/sched.h> +#include <linux/sched/hotplug.h> #include <linux/smp.h> #include <linux/interrupt.h> #include <linux/kernel_stat.h>
arch/powerpc/platforms/powernv/smp.c +1 -0
@@ -12,6 +12,7 @@#include <linux/kernel.h> #include <linux/module.h> #include <linux/sched.h> +#include <linux/sched/hotplug.h> #include <linux/smp.h> #include <linux/interrupt.h> #include <linux/delay.h>
arch/powerpc/platforms/pseries/hotplug-cpu.c +1 -0
@@ -24,6 +24,7 @@#include <linux/interrupt.h> #include <linux/delay.h> #include <linux/sched.h> /* for idle_task_exit */ +#include <linux/sched/hotplug.h> #include <linux/cpu.h> #include <linux/of.h> #include <linux/slab.h>
arch/s390/kernel/smp.c +1 -0
@@ -31,6 +31,7 @@#include <linux/irqflags.h> #include <linux/cpu.h> #include <linux/slab.h> +#include <linux/sched/hotplug.h> #include <linux/crash_dump.h> #include <linux/memblock.h> #include <asm/asm-offsets.h>
arch/sh/kernel/smp.c +1 -0
@@ -21,6 +21,7 @@#include <linux/cpu.h> #include <linux/interrupt.h> #include <linux/sched.h> +#include <linux/sched/hotplug.h> #include <linux/atomic.h> #include <linux/clockchips.h> #include <asm/processor.h>
arch/sparc/kernel/smp_64.c +1 -0
@@ -6,6 +6,7 @@#include <linux/export.h> #include <linux/kernel.h> #include <linux/sched.h> +#include <linux/sched/hotplug.h> #include <linux/mm.h> #include <linux/pagemap.h> #include <linux/threads.h>
arch/x86/kernel/smpboot.c +1 -0
@@ -46,6 +46,7 @@#include <linux/export.h> #include <linux/sched.h> #include <linux/sched/topology.h> +#include <linux/sched/hotplug.h> #include <linux/percpu.h> #include <linux/bootmem.h> #include <linux/err.h>
arch/xtensa/kernel/smp.c +1 -0
@@ -21,6 +21,7 @@#include <linux/irq.h> #include <linux/kdebug.h> #include <linux/module.h> +#include <linux/sched/hotplug.h> #include <linux/reboot.h> #include <linux/seq_file.h> #include <linux/smp.h>
include/linux/sched.h +0 -15
@@ -188,15 +188,6 @@ extern void cpu_init (void);extern void trap_init (void );extern void update_process_times (int user);extern void scheduler_tick (void ); -extern int sched_cpu_starting (unsigned int cpu); -extern int sched_cpu_activate (unsigned int cpu); -extern int sched_cpu_deactivate (unsigned int cpu); - -#ifdef CONFIG_HOTPLUG_CPU -extern int sched_cpu_dying (unsigned int cpu); -#else -# define sched_cpu_dying NULL -#endif #define MAX_SCHEDULE_TIMEOUT LONG_MAXextern signed long schedule_timeout (signed long timeout);
@@ -1492,12 +1483,6 @@ extern void sched_exec(void);#define sched_exec () {}#endif -#ifdef CONFIG_HOTPLUG_CPU -extern void idle_task_exit (void ); -#else -static inline void idle_task_exit (void ) {} -#endif -extern int yield_to (struct task_struct *p,bool preempt);extern void set_user_nice (struct task_struct *p,long nice);extern int task_prio (const struct task_struct *p);
include/linux/sched/hotplug.h new file +24 -0
@@ -0,0 +1,24 @@ +#ifndef _LINUX_SCHED_HOTPLUG_H +#define _LINUX_SCHED_HOTPLUG_H + +/* +* Scheduler interfaces for hotplug CPU support: +*/ + +extern int sched_cpu_starting (unsigned int cpu); +extern int sched_cpu_activate (unsigned int cpu); +extern int sched_cpu_deactivate (unsigned int cpu); + +#ifdef CONFIG_HOTPLUG_CPU +extern int sched_cpu_dying (unsigned int cpu); +#else +# define sched_cpu_dying NULL +#endif + +#ifdef CONFIG_HOTPLUG_CPU +extern void idle_task_exit (void ); +#else +static inline void idle_task_exit (void ) {} +#endif + +#endif /* _LINUX_SCHED_HOTPLUG_H */
kernel/cpu.c +1 -0
@@ -8,6 +8,7 @@#include <linux/init.h> #include <linux/notifier.h> #include <linux/sched/signal.h> +#include <linux/sched/hotplug.h> #include <linux/unistd.h> #include <linux/cpu.h> #include <linux/oom.h>
kernel/sched/core.c +1 -0
@@ -10,6 +10,7 @@#include <linux/sched.h> #include <linux/sched/clock.h> #include <linux/sched/loadavg.h> +#include <linux/sched/hotplug.h> #include <linux/cpuset.h> #include <linux/delayacct.h> #include <linux/init_task.h>
kernel/sched/sched.h +3 -1
@@ -3,6 +3,7 @@#include <linux/sched/sysctl.h> #include <linux/sched/topology.h> #include <linux/sched/rt.h> +#include <linux/sched/deadline.h> #include <linux/sched/clock.h> #include <linux/sched/wake_q.h> #include <linux/sched/signal.h>
@@ -12,8 +13,9 @@#include <linux/sched/stat.h> #include <linux/sched/nohz.h> #include <linux/sched/debug.h> +#include <linux/sched/hotplug.h> +#include <linux/u64_stats_sync.h> -#include <linux/sched/deadline.h> #include <linux/kernel_stat.h> #include <linux/binfmts.h> #include <linux/mutex.h>
Signature · 1 line
2.7.4
Ingo Molnar
maintainerPATCH 50/89 sched/core: Convert ___assert_task_state() link time assert to BUILD_BUG_ON()
In reply to Ingo MolnarThe length of TASK_STATE_TO_CHAR_STR was still checked using the old link-time manual error method - convert it to BUILD_BUG_ON(). This has a couple of advantages:
- it's more obvious what's going on
- it reduces the size and complexity of <linux/sched.h>
- BUILD_BUG_ON() will fail during compilation, with a clearer error message than the link time assert.
--- include/linux/sched.h | 3 --- kernel/sched/core.c | 3 +++ 2 files changed, 3 insertions(+), 3 deletions(-)
include/linux/sched.h +0 -3
@@ -74,9 +74,6 @@ struct task_group;#define TASK_STATE_TO_CHAR_STR "RSDTtXZxKWPNn" -extern char ___assert_task_state[1 -2 *!!( -sizeof (TASK_STATE_TO_CHAR_STR )-1 !=ilog2 (TASK_STATE_MAX )+1 )]; -/* Convenience macros for the sake of set_current_state */ #define TASK_KILLABLE (TASK_WAKEKILL | TASK_UNINTERRUPTIBLE)#define TASK_STOPPED (TASK_WAKEKILL | __TASK_STOPPED)
kernel/sched/core.c +3 -0
@@ -5233,6 +5233,9 @@ void sched_show_task(struct task_struct *p)int ppid;unsigned long state = p->state; +/* Make sure the string lines up properly with the number of task states: */ +BUILD_BUG_ON (sizeof (TASK_STATE_TO_CHAR_STR )-1 !=ilog2 (TASK_STATE_MAX )+1 ); +if (!try_get_task_stack (p))return ;if (state)
Signature · 1 line
2.7.4
Ingo Molnar
maintainerPATCH 54/89 sched/headers: Make the include/linux/sched/*.h headers build standalone
In reply to Ingo MolnarMake each header self-sufficient, so that it can be built successfully both in an allnoconfig and allyesconfig kernel.
Also standardize the naming of their header guards.
--- include/linux/sched/autogroup.h | 1 + include/linux/sched/clock.h | 2 ++ include/linux/sched/cpufreq.h | 2 ++ include/linux/sched/deadline.h | 8 +++++--- include/linux/sched/idle.h | 2 ++ include/linux/sched/jobctl.h | 4 ++++ include/linux/sched/prio.h | 6 +++--- include/linux/sched/rt.h | 10 ++++++---- include/linux/sched/stat.h | 2 ++ include/linux/sched/sysctl.h | 10 +++++++--- include/linux/sched/user.h | 1 + include/linux/sched/wake_q.h | 3 +++ 12 files changed, 38 insertions(+), 13 deletions(-)
include/linux/sched/autogroup.h +1 -0
@@ -2,6 +2,7 @@#define _LINUX_SCHED_AUTOGROUP_Hstruct signal_struct ; +struct task_struct ;struct seq_file ;#ifdef CONFIG_SCHED_AUTOGROUP
include/linux/sched/clock.h +2 -0
@@ -1,6 +1,8 @@#ifndef _LINUX_SCHED_CLOCK_H#define _LINUX_SCHED_CLOCK_H +#include <linux/smp.h> +/* * Do not use outside of architecture code which knows its limitations. *
include/linux/sched/cpufreq.h +2 -0
@@ -1,6 +1,8 @@#ifndef _LINUX_SCHED_CPUFREQ_H#define _LINUX_SCHED_CPUFREQ_H +#include <linux/types.h> +/* * Interface between cpufreq drivers and the scheduler: */
include/linux/sched/deadline.h +5 -3
@@ -1,5 +1,7 @@ -#ifndef _SCHED_DEADLINE_H -#define _SCHED_DEADLINE_H +#ifndef _LINUX_SCHED_DEADLINE_H +#define _LINUX_SCHED_DEADLINE_H + +#include <linux/sched.h> /* * SCHED_DEADLINE tasks has negative priorities, reflecting
@@ -26,4 +28,4 @@ static inline bool dl_time_before(u64 a, u64 b) return (s64)(a - b) < 0; } -#endif /* _SCHED_DEADLINE_H */ +#endif /* _LINUX_SCHED_DEADLINE_H */
include/linux/sched/idle.h +2 -0
@@ -1,6 +1,8 @@#ifndef _LINUX_SCHED_IDLE_H#define _LINUX_SCHED_IDLE_H +#include <linux/sched.h> +enum cpu_idle_type {CPU_IDLE , CPU_NOT_IDLE,
include/linux/sched/jobctl.h +4 -0
@@ -1,6 +1,10 @@#ifndef _LINUX_SCHED_JOBCTL_H#define _LINUX_SCHED_JOBCTL_H +#include <linux/types.h> + +struct task_struct ; +/* * task->jobctl flags */
include/linux/sched/prio.h +3 -3
@@ -1,5 +1,5 @@ -#ifndef _SCHED_PRIO_H -#define _SCHED_PRIO_H +#ifndef _LINUX_SCHED_PRIO_H +#define _LINUX_SCHED_PRIO_H#define MAX_NICE 19#define MIN_NICE -20
@@ -57,4 +57,4 @@ static inline long rlimit_to_nice(long prio) return (MAX_NICE - prio + 1); } -#endif /* _SCHED_PRIO_H */ +#endif /* _LINUX_SCHED_PRIO_H */
include/linux/sched/rt.h +6 -4
@@ -1,7 +1,9 @@ -#ifndef _SCHED_RT_H -#define _SCHED_RT_H +#ifndef _LINUX_SCHED_RT_H +#define _LINUX_SCHED_RT_H -#include <linux/sched/prio.h> +#include <linux/sched.h> + +struct task_struct ;static inline int rt_prio (int prio) {
@@ -57,4 +59,4 @@ extern void normalize_rt_tasks(void);*/ #define RR_TIMESLICE (100 * HZ / 1000) -#endif /* _SCHED_RT_H */ +#endif /* _LINUX_SCHED_RT_H */
include/linux/sched/stat.h +2 -0
@@ -1,6 +1,8 @@#ifndef _LINUX_SCHED_STAT_H#define _LINUX_SCHED_STAT_H +#include <linux/percpu.h> +/* * Various counters maintained by the scheduler and fork(), * exposed via /proc, sys.c or used by drivers via these APIs.
include/linux/sched/sysctl.h +7 -3
@@ -1,5 +1,9 @@ -#ifndef _SCHED_SYSCTL_H -#define _SCHED_SYSCTL_H +#ifndef _LINUX_SCHED_SYSCTL_H +#define _LINUX_SCHED_SYSCTL_H + +#include <linux/types.h> + +struct ctl_table ;#ifdef CONFIG_DETECT_HUNG_TASK extern int sysctl_hung_task_check_count;
@@ -78,4 +82,4 @@ extern int sysctl_schedstats(struct ctl_table *table, int write, void __user *buffer, size_t *lenp, loff_t *ppos); -#endif /* _SCHED_SYSCTL_H */ +#endif /* _LINUX_SCHED_SYSCTL_H */
include/linux/sched/user.h +1 -0
@@ -2,6 +2,7 @@#define _LINUX_SCHED_USER_H#include <linux/uidgid.h> +#include <linux/atomic.h> struct key ;
include/linux/sched/wake_q.h +3 -0
@@ -27,6 +27,9 @@* must ensure the call is done inside a loop, confirming that the * wakeup condition has in fact occurred. */ + +struct task_struct ; +struct wake_q_node {struct wake_q_node *next; };
Signature · 1 line
2.7.4
Ingo Molnar
maintainerPATCH 66/89 sched/headers: Use <linux/rcuupdate.h> instead of <linux/rculist.h> in <linux/sched.h>
In reply to Ingo MolnarWe don't actually need the full rculist.h header anymore, include the smaller rcupdate.h header instead.
Update code that relied on the implicit header inclusion.
--- arch/powerpc/kvm/book3s_mmu_hpte.c | 1 + arch/x86/kvm/irq_comm.c | 2 ++ arch/x86/kvm/page_track.c | 2 ++ drivers/md/bcache/btree.c | 2 ++ drivers/misc/vmw_vmci/vmci_event.c | 1 + drivers/nvme/target/admin-cmd.c | 2 ++ drivers/nvme/target/core.c | 2 ++ drivers/s390/cio/qdio_thinint.c | 2 ++ drivers/scsi/libfc/fc_disc.c | 2 ++ drivers/scsi/libfc/fc_rport.c | 2 ++ include/linux/dmar.h | 2 +- include/linux/pid.h | 2 +- include/linux/rhashtable.h | 2 +- include/linux/sched.h | 2 +- include/linux/sched/signal.h | 1 + include/net/bluetooth/hci_core.h | 2 ++ kernel/trace/trace_events_hist.c | 1 + kernel/trace/trace_events_trigger.c | 1 + kernel/trace/trace_kprobe.c | 1 + kernel/trace/trace_uprobe.c | 1 + lib/bug.c | 1 + lib/rhashtable.c | 1 + net/mac80211/mesh_plink.c | 2 ++ net/mac802154/llsec.c | 2 ++ security/apparmor/policy.c | 1 + security/tomoyo/domain.c | 2 ++ security/tomoyo/group.c | 2 ++ security/tomoyo/util.c | 2 ++ 28 files changed, 42 insertions(+), 4 deletions(-)
arch/powerpc/kvm/book3s_mmu_hpte.c +1 -0
@@ -21,6 +21,7 @@#include <linux/kvm_host.h> #include <linux/hash.h> #include <linux/slab.h> +#include <linux/rculist.h> #include <asm/kvm_ppc.h> #include <asm/kvm_book3s.h>
arch/x86/kvm/irq_comm.c +2 -0
@@ -23,6 +23,8 @@#include <linux/kvm_host.h> #include <linux/slab.h> #include <linux/export.h> +#include <linux/rculist.h> +#include <trace/events/kvm.h> #include <asm/msidef.h>
arch/x86/kvm/page_track.c +2 -0
@@ -14,6 +14,8 @@*/ #include <linux/kvm_host.h> +#include <linux/rculist.h> +#include <asm/kvm_host.h> #include <asm/kvm_page_track.h>
drivers/md/bcache/btree.c +2 -0
@@ -33,6 +33,8 @@#include <linux/random.h> #include <linux/rcupdate.h> #include <linux/sched/clock.h> +#include <linux/rculist.h> +#include <trace/events/bcache.h> /*
drivers/misc/vmw_vmci/vmci_event.c +1 -0
@@ -19,6 +19,7 @@#include <linux/module.h> #include <linux/sched.h> #include <linux/slab.h> +#include <linux/rculist.h> #include "vmci_driver.h" #include "vmci_event.h"
drivers/nvme/target/admin-cmd.c +2 -0
@@ -13,6 +13,8 @@*/ #define pr_fmt (fmt) KBUILD_MODNAME ": " fmt#include <linux/module.h> +#include <linux/rculist.h> +#include <generated/utsrelease.h> #include <asm/unaligned.h> #include "nvmet.h"
drivers/nvme/target/core.c +2 -0
@@ -14,6 +14,8 @@#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt#include <linux/module.h> #include <linux/random.h> +#include <linux/rculist.h> +#include "nvmet.h" static struct nvmet_fabrics_ops *nvmet_transports[NVMF_TRTYPE_MAX ];
drivers/s390/cio/qdio_thinint.c +2 -0
@@ -8,6 +8,8 @@#include <linux/slab.h> #include <linux/kernel_stat.h> #include <linux/atomic.h> +#include <linux/rculist.h> +#include <asm/debug.h> #include <asm/qdio.h> #include <asm/airq.h>
drivers/scsi/libfc/fc_disc.c +2 -0
@@ -36,6 +36,8 @@#include <linux/slab.h> #include <linux/err.h> #include <linux/export.h> +#include <linux/rculist.h> +#include <asm/unaligned.h> #include <scsi/fc/fc_gs.h>
drivers/scsi/libfc/fc_rport.c +2 -0
@@ -65,6 +65,8 @@#include <linux/timer.h> #include <linux/workqueue.h> #include <linux/export.h> +#include <linux/rculist.h> +#include <asm/unaligned.h> #include <scsi/libfc.h>
include/linux/dmar.h +1 -1
@@ -26,7 +26,7 @@#include <linux/msi.h> #include <linux/irqreturn.h> #include <linux/rwsem.h> -#include <linux/rcupdate.h> +#include <linux/rculist.h> struct acpi_dmar_header ;
include/linux/pid.h +1 -1
@@ -1,7 +1,7 @@#ifndef _LINUX_PID_H#define _LINUX_PID_H -#include <linux/rcupdate.h> +#include <linux/rculist.h> enum pid_type {
include/linux/rhashtable.h +1 -1
@@ -25,7 +25,7 @@#include <linux/list_nulls.h> #include <linux/workqueue.h> #include <linux/mutex.h> -#include <linux/rcupdate.h> +#include <linux/rculist.h> /* * The end of the chain is marked with a special nulls marks which has
include/linux/sched.h +1 -1
@@ -13,7 +13,7 @@#include <linux/signal_types.h> #include <linux/pid.h> #include <linux/seccomp.h> -#include <linux/rculist.h> +#include <linux/rcupdate.h> #include <linux/resource.h> #include <linux/hrtimer.h>
include/linux/sched/signal.h +1 -0
@@ -1,6 +1,7 @@#ifndef _LINUX_SCHED_SIGNAL_H#define _LINUX_SCHED_SIGNAL_H +#include <linux/rculist.h> #include <linux/signal.h> #include <linux/sched.h> #include <linux/sched/jobctl.h>
include/net/bluetooth/hci_core.h +2 -0
@@ -26,6 +26,8 @@#define __HCI_CORE_H#include <linux/leds.h> +#include <linux/rculist.h> +#include <net/bluetooth/hci.h> #include <net/bluetooth/hci_sock.h>
kernel/trace/trace_events_hist.c +1 -0
@@ -19,6 +19,7 @@#include <linux/mutex.h> #include <linux/slab.h> #include <linux/stacktrace.h> +#include <linux/rculist.h> #include "tracing_map.h" #include "trace.h"
kernel/trace/trace_events_trigger.c +1 -0
@@ -22,6 +22,7 @@#include <linux/ctype.h> #include <linux/mutex.h> #include <linux/slab.h> +#include <linux/rculist.h> #include "trace.h"
kernel/trace/trace_kprobe.c +1 -0
@@ -19,6 +19,7 @@#include <linux/module.h> #include <linux/uaccess.h> +#include <linux/rculist.h> #include "trace_probe.h"
kernel/trace/trace_uprobe.c +1 -0
@@ -23,6 +23,7 @@#include <linux/uprobes.h> #include <linux/namei.h> #include <linux/string.h> +#include <linux/rculist.h> #include "trace_probe.h"
lib/bug.c +1 -0
@@ -45,6 +45,7 @@#include <linux/kernel.h> #include <linux/bug.h> #include <linux/sched.h> +#include <linux/rculist.h> extern const struct bug_entry __start___bug_table[], __stop___bug_table[];
lib/rhashtable.c +1 -0
@@ -19,6 +19,7 @@#include <linux/init.h> #include <linux/log2.h> #include <linux/sched.h> +#include <linux/rculist.h> #include <linux/slab.h> #include <linux/vmalloc.h> #include <linux/mm.h>
net/mac80211/mesh_plink.c +2 -0
@@ -9,6 +9,8 @@#include <linux/gfp.h> #include <linux/kernel.h> #include <linux/random.h> +#include <linux/rculist.h> +#include "ieee80211_i.h" #include "rate.h" #include "mesh.h"
net/mac802154/llsec.c +2 -0
@@ -18,6 +18,8 @@#include <linux/bug.h> #include <linux/completion.h> #include <linux/ieee802154.h> +#include <linux/rculist.h> +#include <crypto/aead.h> #include <crypto/skcipher.h>
security/apparmor/policy.c +1 -0
@@ -77,6 +77,7 @@#include <linux/spinlock.h> #include <linux/string.h> #include <linux/cred.h> +#include <linux/rculist.h> #include "include/apparmor.h" #include "include/capability.h"
security/tomoyo/domain.c +2 -0
@@ -5,8 +5,10 @@*/ #include "common.h" +#include <linux/binfmts.h> #include <linux/slab.h> +#include <linux/rculist.h> /* Variables definitions.*/
security/tomoyo/group.c +2 -0
@@ -5,6 +5,8 @@*/ #include <linux/slab.h> +#include <linux/rculist.h> +#include "common.h" /**
security/tomoyo/util.c +2 -0
@@ -5,6 +5,8 @@*/ #include <linux/slab.h> +#include <linux/rculist.h> +#include "common.h" /* Lock for protecting policy. */
Signature · 1 line
2.7.4
Ingo Molnar
maintainerPATCH 75/89 sched/headers, timekeeping: Consolidate the timer tick function prototypes
In reply to Ingo MolnarMove the update_process_times() and xtime_update() prototypes to <linux/timekeeping.h>.
--- include/linux/sched.h | 1 - include/linux/time.h | 2 -- include/linux/timekeeping.h | 4 ++++ 3 files changed, 4 insertions(+), 3 deletions(-)
include/linux/sched.h +0 -1
@@ -170,7 +170,6 @@ struct uts_namespace;extern cpumask_var_t cpu_isolated_map; -extern void update_process_times (int user);extern void scheduler_tick (void );#define MAX_SCHEDULE_TIMEOUT LONG_MAX
include/linux/time.h +0 -2
@@ -167,8 +167,6 @@ static inline bool timespec_inject_offset_valid(const struct timespec *ts)extern u32 (*arch_gettimeoffset)(void );#endif -extern void xtime_update (unsigned long ticks); -struct itimerval ;extern int do_setitimer (int which,struct itimerval *value,struct itimerval *ovalue);
include/linux/timekeeping.h +4 -0
@@ -8,6 +8,10 @@void timekeeping_init (void );extern int timekeeping_suspended; +/* Architecture timer tick functions: */ +extern void update_process_times (int user); +extern void xtime_update (unsigned long ticks); +/* * Get and set timeofday */
Signature · 1 line
2.7.4
Ingo Molnar
maintainerPATCH 78/89 sched/core: Remove the tsk_cpus_allowed() wrapper
In reply to Ingo MolnarSo the original intention of tsk_cpus_allowed() was to 'future-proof' the field - but it's pretty ineffectual at that, because half of the code uses ->cpus_allowed directly ...
Also, the wrapper makes the code longer than the original expression!
So just get rid of it. This also shrinks <linux/sched.h> a bit.
--- arch/powerpc/kernel/smp.c | 2 +- arch/powerpc/platforms/cell/spufs/sched.c | 2 +- arch/sparc/kernel/sysfs.c | 2 +- drivers/cpufreq/sparc-us2e-cpufreq.c | 4 ++-- drivers/cpufreq/sparc-us3-cpufreq.c | 4 ++-- drivers/infiniband/hw/hfi1/affinity.c | 2 +- drivers/infiniband/hw/hfi1/sdma.c | 2 +- include/linux/sched.h | 3 --- kernel/sched/core.c | 20 ++++++++++---------- kernel/sched/cpudeadline.c | 4 ++-- kernel/sched/cpupri.c | 4 ++-- kernel/sched/deadline.c | 7 +++---- kernel/sched/fair.c | 25 ++++++++++++------------- kernel/sched/rt.c | 5 ++--- lib/smp_processor_id.c | 2 +- samples/trace_events/trace-events-sample.c | 2 +- 16 files changed, 42 insertions(+), 48 deletions(-)
arch/powerpc/kernel/smp.c +1 -1
@@ -796,7 +796,7 @@ void __init smp_cpus_done(unsigned int max_cpus)* se we pin us down to CPU 0 for a short while */ alloc_cpumask_var (&old_mask,GFP_NOWAIT ); -cpumask_copy (old_mask,tsk_cpus_allowed (current)); +cpumask_copy (old_mask, ¤t->cpus_allowed);set_cpus_allowed_ptr (current,cpumask_of (boot_cpuid));if (smp_ops && smp_ops->setup_cpu)
arch/powerpc/platforms/cell/spufs/sched.c +1 -1
@@ -141,7 +141,7 @@ void __spu_update_sched_info(struct spu_context *ctx)* runqueue. The context will be rescheduled on the proper node * if it is timesliced or preempted. */ -cpumask_copy (&ctx->cpus_allowed,tsk_cpus_allowed (current)); +cpumask_copy (&ctx->cpus_allowed, ¤t->cpus_allowed);/* Save the current cpu id for spu interrupt routing. */ ctx->last_ran =raw_smp_processor_id ();
arch/sparc/kernel/sysfs.c +1 -1
@@ -106,7 +106,7 @@ static unsigned long run_on_cpu(unsigned long cpu,cpumask_t old_affinity;unsigned long ret; -cpumask_copy (&old_affinity,tsk_cpus_allowed (current)); +cpumask_copy (&old_affinity, ¤t->cpus_allowed);/* should return -EINVAL to userspace */ if (set_cpus_allowed_ptr (current,cpumask_of (cpu)))return 0 ;
drivers/cpufreq/sparc-us2e-cpufreq.c +2 -2
@@ -234,7 +234,7 @@ static unsigned int us2e_freq_get(unsigned int cpu)cpumask_t cpus_allowed;unsigned long clock_tick, estar; -cpumask_copy (&cpus_allowed,tsk_cpus_allowed (current)); +cpumask_copy (&cpus_allowed, ¤t->cpus_allowed);set_cpus_allowed_ptr (current,cpumask_of (cpu)); clock_tick =sparc64_get_clock_tick (cpu) /1000 ;
@@ -252,7 +252,7 @@ static int us2e_freq_target(struct cpufreq_policy *policy, unsigned int index)unsigned long clock_tick, divisor, old_divisor, estar;cpumask_t cpus_allowed; -cpumask_copy (&cpus_allowed,tsk_cpus_allowed (current)); +cpumask_copy (&cpus_allowed, ¤t->cpus_allowed);set_cpus_allowed_ptr (current,cpumask_of (cpu)); new_freq = clock_tick =sparc64_get_clock_tick (cpu) /1000 ;
drivers/cpufreq/sparc-us3-cpufreq.c +2 -2
@@ -82,7 +82,7 @@ static unsigned int us3_freq_get(unsigned int cpu)unsigned long reg;unsigned int ret; -cpumask_copy (&cpus_allowed,tsk_cpus_allowed (current)); +cpumask_copy (&cpus_allowed, ¤t->cpus_allowed);set_cpus_allowed_ptr (current,cpumask_of (cpu)); reg =read_safari_cfg ();
@@ -99,7 +99,7 @@ static int us3_freq_target(struct cpufreq_policy *policy, unsigned int index)unsigned long new_bits, new_freq, reg;cpumask_t cpus_allowed; -cpumask_copy (&cpus_allowed,tsk_cpus_allowed (current)); +cpumask_copy (&cpus_allowed, ¤t->cpus_allowed);set_cpus_allowed_ptr (current,cpumask_of (cpu)); new_freq =sparc64_get_clock_tick (cpu) /1000 ;
drivers/infiniband/hw/hfi1/affinity.c +1 -1
@@ -576,7 +576,7 @@ int hfi1_get_proc_affinity(int node)struct hfi1_affinity_node *entry;cpumask_var_t diff, hw_thread_mask, available_mask, intrs_mask;const struct cpumask *node_mask, - *proc_mask =tsk_cpus_allowed (current); + *proc_mask = ¤t->cpus_allowed;struct hfi1_affinity_node_list *affinity = &node_affinity;struct cpu_mask_set *set = &affinity->proc;
drivers/infiniband/hw/hfi1/sdma.c +1 -1
@@ -856,7 +856,7 @@ struct sdma_engine *sdma_select_user_engine(struct hfi1_devdata *dd, {struct sdma_rht_node *rht_node;struct sdma_engine *sde =NULL ; -const struct cpumask *current_mask =tsk_cpus_allowed (current); +const struct cpumask *current_mask = ¤t->cpus_allowed;unsigned long cpu_id;/*
include/linux/sched.h +0 -3
@@ -962,9 +962,6 @@ struct task_struct {*/ }; -/* Future-safe accessor for struct task_struct's cpus_allowed. */ -#define tsk_cpus_allowed (tsk) (&(tsk)->cpus_allowed) -static inline int tsk_nr_cpus_allowed (struct task_struct *p) {return p->nr_cpus_allowed;
kernel/sched/core.c +10 -10
@@ -983,7 +983,7 @@ static struct rq *__migrate_task(struct rq *rq, struct task_struct *p, int dest_return rq;/* Affinity changed (again). */ -if (!cpumask_test_cpu (dest_cpu,tsk_cpus_allowed (p))) +if (!cpumask_test_cpu (dest_cpu, &p->cpus_allowed))return rq; rq =move_queued_task (rq, p, dest_cpu);
@@ -1260,10 +1260,10 @@ static int migrate_swap_stop(void *data)if (task_cpu (arg->src_task) != arg->src_cpu) goto unlock; -if (!cpumask_test_cpu (arg->dst_cpu,tsk_cpus_allowed (arg->src_task))) +if (!cpumask_test_cpu (arg->dst_cpu, &arg->src_task->cpus_allowed)) goto unlock; -if (!cpumask_test_cpu (arg->src_cpu,tsk_cpus_allowed (arg->dst_task))) +if (!cpumask_test_cpu (arg->src_cpu, &arg->dst_task->cpus_allowed)) goto unlock;__migrate_swap_task (arg->src_task, arg->dst_cpu);
@@ -1304,10 +1304,10 @@ int migrate_swap(struct task_struct *cur, struct task_struct *p)if (!cpu_active (arg.src_cpu) || !cpu_active (arg.dst_cpu)) goto out; -if (!cpumask_test_cpu (arg.dst_cpu,tsk_cpus_allowed (arg.src_task))) +if (!cpumask_test_cpu (arg.dst_cpu, &arg.src_task->cpus_allowed)) goto out; -if (!cpumask_test_cpu (arg.src_cpu,tsk_cpus_allowed (arg.dst_task))) +if (!cpumask_test_cpu (arg.src_cpu, &arg.dst_task->cpus_allowed)) goto out;trace_sched_swap_numa (cur, arg.src_cpu, p, arg.dst_cpu);
@@ -1491,14 +1491,14 @@ static int select_fallback_rq(int cpu, struct task_struct *p)for_each_cpu (dest_cpu, nodemask) {if (!cpu_active (dest_cpu))continue ; -if (cpumask_test_cpu (dest_cpu,tsk_cpus_allowed (p))) +if (cpumask_test_cpu (dest_cpu, &p->cpus_allowed))return dest_cpu; } }for (;;) {/* Any allowed, online CPU? */ -for_each_cpu (dest_cpu,tsk_cpus_allowed (p)) { +for_each_cpu (dest_cpu, &p->cpus_allowed) {if (!(p->flags &PF_KTHREAD ) && !cpu_active (dest_cpu))continue ;if (!cpu_online (dest_cpu))
@@ -1553,7 +1553,7 @@ int select_task_rq(struct task_struct *p, int cpu, int sd_flags, int wake_flags)if (tsk_nr_cpus_allowed (p) >1 ) cpu = p->sched_class->select_task_rq (p, cpu, sd_flags, wake_flags);else - cpu =cpumask_any (tsk_cpus_allowed (p)); + cpu =cpumask_any (&p->cpus_allowed);/* * In order not to call set_task_cpu() on a blocking task we need
@@ -1565,7 +1565,7 @@ int select_task_rq(struct task_struct *p, int cpu, int sd_flags, int wake_flags)* [ this allows ->select_task() to simply return task_cpu(p) and * not worry about this generic constraint ] */ -if (unlikely (!cpumask_test_cpu (cpu,tsk_cpus_allowed (p)) || +if (unlikely (!cpumask_test_cpu (cpu, &p->cpus_allowed) || !cpu_online (cpu))) cpu =select_fallback_rq (task_cpu (p), p);
@@ -5474,7 +5474,7 @@ int migrate_task_to(struct task_struct *p, int target_cpu)if (curr_cpu == target_cpu)return 0 ; -if (!cpumask_test_cpu (target_cpu,tsk_cpus_allowed (p))) +if (!cpumask_test_cpu (target_cpu, &p->cpus_allowed))return -EINVAL ;/* TODO: This is not properly updating schedstats */
kernel/sched/cpudeadline.c +2 -2
@@ -128,10 +128,10 @@ int cpudl_find(struct cpudl *cp, struct task_struct *p,const struct sched_dl_entity *dl_se = &p->dl;if (later_mask && -cpumask_and (later_mask, cp->free_cpus,tsk_cpus_allowed (p))) { +cpumask_and (later_mask, cp->free_cpus, &p->cpus_allowed)) { best_cpu =cpumask_any (later_mask); goto out; - }else if (cpumask_test_cpu (cpudl_maximum (cp),tsk_cpus_allowed (p)) && + }else if (cpumask_test_cpu (cpudl_maximum (cp), &p->cpus_allowed) &&dl_time_before (dl_se->deadline, cp->elements[0 ].dl)) { best_cpu =cpudl_maximum (cp);if (later_mask)
kernel/sched/cpupri.c +2 -2
@@ -103,11 +103,11 @@ int cpupri_find(struct cpupri *cp, struct task_struct *p,if (skip)continue ; -if (cpumask_any_and (tsk_cpus_allowed (p), vec->mask) >= nr_cpu_ids) +if (cpumask_any_and (&p->cpus_allowed, vec->mask) >= nr_cpu_ids)continue ;if (lowest_mask) { -cpumask_and (lowest_mask,tsk_cpus_allowed (p), vec->mask); +cpumask_and (lowest_mask, &p->cpus_allowed, vec->mask);/* * We have to ensure that we have at least one bit
kernel/sched/deadline.c +3 -4
@@ -252,7 +252,7 @@ static struct rq *dl_task_offline_migration(struct rq *rq, struct task_struct *p* If we cannot preempt any rq, fall back to pick any * online cpu. */ - cpu =cpumask_any_and (cpu_active_mask,tsk_cpus_allowed (p)); + cpu =cpumask_any_and (cpu_active_mask, &p->cpus_allowed);if (cpu >= nr_cpu_ids) {/* * Fail to find any suitable cpu.
@@ -1235,7 +1235,7 @@ static void set_curr_task_dl(struct rq *rq)static int pick_dl_task (struct rq *rq,struct task_struct *p,int cpu) {if (!task_running (rq, p) && -cpumask_test_cpu (cpu,tsk_cpus_allowed (p))) +cpumask_test_cpu (cpu, &p->cpus_allowed))return 1 ;return 0 ; }
@@ -1384,8 +1384,7 @@ static struct rq *find_lock_later_rq(struct task_struct *task, struct rq *rq)/* Retry if something changed. */ if (double_lock_balance (rq, later_rq)) {if (unlikely (task_rq (task) != rq || - !cpumask_test_cpu (later_rq->cpu, -tsk_cpus_allowed (task)) || + !cpumask_test_cpu (later_rq->cpu, &task->cpus_allowed) ||task_running (rq, task) || !dl_task (task) || !task_on_rq_queued (task))) {
kernel/sched/fair.c +12 -13
@@ -1553,7 +1553,7 @@ static void task_numa_compare(struct task_numa_env *env,*/ if (cur) {/* Skip this swap candidate if cannot move to the source cpu */ -if (!cpumask_test_cpu (env->src_cpu,tsk_cpus_allowed (cur))) +if (!cpumask_test_cpu (env->src_cpu, &cur->cpus_allowed)) goto unlock;/*
@@ -1663,7 +1663,7 @@ static void task_numa_find_cpu(struct task_numa_env *env,for_each_cpu (cpu,cpumask_of_node (env->dst_nid)) {/* Skip this CPU if the source task cannot migrate */ -if (!cpumask_test_cpu (cpu,tsk_cpus_allowed (env->p))) +if (!cpumask_test_cpu (cpu, &env->p->cpus_allowed))continue ; env->dst_cpu = cpu;
@@ -5460,7 +5460,7 @@ find_idlest_group(struct sched_domain *sd, struct task_struct *p,/* Skip over this group if it has no CPUs allowed */ if (!cpumask_intersects (sched_group_cpus (group), -tsk_cpus_allowed (p))) + &p->cpus_allowed))continue ; local_group = cpumask_test_cpu(this_cpu,
@@ -5580,7 +5580,7 @@ find_idlest_cpu(struct sched_group *group, struct task_struct *p, int this_cpu)return cpumask_first (sched_group_cpus (group));/* Traverse only the allowed CPUs */ -for_each_cpu_and (i,sched_group_cpus (group),tsk_cpus_allowed (p)) { +for_each_cpu_and (i,sched_group_cpus (group), &p->cpus_allowed) {if (idle_cpu (i)) {struct rq *rq =cpu_rq (i);struct cpuidle_state *idle =idle_get_state (rq);
@@ -5719,7 +5719,7 @@ static int select_idle_core(struct task_struct *p, struct sched_domain *sd, intif (!test_idle_cores (target, false))return -1 ; -cpumask_and (cpus,sched_domain_span (sd),tsk_cpus_allowed (p)); +cpumask_and (cpus,sched_domain_span (sd), &p->cpus_allowed);for_each_cpu_wrap (core, cpus, target, wrap) {bool idle = true;
@@ -5753,7 +5753,7 @@ static int select_idle_smt(struct task_struct *p, struct sched_domain *sd, int treturn -1 ;for_each_cpu (cpu,cpu_smt_mask (target)) { -if (!cpumask_test_cpu (cpu,tsk_cpus_allowed (p))) +if (!cpumask_test_cpu (cpu, &p->cpus_allowed))continue ;if (idle_cpu (cpu))return cpu;
@@ -5805,7 +5805,7 @@ static int select_idle_cpu(struct task_struct *p, struct sched_domain *sd, int t time =local_clock ();for_each_cpu_wrap (cpu,sched_domain_span (sd), target, wrap) { -if (!cpumask_test_cpu (cpu,tsk_cpus_allowed (p))) +if (!cpumask_test_cpu (cpu, &p->cpus_allowed))continue ;if (idle_cpu (cpu))break ;
@@ -5960,7 +5960,7 @@ select_task_rq_fair(struct task_struct *p, int prev_cpu, int sd_flag, int wake_fif (sd_flag &SD_BALANCE_WAKE ) {record_wakee (p); want_affine = !wake_wide (p) && !wake_cap (p, cpu, prev_cpu) - &&cpumask_test_cpu (cpu,tsk_cpus_allowed (p)); + &&cpumask_test_cpu (cpu, &p->cpus_allowed); }rcu_read_lock ();
@@ -6700,7 +6700,7 @@ int can_migrate_task(struct task_struct *p, struct lb_env *env)if (throttled_lb_pair (task_group (p), env->src_cpu, env->dst_cpu))return 0 ; -if (!cpumask_test_cpu (env->dst_cpu,tsk_cpus_allowed (p))) { +if (!cpumask_test_cpu (env->dst_cpu, &p->cpus_allowed)) {int cpu;schedstat_inc (p->se.statistics.nr_failed_migrations_affine);
@@ -6720,7 +6720,7 @@ int can_migrate_task(struct task_struct *p, struct lb_env *env)/* Prevent to re-select dst_cpu via env's cpus */ for_each_cpu_and (cpu, env->dst_grpmask, env->cpus) { -if (cpumask_test_cpu (cpu,tsk_cpus_allowed (p))) { +if (cpumask_test_cpu (cpu, &p->cpus_allowed)) { env->flags |=LBF_DST_PINNED ; env->new_dst_cpu = cpu;break ;
@@ -7254,7 +7254,7 @@ check_cpu_capacity(struct rq *rq, struct sched_domain *sd)/* * Group imbalance indicates (and tries to solve) the problem where balancing -* groups is inadequate due to tsk_cpus_allowed() constraints. +* groups is inadequate due to ->cpus_allowed constraints. * * Imagine a situation of two groups of 4 cpus each and 4 tasks each with a * cpumask covering 1 cpu of the first group and 3 cpus of the second group.
@@ -8213,8 +8213,7 @@ static int load_balance(int this_cpu, struct rq *this_rq,* if the curr task on busiest cpu can't be * moved to this_cpu */ -if (!cpumask_test_cpu (this_cpu, -tsk_cpus_allowed (busiest->curr))) { +if (!cpumask_test_cpu (this_cpu, &busiest->curr->cpus_allowed)) {raw_spin_unlock_irqrestore (&busiest->lock, flags); env.flags |=LBF_ALL_PINNED ;
kernel/sched/rt.c +2 -3
@@ -1591,7 +1591,7 @@ static void put_prev_task_rt(struct rq *rq, struct task_struct *p)static int pick_rt_task (struct rq *rq,struct task_struct *p,int cpu) {if (!task_running (rq, p) && -cpumask_test_cpu (cpu,tsk_cpus_allowed (p))) +cpumask_test_cpu (cpu, &p->cpus_allowed))return 1 ;return 0 ; }
@@ -1726,8 +1726,7 @@ static struct rq *find_lock_lowest_rq(struct task_struct *task, struct rq *rq)* Also make sure that it wasn't scheduled on its rq. */ if (unlikely (task_rq (task) != rq || - !cpumask_test_cpu (lowest_rq->cpu, -tsk_cpus_allowed (task)) || + !cpumask_test_cpu (lowest_rq->cpu, &task->cpus_allowed) ||task_running (rq, task) || !rt_task (task) || !task_on_rq_queued (task))) {
lib/smp_processor_id.c +1 -1
@@ -22,7 +22,7 @@ notrace static unsigned int check_preemption_disabled(const char *what1,* Kernel threads bound to a single CPU can safely use * smp_processor_id(): */ -if (cpumask_equal (tsk_cpus_allowed (current),cpumask_of (this_cpu))) +if (cpumask_equal (¤t->cpus_allowed,cpumask_of (this_cpu))) goto out;/*
samples/trace_events/trace-events-sample.c +1 -1
@@ -33,7 +33,7 @@ static void simple_thread_func(int cnt)/* Silly tracepoints */ trace_foo_bar ("hello" , cnt, array, random_strings[len], -tsk_cpus_allowed (current)); + ¤t->cpus_allowed);trace_foo_with_template_simple ("HELLO" , cnt);
Signature · 1 line
2.7.4
Ingo Molnar
maintainerPATCH 83/89 timers: Remove the <linux/sysctl.h> include from <linux/timer.h>
In reply to Ingo MolnarSo we want to simplify <linux/sched.h>'s header dependencies, but one roadblock of that is <linux/timer.h>'s inclusion of sysctl.h, which brings in other, problematic headers.
Note that timer.h's inclusion of sysctl.h can be avoided if we pre-declare ctl_table - so do that.
Also update usage sites that depended on the inclusion of sysctl.h (or one of the headers included by sysctl.h).
--- include/linux/timer.h | 2 +- kernel/utsname_sysctl.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-)
include/linux/timer.h +1 -1
@@ -255,7 +255,7 @@ struct hrtimer;extern enum hrtimer_restart it_real_fn (struct hrtimer *);#if defined(CONFIG_SMP ) && defined(CONFIG_NO_HZ_COMMON ) -#include <linux/sysctl.h> +struct ctl_table ;extern unsigned int sysctl_timer_migration; int timer_migration_handler(struct ctl_table *table, int write,
kernel/utsname_sysctl.c +1 -0
@@ -14,6 +14,7 @@#include <linux/utsname.h> #include <linux/sysctl.h> #include <linux/wait.h> +#include <linux/rwsem.h> #ifdef CONFIG_PROC_SYSCTL
Signature · 1 line
2.7.4
Ingo Molnar
maintainerPATCH 76/89 sched/headers, mm: Move 'struct tlbflush_unmap_batch' from <linux/sched.h> to <linux/mm_types_task.h>
In reply to Ingo MolnarUnclutter <linux/sched.h> some more.
Also move the CONFIG_ARCH_WANT_BATCHED_UNMAP_TLB_FLUSH condition inside the structure body definition, to remove a pair of #ifdefs from sched.h.
--- include/linux/mm_types_task.h | 22 ++++++++++++++++++++++ include/linux/sched.h | 21 --------------------- 2 files changed, 22 insertions(+), 21 deletions(-)
include/linux/mm_types_task.h +22 -0
@@ -10,6 +10,7 @@#include <linux/types.h> #include <linux/threads.h> #include <linux/atomic.h> +#include <linux/cpumask.h> #include <asm/page.h>
@@ -62,4 +63,25 @@ struct page_frag { #endif }; +/* Track pages that require TLB flushes */ +struct tlbflush_unmap_batch { +#ifdef CONFIG_ARCH_WANT_BATCHED_UNMAP_TLB_FLUSH +/* +* Each bit set is a CPU that potentially has a TLB entry for one of +* the PFNs being flushed. See set_tlb_ubc_flush_pending(). +*/ +struct cpumask cpumask; + +/* True if any bit in cpumask is set */ +bool flush_required; + +/* +* If true then the PTE was dirty when unmapped. The entry must be +* flushed before IO is initiated or a stale TLB entry potentially +* allows an update without redirtying the page. +*/ +bool writable; +#endif +}; +#endif /* _LINUX_MM_TYPES_TASK_H */
include/linux/sched.h +0 -21
@@ -462,25 +462,6 @@ enum perf_event_task_context { perf_nr_task_contexts, }; -/* Track pages that require TLB flushes */ -struct tlbflush_unmap_batch { -/* -* Each bit set is a CPU that potentially has a TLB entry for one of -* the PFNs being flushed. See set_tlb_ubc_flush_pending(). -*/ -struct cpumask cpumask; - -/* True if any bit in cpumask is set */ -bool flush_required; - -/* -* If true then the PTE was dirty when unmapped. The entry must be -* flushed before IO is initiated or a stale TLB entry potentially -* allows an update without redirtying the page. -*/ -bool writable; -}; -struct task_struct {#ifdef CONFIG_THREAD_INFO_IN_TASK /*
@@ -873,9 +854,7 @@ struct task_struct {unsigned long numa_pages_migrated;#endif /* CONFIG_NUMA_BALANCING */ -#ifdef CONFIG_ARCH_WANT_BATCHED_UNMAP_TLB_FLUSH struct tlbflush_unmap_batch tlb_ubc; -#endif struct rcu_head rcu;
Signature · 1 line
2.7.4
Ingo Molnar
maintainerPATCH 84/89 x86/apic: Remove the <linux/pm.h> header inclusion from <asm/apic.h>
In reply to Ingo MolnarWe want to simplify <linux/sched.h>'s header dependencies, but one roadblock to that is <asm/apic.h>'s inclusion of pm.h, which brings in other, problematic headers.
Remove it, as it appears to be entirely spurious, apic.h does not actually make use of any PM facilities.
--- arch/x86/include/asm/apic.h | 1 - 1 file changed, 1 deletion(-)
arch/x86/include/asm/apic.h +0 -1
@@ -2,7 +2,6 @@#define _ASM_X86_APIC_H#include <linux/cpumask.h> -#include <linux/pm.h> #include <asm/alternative.h> #include <asm/cpufeature.h>
Signature · 1 line
2.7.4
Ingo Molnar
maintainerPATCH 82/89 rcu: Separate the rcu synchronization types and APIs into <linux/rcupdate_wait.h>
In reply to Ingo MolnarSo rcupdate.h is a pretty complex header, in particular it includes <linux/completion.h> which includes <linux/wait.h> - creating a dependency that includes <linux/wait.h> in <linux/sched.h>, which prevents the isolation of <linux/sched.h> from the derived <linux/wait.h> header.
Solve part of the problem by decoupling rcupdate.h from completions:
this can be done by separating out the rcu_synchronize types and APIs, and updating their usage sites.
Since this is a mostly RCU-internal types this will not just simplify <linux/sched.h>'s dependencies, but will make all the hundreds of .c files that include rcupdate.h but not completions or wait.h build faster.
( For rcutiny this means that two dependent APIs have to be uninlined,
but that shouldn't be much of a problem as they are rare variants. )
--- fs/autofs4/autofs_i.h | 1 + include/linux/dcache.h | 1 + include/linux/rcupdate.h | 40 ---------------------------------------- include/linux/rcupdate_wait.h | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ include/linux/rcutiny.h | 11 ++--------- kernel/rcu/srcu.c | 2 +- kernel/rcu/tiny.c | 14 +++++++++++++- kernel/rcu/tree.c | 2 +- kernel/rcu/update.c | 1 + kernel/sched/core.c | 1 + 10 files changed, 71 insertions(+), 52 deletions(-)
fs/autofs4/autofs_i.h +1 -0
@@ -14,6 +14,7 @@#include <linux/mutex.h> #include <linux/spinlock.h> #include <linux/list.h> +#include <linux/completion.h> /* This is the range of ioctl() numbers we claim as ours */ #define AUTOFS_IOC_FIRST AUTOFS_IOC_READY
include/linux/dcache.h +1 -0
@@ -11,6 +11,7 @@#include <linux/rcupdate.h> #include <linux/lockref.h> #include <linux/stringhash.h> +#include <linux/wait.h> struct path ;struct vfsmount ;
include/linux/rcupdate.h +0 -40
@@ -40,7 +40,6 @@#include <linux/cpumask.h> #include <linux/seqlock.h> #include <linux/lockdep.h> -#include <linux/completion.h> #include <linux/debugobjects.h> #include <linux/bug.h> #include <linux/compiler.h>
@@ -226,45 +225,6 @@ void call_rcu_sched(struct rcu_head *head,void synchronize_sched (void ); -/* -* Structure allowing asynchronous waiting on RCU. -*/ -struct rcu_synchronize { -struct rcu_head head; -struct completion completion; -}; -void wakeme_after_rcu (struct rcu_head *head); - -void __wait_rcu_gp (bool checktiny,int n,call_rcu_func_t *crcu_array, -struct rcu_synchronize *rs_array); - -#define _wait_rcu_gp (checktiny, ...) \ -do { \ - call_rcu_func_t __crcu_array[] = { __VA_ARGS__ }; \ - struct rcu_synchronize __rs_array[ARRAY_SIZE(__crcu_array)]; \ - __wait_rcu_gp(checktiny, ARRAY_SIZE(__crcu_array), \ - __crcu_array, __rs_array); \ -} while (0) - -#define wait_rcu_gp (...) _wait_rcu_gp(false, __VA_ARGS__) - -/** -* synchronize_rcu_mult - Wait concurrently for multiple grace periods -* @...: List of call_rcu() functions for the flavors to wait on. -* -* This macro waits concurrently for multiple flavors of RCU grace periods. -* For example, synchronize_rcu_mult(call_rcu, call_rcu_bh) would wait -* on concurrent RCU and RCU-bh grace periods. Waiting on a give SRCU -* domain requires you to write a wrapper function for that SRCU domain's -* call_srcu() function, supplying the corresponding srcu_struct. -* -* If Tiny RCU, tell _wait_rcu_gp() not to bother waiting for RCU -* or RCU-bh, given that anywhere synchronize_rcu_mult() can be called -* is automatically a grace period. -*/ -#define synchronize_rcu_mult (...) \ - _wait_rcu_gp(IS_ENABLED(CONFIG_TINY_RCU), __VA_ARGS__) -/** * call_rcu_tasks() - Queue an RCU for invocation task-based grace period * @head: structure to be used for queueing the RCU updates.
include/linux/rcupdate_wait.h new file +50 -0
50 lines not on this page · raw message
include/linux/rcutiny.h +2 -9
@@ -47,15 +47,8 @@ static inline void cond_synchronize_sched(unsigned long oldstate)might_sleep (); } -static inline void rcu_barrier_bh (void ) -{ -wait_rcu_gp (call_rcu_bh); -} - -static inline void rcu_barrier_sched (void ) -{ -wait_rcu_gp (call_rcu_sched); -} +extern void rcu_barrier_bh (void ); +extern void rcu_barrier_sched (void );static inline void synchronize_rcu_expedited (void ) {
kernel/rcu/srcu.c +1 -1
@@ -30,7 +30,7 @@#include <linux/mutex.h> #include <linux/percpu.h> #include <linux/preempt.h> -#include <linux/rcupdate.h> +#include <linux/rcupdate_wait.h> #include <linux/sched.h> #include <linux/smp.h> #include <linux/delay.h>
kernel/rcu/tiny.c +13 -1
@@ -25,7 +25,7 @@#include <linux/completion.h> #include <linux/interrupt.h> #include <linux/notifier.h> -#include <linux/rcupdate.h> +#include <linux/rcupdate_wait.h> #include <linux/kernel.h> #include <linux/export.h> #include <linux/mutex.h>
@@ -49,6 +49,18 @@ static void __call_rcu(struct rcu_head *head,#include "tiny_plugin.h" +void rcu_barrier_bh (void ) +{ +wait_rcu_gp (call_rcu_bh); +} +EXPORT_SYMBOL (rcu_barrier_bh); + +void rcu_barrier_sched (void ) +{ +wait_rcu_gp (call_rcu_sched); +} +EXPORT_SYMBOL (rcu_barrier_sched); +#if defined(CONFIG_DEBUG_LOCK_ALLOC ) || defined(CONFIG_RCU_TRACE )/*
kernel/rcu/tree.c +1 -1
@@ -32,7 +32,7 @@#include <linux/init.h> #include <linux/spinlock.h> #include <linux/smp.h> -#include <linux/rcupdate.h> +#include <linux/rcupdate_wait.h> #include <linux/interrupt.h> #include <linux/sched.h> #include <linux/sched/debug.h>
kernel/rcu/update.c +1 -0
@@ -50,6 +50,7 @@#include <linux/moduleparam.h> #include <linux/kthread.h> #include <linux/tick.h> +#include <linux/rcupdate_wait.h> #define CREATE_TRACE_POINTS
kernel/sched/core.c +1 -0
@@ -15,6 +15,7 @@#include <linux/delayacct.h> #include <linux/init_task.h> #include <linux/context_tracking.h> +#include <linux/rcupdate_wait.h> #include <linux/blkdev.h> #include <linux/kprobes.h>
Signature · 1 line
2.7.4
Ingo Molnar
maintainerPATCH 81/89 sched/headers: Remove spurious <linux/sched.h> inclusion dependencies
In reply to Ingo MolnarIn the next couple of patches we are going to remove various headers from sched.h and other headers that sched.h includes.
To make those patches build cleanly prepare the scene by adding dependencies to various files that learned to rely on those to-be-removed dependencies.
These changes all make sense standalone: they add a header for a data type that a particular .c or .h file is using.
--- drivers/misc/vmw_vmci/vmci_resource.c | 1 + include/linux/sched.h | 1 + include/linux/user_namespace.h | 2 ++ include/sound/control.h | 1 + include/target/target_core_base.h | 1 + 5 files changed, 6 insertions(+)
drivers/misc/vmw_vmci/vmci_resource.c +1 -0
@@ -17,6 +17,7 @@#include <linux/hash.h> #include <linux/types.h> #include <linux/rculist.h> +#include <linux/completion.h> #include "vmci_resource.h" #include "vmci_driver.h"
include/linux/sched.h +1 -0
@@ -5,6 +5,7 @@#include <linux/sched/prio.h> +#include <linux/mutex.h> #include <linux/plist.h> #include <linux/mm_types_task.h>
include/linux/user_namespace.h +2 -0
@@ -5,6 +5,8 @@#include <linux/nsproxy.h> #include <linux/ns_common.h> #include <linux/sched.h> +#include <linux/workqueue.h> +#include <linux/rwsem.h> #include <linux/sysctl.h> #include <linux/err.h>
include/sound/control.h +1 -0
@@ -22,6 +22,7 @@* */ +#include <linux/wait.h> #include <sound/asound.h> #define snd_kcontrol_chip (kcontrol) ((kcontrol)->private_data)
include/target/target_core_base.h +1 -0
@@ -6,6 +6,7 @@#include <linux/percpu_ida.h> /* struct percpu_ida */ #include <linux/percpu-refcount.h> #include <linux/semaphore.h> /* struct semaphore */ +#include <linux/completion.h> #define TARGET_CORE_VERSION "v5.0"
Signature · 1 line
2.7.4
Ingo Molnar
maintainerPATCH 77/89 sched/headers: Move the get_task_struct()/put_task_struct() and related APIs from <linux/sched.h> to <linux/sched/task.h>
In reply to Ingo MolnarAlso update usage sites.
--- drivers/dma/dmatest.c | 1 + drivers/gpu/drm/etnaviv/etnaviv_gem.c | 1 + drivers/infiniband/core/umem_odp.c | 1 + drivers/infiniband/hw/mlx4/main.c | 1 + drivers/infiniband/hw/mlx5/main.c | 1 + drivers/md/persistent-data/dm-block-manager.c | 1 + drivers/misc/cxl/main.c | 2 ++ drivers/net/xen-netback/interface.c | 1 + drivers/oprofile/buffer_sync.c | 1 + drivers/tty/tty_ldsem.c | 1 + drivers/usb/usbip/usbip_common.h | 1 + include/linux/sched.h | 14 -------------- include/linux/sched/task.h | 15 +++++++++++++++ kernel/irq/manage.c | 1 + 14 files changed, 28 insertions(+), 14 deletions(-)
drivers/dma/dmatest.c +1 -0
@@ -16,6 +16,7 @@#include <linux/freezer.h> #include <linux/init.h> #include <linux/kthread.h> +#include <linux/sched/task.h> #include <linux/module.h> #include <linux/moduleparam.h> #include <linux/random.h>
drivers/gpu/drm/etnaviv/etnaviv_gem.c +1 -0
@@ -17,6 +17,7 @@#include <linux/spinlock.h> #include <linux/shmem_fs.h> #include <linux/sched/mm.h> +#include <linux/sched/task.h> #include "etnaviv_drv.h" #include "etnaviv_gem.h"
drivers/infiniband/core/umem_odp.c +1 -0
@@ -33,6 +33,7 @@#include <linux/types.h> #include <linux/sched.h> #include <linux/sched/mm.h> +#include <linux/sched/task.h> #include <linux/pid.h> #include <linux/slab.h> #include <linux/export.h>
drivers/infiniband/hw/mlx4/main.c +1 -0
@@ -40,6 +40,7 @@#include <linux/rtnetlink.h> #include <linux/if_vlan.h> #include <linux/sched/mm.h> +#include <linux/sched/task.h> #include <net/ipv6.h> #include <net/addrconf.h>
drivers/infiniband/hw/mlx5/main.c +1 -0
@@ -42,6 +42,7 @@#endif #include <linux/sched.h> #include <linux/sched/mm.h> +#include <linux/sched/task.h> #include <linux/delay.h> #include <rdma/ib_user_verbs.h> #include <rdma/ib_addr.h>
drivers/md/persistent-data/dm-block-manager.c +1 -0
@@ -13,6 +13,7 @@#include <linux/rwsem.h> #include <linux/device-mapper.h> #include <linux/stacktrace.h> +#include <linux/sched/task.h> #define DM_MSG_PREFIX "block manager"
drivers/misc/cxl/main.c +2 -0
@@ -19,6 +19,8 @@#include <linux/slab.h> #include <linux/idr.h> #include <linux/pci.h> +#include <linux/sched/task.h> +#include <asm/cputable.h> #include <misc/cxl-base.h>
drivers/net/xen-netback/interface.c +1 -0
@@ -31,6 +31,7 @@#include "common.h" #include <linux/kthread.h> +#include <linux/sched/task.h> #include <linux/ethtool.h> #include <linux/rtnetlink.h> #include <linux/if_vlan.h>
drivers/oprofile/buffer_sync.c +1 -0
@@ -32,6 +32,7 @@#include <linux/oprofile.h> #include <linux/sched.h> #include <linux/sched/mm.h> +#include <linux/sched/task.h> #include <linux/gfp.h> #include "oprofile_stats.h"
drivers/tty/tty_ldsem.c +1 -0
@@ -33,6 +33,7 @@#include <linux/tty.h> #include <linux/sched.h> #include <linux/sched/debug.h> +#include <linux/sched/task.h> #ifdef CONFIG_DEBUG_LOCK_ALLOC
drivers/usb/usbip/usbip_common.h +1 -0
@@ -31,6 +31,7 @@#include <linux/types.h> #include <linux/usb.h> #include <linux/wait.h> +#include <linux/sched/task.h> #include <uapi/linux/usbip.h> #define USBIP_VERSION "1.0.0"
include/linux/sched.h +0 -14
@@ -1119,20 +1119,6 @@ static inline int is_global_init(struct task_struct *tsk)extern struct pid *cad_pid; -extern void free_task (struct task_struct *tsk); -#define get_task_struct (tsk) do { atomic_inc(&(tsk)->usage); } while(0) - -extern void __put_task_struct (struct task_struct *t); - -static inline void put_task_struct (struct task_struct *t) -{ -if (atomic_dec_and_test (&t->usage)) -__put_task_struct (t); -} - -struct task_struct *task_rcu_dereference (struct task_struct **ptask); -struct task_struct *try_get_task_struct (struct task_struct **ptask); -/* * Per process flags */
include/linux/sched/task.h +15 -0
@@ -75,6 +75,21 @@ extern long do_fork(unsigned long, unsigned long, unsigned long, int __user *, istruct task_struct *fork_idle (int );extern pid_t kernel_thread (int (*fn)(void *),void *arg,unsigned long flags); +extern void free_task (struct task_struct *tsk); + +#define get_task_struct (tsk) do { atomic_inc(&(tsk)->usage); } while(0) + +extern void __put_task_struct (struct task_struct *t); + +static inline void put_task_struct (struct task_struct *t) +{ +if (atomic_dec_and_test (&t->usage)) +__put_task_struct (t); +} + +struct task_struct *task_rcu_dereference (struct task_struct **ptask); +struct task_struct *try_get_task_struct (struct task_struct **ptask); +#ifdef CONFIG_ARCH_WANTS_DYNAMIC_TASK_STRUCT extern int arch_task_struct_size__read_mostly ;
kernel/irq/manage.c +1 -0
@@ -17,6 +17,7 @@#include <linux/slab.h> #include <linux/sched.h> #include <linux/sched/rt.h> +#include <linux/sched/task.h> #include <uapi/linux/sched/types.h> #include <linux/task_work.h>
Signature · 1 line
2.7.4
Ingo Molnar
maintainerPATCH 80/89 sched/headers: Move the <linux/magic.h> include to <linux/sched/task_stack.h>
In reply to Ingo MolnarIt's not used by any of the scheduler methods, but <linux/sched/task_stack.h> needs it to pick up STACK_END_MAGIC.
Update files that depended on the magic.h inclusion.
--- drivers/dax/dax.c | 1 + drivers/virtio/virtio_balloon.c | 1 + include/linux/sched.h | 1 - include/linux/sched/task_stack.h | 1 + mm/zsmalloc.c | 1 + security/integrity/evm/evm_main.c | 2 ++ 6 files changed, 6 insertions(+), 1 deletion(-)
drivers/dax/dax.c +1 -0
@@ -13,6 +13,7 @@#include <linux/pagemap.h> #include <linux/module.h> #include <linux/device.h> +#include <linux/magic.h> #include <linux/mount.h> #include <linux/pfn_t.h> #include <linux/hash.h>
drivers/virtio/virtio_balloon.c +1 -0
@@ -31,6 +31,7 @@#include <linux/wait.h> #include <linux/mm.h> #include <linux/mount.h> +#include <linux/magic.h> /* * Balloon device works in 4K page units. So each page is pointed to by
include/linux/sched.h +0 -1
@@ -21,7 +21,6 @@#include <linux/task_io_accounting.h> #include <linux/latencytop.h> #include <linux/topology.h> -#include <linux/magic.h> #include <asm/current.h>
include/linux/sched/task_stack.h +1 -0
@@ -6,6 +6,7 @@*/ #include <linux/sched.h> +#include <linux/magic.h> #ifdef CONFIG_THREAD_INFO_IN_TASK
mm/zsmalloc.c +1 -0
@@ -34,6 +34,7 @@#include <linux/module.h> #include <linux/kernel.h> #include <linux/sched.h> +#include <linux/magic.h> #include <linux/bitops.h> #include <linux/errno.h> #include <linux/highmem.h>
security/integrity/evm/evm_main.c +2 -0
@@ -22,6 +22,8 @@#include <linux/xattr.h> #include <linux/integrity.h> #include <linux/evm.h> +#include <linux/magic.h> +#include <crypto/hash.h> #include <crypto/algapi.h> #include "evm.h"
Signature · 1 line
2.7.4
Ingo Molnar
maintainerPATCH 85/89 hrtimer: Remove the <linux/wait.h> include from <linux/hrtimer.h>
In reply to Ingo MolnarIn our quest to simplify <linux/sched.h>'s header dependencies, remove the <linux/wait.h> inclusion from <linux/hrtimer.h> - which does not appear to be necessary, as hrtimer.h does not use waitqueues.
--- include/linux/hrtimer.h | 1 - 1 file changed, 1 deletion(-)
include/linux/hrtimer.h +0 -1
@@ -19,7 +19,6 @@#include <linux/ktime.h> #include <linux/init.h> #include <linux/list.h> -#include <linux/wait.h> #include <linux/percpu.h> #include <linux/timer.h> #include <linux/timerqueue.h>
Signature · 1 line
2.7.4
Ingo Molnar
maintainerPATCH 74/89 sched/headers: Move _init() prototypes from <linux/sched.h> to <linux/sched/init.h>
In reply to Ingo Molnartrap_init() and cpu_init() belong into <linux/cpu.h>, sched_init*() into <linux/sched/init.h>.
... and update usage sites where necessary.
--- arch/ia64/kernel/setup.c | 1 + arch/m32r/kernel/traps.c | 1 + arch/s390/kernel/setup.c | 1 + include/linux/cpu.h | 2 ++ include/linux/sched.h | 5 ----- include/linux/sched/init.h | 11 +++++++++++ init/main.c | 1 + kernel/sched/sched.h | 1 + 8 files changed, 18 insertions(+), 5 deletions(-)
arch/ia64/kernel/setup.c +1 -0
@@ -29,6 +29,7 @@#include <linux/bootmem.h> #include <linux/console.h> #include <linux/delay.h> +#include <linux/cpu.h> #include <linux/kernel.h> #include <linux/reboot.h> #include <linux/sched.h>
arch/m32r/kernel/traps.c +1 -0
@@ -17,6 +17,7 @@#include <linux/sched/debug.h> #include <linux/sched/task_stack.h> #include <linux/mm.h> +#include <linux/cpu.h> #include <asm/page.h> #include <asm/processor.h>
arch/s390/kernel/setup.c +1 -0
@@ -19,6 +19,7 @@#include <linux/export.h> #include <linux/sched.h> #include <linux/sched/task.h> +#include <linux/cpu.h> #include <linux/kernel.h> #include <linux/memblock.h> #include <linux/mm.h>
include/linux/cpu.h +2 -0
@@ -30,6 +30,8 @@ struct cpu {extern void boot_cpu_init (void );extern void boot_cpu_state_init (void ); +extern void cpu_init (void ); +extern void trap_init (void );extern int register_cpu (struct cpu *cpu,int num);extern struct device *get_cpu_device (unsigned cpu);
include/linux/sched.h +0 -5
@@ -168,13 +168,8 @@ struct uts_namespace;/* Task command name length */ #define TASK_COMM_LEN 16 -extern void sched_init (void ); -extern void sched_init_smp (void ); -extern cpumask_var_t cpu_isolated_map; -extern void cpu_init (void ); -extern void trap_init (void );extern void update_process_times (int user);extern void scheduler_tick (void );
include/linux/sched/init.h new file +11 -0
@@ -0,0 +1,11 @@ +#ifndef _LINUX_SCHED_INIT_H +#define _LINUX_SCHED_INIT_H + +/* +* Scheduler init related prototypes: +*/ + +extern void sched_init (void ); +extern void sched_init_smp (void ); + +#endif /* _LINUX_SCHED_INIT_H */
init/main.c +1 -0
@@ -62,6 +62,7 @@#include <linux/device.h> #include <linux/kthread.h> #include <linux/sched.h> +#include <linux/sched/init.h> #include <linux/signal.h> #include <linux/idr.h> #include <linux/kgdb.h>
kernel/sched/sched.h +1 -0
@@ -18,6 +18,7 @@#include <linux/sched/task.h> #include <linux/sched/task_stack.h> #include <linux/sched/cputime.h> +#include <linux/sched/init.h> #include <linux/u64_stats_sync.h> #include <linux/kernel_stat.h>
Signature · 1 line
2.7.4
Ingo Molnar
maintainerPATCH 86/89 sched/headers: Remove the <linux/topology.h> include from <linux/sched.h>
In reply to Ingo MolnarIt's used only by a single (rarely used) inline function (task_node(p)), which we can move to <linux/sched/topology.h>.
( Add <linux/nodemask.h>, because we rely on that. )
--- include/linux/sched.h | 7 +------ include/linux/sched/topology.h | 7 +++++++ 2 files changed, 8 insertions(+), 6 deletions(-)
include/linux/sched.h +1 -6
@@ -4,6 +4,7 @@#include <uapi/linux/sched.h> #include <linux/sched/prio.h> +#include <linux/nodemask.h> #include <linux/mutex.h> #include <linux/plist.h>
@@ -21,7 +22,6 @@#include <linux/kcov.h> #include <linux/task_io_accounting.h> #include <linux/latencytop.h> -#include <linux/topology.h> #include <asm/current.h>
@@ -1455,11 +1455,6 @@ static inline unsigned int task_cpu(const struct task_struct *p)#endif } -static inline int task_node (const struct task_struct *p) -{ -return cpu_to_node (task_cpu (p)); -} -extern void set_task_cpu (struct task_struct *p,unsigned int cpu);#else
include/linux/sched/topology.h +7 -0
@@ -1,6 +1,8 @@#ifndef _LINUX_SCHED_TOPOLOGY_H#define _LINUX_SCHED_TOPOLOGY_H +#include <linux/topology.h> +#include <linux/sched/idle.h> /*
@@ -216,4 +218,9 @@ static inline bool cpus_share_cache(int this_cpu, int that_cpu)#endif /* !CONFIG_SMP */ +static inline int task_node (const struct task_struct *p) +{ +return cpu_to_node (task_cpu (p)); +} +#endif /* _LINUX_SCHED_TOPOLOGY_H */
Signature · 1 line
2.7.4
Ingo Molnar
maintainerPATCH 79/89 sched/core: Remove the tsk_nr_cpus_allowed() wrapper
In reply to Ingo Molnartsk_nr_cpus_allowed() too is a pretty pointless wrapper that is not used consistently and which makes the code both harder to read and longer as well.
So remove it - this also shrinks <linux/sched.h> a bit.
--- include/linux/sched.h | 5 ----- kernel/sched/core.c | 2 +- kernel/sched/deadline.c | 28 ++++++++++++++-------------- kernel/sched/rt.c | 24 ++++++++++++------------ 4 files changed, 27 insertions(+), 32 deletions(-)
include/linux/sched.h +0 -5
@@ -962,11 +962,6 @@ struct task_struct {*/ }; -static inline int tsk_nr_cpus_allowed (struct task_struct *p) -{ -return p->nr_cpus_allowed; -} -static inline struct pid *task_pid (struct task_struct *task) {return task->pids[PIDTYPE_PID ].pid;
kernel/sched/core.c +1 -1
@@ -1550,7 +1550,7 @@ int select_task_rq(struct task_struct *p, int cpu, int sd_flags, int wake_flags) {lockdep_assert_held (&p->pi_lock); -if (tsk_nr_cpus_allowed (p) >1 ) +if (p->nr_cpus_allowed >1 ) cpu = p->sched_class->select_task_rq (p, cpu, sd_flags, wake_flags);else cpu =cpumask_any (&p->cpus_allowed);
kernel/sched/deadline.c +14 -14
@@ -134,7 +134,7 @@ static void inc_dl_migration(struct sched_dl_entity *dl_se, struct dl_rq *dl_rq) {struct task_struct *p =dl_task_of (dl_se); -if (tsk_nr_cpus_allowed (p) >1 ) +if (p->nr_cpus_allowed >1 ) dl_rq->dl_nr_migratory++;update_dl_migration (dl_rq);
@@ -144,7 +144,7 @@ static void dec_dl_migration(struct sched_dl_entity *dl_se, struct dl_rq *dl_rq) {struct task_struct *p =dl_task_of (dl_se); -if (tsk_nr_cpus_allowed (p) >1 ) +if (p->nr_cpus_allowed >1 ) dl_rq->dl_nr_migratory--;update_dl_migration (dl_rq);
@@ -958,7 +958,7 @@ static void enqueue_task_dl(struct rq *rq, struct task_struct *p, int flags)enqueue_dl_entity (&p->dl, pi_se, flags); -if (!task_current (rq, p) &&tsk_nr_cpus_allowed (p) >1 ) +if (!task_current (rq, p) && p->nr_cpus_allowed >1 )enqueue_pushable_dl_task (rq, p); }
@@ -1032,9 +1032,9 @@ select_task_rq_dl(struct task_struct *p, int cpu, int sd_flag, int flags)* try to make it stay here, it might be important. */ if (unlikely (dl_task (curr)) && - (tsk_nr_cpus_allowed (curr) <2 || + (curr->nr_cpus_allowed <2 || !dl_entity_preempt (&p->dl, &curr->dl)) && - (tsk_nr_cpus_allowed (p) >1 )) { + (p->nr_cpus_allowed >1 )) {int target =find_later_rq (p); if (target != -1 &&
@@ -1055,7 +1055,7 @@ static void check_preempt_equal_dl(struct rq *rq, struct task_struct *p)* Current can't be migrated, useless to reschedule, * let's hope p can move out. */ -if (tsk_nr_cpus_allowed (rq->curr) ==1 || +if (rq->curr->nr_cpus_allowed ==1 ||cpudl_find (&rq->rd->cpudl, rq->curr,NULL ) ==-1 )return ;
@@ -1063,7 +1063,7 @@ static void check_preempt_equal_dl(struct rq *rq, struct task_struct *p)* p is migratable, so let's not schedule it and * see if it is pushed or pulled somewhere else. */ -if (tsk_nr_cpus_allowed (p) !=1 && +if (p->nr_cpus_allowed !=1 &&cpudl_find (&rq->rd->cpudl, p,NULL ) !=-1 )return ;
@@ -1178,7 +1178,7 @@ static void put_prev_task_dl(struct rq *rq, struct task_struct *p) {update_curr_dl (rq); -if (on_dl_rq (&p->dl) &&tsk_nr_cpus_allowed (p) >1 ) +if (on_dl_rq (&p->dl) && p->nr_cpus_allowed >1 )enqueue_pushable_dl_task (rq, p); }
@@ -1279,7 +1279,7 @@ static int find_later_rq(struct task_struct *task)if (unlikely (!later_mask))return -1 ; -if (tsk_nr_cpus_allowed (task) ==1 ) +if (task->nr_cpus_allowed ==1 )return -1 ;/*
@@ -1424,7 +1424,7 @@ static struct task_struct *pick_next_pushable_dl_task(struct rq *rq)BUG_ON (rq->cpu !=task_cpu (p));BUG_ON (task_current (rq, p)); -BUG_ON (tsk_nr_cpus_allowed (p) <=1 ); +BUG_ON (p->nr_cpus_allowed <=1 );BUG_ON (!task_on_rq_queued (p));BUG_ON (!dl_task (p));
@@ -1463,7 +1463,7 @@ static int push_dl_task(struct rq *rq)*/ if (dl_task (rq->curr) &&dl_time_before (next_task->dl.deadline, rq->curr->dl.deadline) && -tsk_nr_cpus_allowed (rq->curr) >1 ) { + rq->curr->nr_cpus_allowed >1 ) {resched_curr (rq);return 0 ; }
@@ -1610,9 +1610,9 @@ static void task_woken_dl(struct rq *rq, struct task_struct *p) {if (!task_running (rq, p) && !test_tsk_need_resched (rq->curr) && -tsk_nr_cpus_allowed (p) >1 && + p->nr_cpus_allowed >1 &&dl_task (rq->curr) && - (tsk_nr_cpus_allowed (rq->curr) <2 || + (rq->curr->nr_cpus_allowed <2 || !dl_entity_preempt (&p->dl, &rq->curr->dl))) {push_dl_tasks (rq); }
@@ -1726,7 +1726,7 @@ static void switched_to_dl(struct rq *rq, struct task_struct *p)if (rq->curr != p) {#ifdef CONFIG_SMP -if (tsk_nr_cpus_allowed (p) >1 && rq->dl.overloaded) +if (p->nr_cpus_allowed >1 && rq->dl.overloaded)queue_push_tasks (rq);#endif if (dl_task (rq->curr))
kernel/sched/rt.c +12 -12
@@ -335,7 +335,7 @@ static void inc_rt_migration(struct sched_rt_entity *rt_se, struct rt_rq *rt_rq) rt_rq = &rq_of_rt_rq (rt_rq)->rt; rt_rq->rt_nr_total++; -if (tsk_nr_cpus_allowed (p) >1 ) +if (p->nr_cpus_allowed >1 ) rt_rq->rt_nr_migratory++;update_rt_migration (rt_rq);
@@ -352,7 +352,7 @@ static void dec_rt_migration(struct sched_rt_entity *rt_se, struct rt_rq *rt_rq) rt_rq = &rq_of_rt_rq (rt_rq)->rt; rt_rq->rt_nr_total--; -if (tsk_nr_cpus_allowed (p) >1 ) +if (p->nr_cpus_allowed >1 ) rt_rq->rt_nr_migratory--;update_rt_migration (rt_rq);
@@ -1324,7 +1324,7 @@ enqueue_task_rt(struct rq *rq, struct task_struct *p, int flags)enqueue_rt_entity (rt_se, flags); -if (!task_current (rq, p) &&tsk_nr_cpus_allowed (p) >1 ) +if (!task_current (rq, p) && p->nr_cpus_allowed >1 )enqueue_pushable_task (rq, p); }
@@ -1413,7 +1413,7 @@ select_task_rq_rt(struct task_struct *p, int cpu, int sd_flag, int flags)* will have to sort it out. */ if (curr &&unlikely (rt_task (curr)) && - (tsk_nr_cpus_allowed (curr) <2 || + (curr->nr_cpus_allowed <2 || curr->prio <= p->prio)) {int target =find_lowest_rq (p);
@@ -1437,7 +1437,7 @@ static void check_preempt_equal_prio(struct rq *rq, struct task_struct *p)* Current can't be migrated, useless to reschedule, * let's hope p can move out. */ -if (tsk_nr_cpus_allowed (rq->curr) ==1 || +if (rq->curr->nr_cpus_allowed ==1 || !cpupri_find (&rq->rd->cpupri, rq->curr,NULL ))return ;
@@ -1445,7 +1445,7 @@ static void check_preempt_equal_prio(struct rq *rq, struct task_struct *p)* p is migratable, so let's not schedule it and * see if it is pushed or pulled somewhere else. */ -if (tsk_nr_cpus_allowed (p) !=1 +if (p->nr_cpus_allowed !=1 &&cpupri_find (&rq->rd->cpupri, p,NULL ))return ;
@@ -1579,7 +1579,7 @@ static void put_prev_task_rt(struct rq *rq, struct task_struct *p)* The previous task needs to be made eligible for pushing * if it is still active */ -if (on_rt_rq (&p->rt) &&tsk_nr_cpus_allowed (p) >1 ) +if (on_rt_rq (&p->rt) && p->nr_cpus_allowed >1 )enqueue_pushable_task (rq, p); }
@@ -1629,7 +1629,7 @@ static int find_lowest_rq(struct task_struct *task)if (unlikely (!lowest_mask))return -1 ; -if (tsk_nr_cpus_allowed (task) ==1 ) +if (task->nr_cpus_allowed ==1 )return -1 ;/* No other targets possible */ if (!cpupri_find (&task_rq (task)->rd->cpupri, task, lowest_mask))
@@ -1761,7 +1761,7 @@ static struct task_struct *pick_next_pushable_task(struct rq *rq)BUG_ON (rq->cpu !=task_cpu (p));BUG_ON (task_current (rq, p)); -BUG_ON (tsk_nr_cpus_allowed (p) <=1 ); +BUG_ON (p->nr_cpus_allowed <=1 );BUG_ON (!task_on_rq_queued (p));BUG_ON (!rt_task (p));
@@ -2121,9 +2121,9 @@ static void task_woken_rt(struct rq *rq, struct task_struct *p) {if (!task_running (rq, p) && !test_tsk_need_resched (rq->curr) && -tsk_nr_cpus_allowed (p) >1 && + p->nr_cpus_allowed >1 && (dl_task (rq->curr) ||rt_task (rq->curr)) && - (tsk_nr_cpus_allowed (rq->curr) <2 || + (rq->curr->nr_cpus_allowed <2 || rq->curr->prio <= p->prio))push_rt_tasks (rq); }
@@ -2196,7 +2196,7 @@ static void switched_to_rt(struct rq *rq, struct task_struct *p)*/ if (task_on_rq_queued (p) && rq->curr != p) {#ifdef CONFIG_SMP -if (tsk_nr_cpus_allowed (p) >1 && rq->rt.overloaded) +if (p->nr_cpus_allowed >1 && rq->rt.overloaded)queue_push_tasks (rq);#endif /* CONFIG_SMP */ if (p->prio < rq->curr->prio)
Signature · 1 line
2.7.4
Ingo Molnar
maintainerPATCH 87/89 sched/headers: Move the sched_exec() prototype to <linux/sched/task.h>
In reply to Ingo Molnarsched_exec() better fits into the task lifetime APIs than into the core scheduler APIs.
This reduces the size of <linux/sched.h> a bit.
--- include/linux/sched.h | 7 ------- include/linux/sched/task.h | 7 +++++++ 2 files changed, 7 insertions(+), 7 deletions(-)
include/linux/sched.h +0 -7
@@ -1234,13 +1234,6 @@ static inline int set_cpus_allowed_ptr(struct task_struct *p,#define cpu_relax_yield () cpu_relax()#endif -/* sched_exec is called by processes performing an exec */ -#ifdef CONFIG_SMP -extern void sched_exec (void ); -#else -#define sched_exec () {} -#endif -extern int yield_to (struct task_struct *p,bool preempt);extern void set_user_nice (struct task_struct *p,long nice);extern int task_prio (const struct task_struct *p);
include/linux/sched/task.h +7 -0
@@ -77,6 +77,13 @@ extern pid_t kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);extern void free_task (struct task_struct *tsk); +/* sched_exec is called by processes performing an exec */ +#ifdef CONFIG_SMP +extern void sched_exec (void ); +#else +#define sched_exec () {} +#endif +#define get_task_struct (tsk) do { atomic_inc(&(tsk)->usage); } while(0)extern void __put_task_struct (struct task_struct *t);
Signature · 1 line
2.7.4
Ingo Molnar
maintainerPATCH 73/89 sched/headers: Move exit_files() and exit_itimers() from <linux/sched.h> to <linux/sched/task.h>
In reply to Ingo MolnarThese two functions are task management related, not core scheduler APIs.
--- include/linux/sched.h | 4 ---- include/linux/sched/task.h | 3 +++ kernel/time/posix-timers.c | 1 + 3 files changed, 4 insertions(+), 4 deletions(-)
include/linux/sched.h +0 -4
@@ -1368,10 +1368,6 @@ extern void wake_up_new_task(struct task_struct *tsk);static inline void kick_process (struct task_struct *tsk) { }#endif -extern void exit_files (struct task_struct *); - -extern void exit_itimers (struct signal_struct *); -extern void __set_task_comm (struct task_struct *tsk,const char *from,bool exec);static inline void set_task_comm (struct task_struct *tsk,const char *from) {
include/linux/sched/task.h +3 -0
@@ -67,6 +67,9 @@ static inline void exit_thread(struct task_struct *tsk)#endif extern void do_group_exit (int ); +extern void exit_files (struct task_struct *); +extern void exit_itimers (struct signal_struct *); +extern long _do_fork (unsigned long ,unsigned long ,unsigned long ,int __user *,int __user *,unsigned long );extern long do_fork (unsigned long ,unsigned long ,unsigned long ,int __user *,int __user *);struct task_struct *fork_idle (int );
kernel/time/posix-timers.c +1 -0
@@ -35,6 +35,7 @@#include <linux/slab.h> #include <linux/time.h> #include <linux/mutex.h> +#include <linux/sched/task.h> #include <linux/uaccess.h> #include <linux/list.h>
Signature · 1 line
2.7.4
Ingo Molnar
maintainerPATCH 72/89 sched/headers: Move kstack_end() from <linux/sched.h> to <linux/sched/task_stack.h>
In reply to Ingo Molnar... and update usage sites, where necessary.
--- arch/m32r/kernel/traps.c | 2 ++ arch/metag/kernel/stacktrace.c | 1 + arch/openrisc/kernel/traps.c | 1 + arch/um/kernel/sysrq.c | 1 + arch/xtensa/kernel/traps.c | 1 + include/linux/sched.h | 10 ---------- include/linux/sched/task_stack.h | 10 ++++++++++ mm/slab.c | 1 + 8 files changed, 17 insertions(+), 10 deletions(-)
arch/m32r/kernel/traps.c +2 -0
@@ -15,7 +15,9 @@#include <linux/stddef.h> #include <linux/ptrace.h> #include <linux/sched/debug.h> +#include <linux/sched/task_stack.h> #include <linux/mm.h> +#include <asm/page.h> #include <asm/processor.h>
arch/metag/kernel/stacktrace.c +1 -0
@@ -1,6 +1,7 @@#include <linux/export.h> #include <linux/sched.h> #include <linux/sched/debug.h> +#include <linux/sched/task_stack.h> #include <linux/stacktrace.h> #include <asm/stacktrace.h>
arch/openrisc/kernel/traps.c +1 -0
@@ -23,6 +23,7 @@#include <linux/init.h> #include <linux/sched.h> #include <linux/sched/debug.h> +#include <linux/sched/task_stack.h> #include <linux/kernel.h> #include <linux/module.h> #include <linux/kmod.h>
arch/um/kernel/sysrq.c +1 -0
@@ -12,6 +12,7 @@#include <linux/module.h> #include <linux/sched.h> #include <linux/sched/debug.h> +#include <linux/sched/task_stack.h> #include <asm/sysrq.h> #include <asm/stacktrace.h>
arch/xtensa/kernel/traps.c +1 -0
@@ -26,6 +26,7 @@#include <linux/kernel.h> #include <linux/sched/signal.h> #include <linux/sched/debug.h> +#include <linux/sched/task_stack.h> #include <linux/init.h> #include <linux/module.h> #include <linux/stringify.h>
include/linux/sched.h +0 -10
@@ -1344,16 +1344,6 @@ static inline struct thread_info *task_thread_info(struct task_struct *task)# define task_thread_info (task) ((struct thread_info *)(task)->stack)#endif -#ifndef __HAVE_ARCH_KSTACK_END -static inline int kstack_end (void *addr) -{ -/* Reliable end of stack detection: -* Some APM bios versions misalign the stack -*/ -return !(((unsigned long )addr+sizeof (void *)-1 ) & (THREAD_SIZE -sizeof (void *))); -} -#endif -/* * find a task by one of its numerical ids *
include/linux/sched/task_stack.h +10 -0
@@ -107,4 +107,14 @@ static inline unsigned long stack_not_used(struct task_struct *p)#endif extern void set_task_stack_end_magic (struct task_struct *tsk); +#ifndef __HAVE_ARCH_KSTACK_END +static inline int kstack_end (void *addr) +{ +/* Reliable end of stack detection: +* Some APM bios versions misalign the stack +*/ +return !(((unsigned long )addr+sizeof (void *)-1 ) & (THREAD_SIZE -sizeof (void *))); +} +#endif +#endif /* _LINUX_SCHED_TASK_STACK_H */
mm/slab.c +1 -0
@@ -116,6 +116,7 @@#include <linux/kmemcheck.h> #include <linux/memory.h> #include <linux/prefetch.h> +#include <linux/sched/task_stack.h> #include <net/sock.h>
Signature · 1 line
2.7.4
Ingo Molnar
maintainerPATCH 71/89 sched/headers, vfs/execve: Move the do_execve*() prototypes from <linux/sched.h> to <linux/binfmts.h>
In reply to Ingo Molnar... and update the usage sites where necessary.
--- include/linux/binfmts.h | 10 ++++++++++ include/linux/sched.h | 8 -------- init/main.c | 1 + kernel/kmod.c | 1 + 4 files changed, 12 insertions(+), 8 deletions(-)
include/linux/binfmts.h +10 -0
@@ -6,6 +6,8 @@#include <asm/exec.h> #include <uapi/linux/binfmts.h> +struct filename ; +#define CORENAME_MAX_SIZE 128/*
@@ -123,4 +125,12 @@ extern void install_exec_creds(struct linux_binprm *bprm);extern void set_binfmt (struct linux_binfmt *new);extern ssize_t read_code (struct file *,unsigned long ,loff_t ,size_t ); +extern int do_execve (struct filename *, +const char __user *const __user *, +const char __user *const __user *); +extern int do_execveat (int ,struct filename *, +const char __user *const __user *, +const char __user *const __user *, +int ); +#endif /* _LINUX_BINFMTS_H */
include/linux/sched.h +0 -8
@@ -1382,14 +1382,6 @@ extern void exit_files(struct task_struct *);extern void exit_itimers (struct signal_struct *); -extern int do_execve (struct filename *, -const char __user *const __user *, -const char __user *const __user *); -extern int do_execveat (int ,struct filename *, -const char __user *const __user *, -const char __user *const __user *, -int ); -extern void __set_task_comm (struct task_struct *tsk,const char *from,bool exec);static inline void set_task_comm (struct task_struct *tsk,const char *from) {
init/main.c +1 -0
@@ -14,6 +14,7 @@#include <linux/types.h> #include <linux/module.h> #include <linux/proc_fs.h> +#include <linux/binfmts.h> #include <linux/kernel.h> #include <linux/syscalls.h> #include <linux/stackprotector.h>
kernel/kmod.c +1 -0
@@ -21,6 +21,7 @@#include <linux/module.h> #include <linux/sched.h> #include <linux/sched/task.h> +#include <linux/binfmts.h> #include <linux/syscalls.h> #include <linux/unistd.h> #include <linux/kmod.h>
Signature · 1 line
2.7.4
Ingo Molnar
maintainerPATCH 70/89 sched/core: Remove unused prefetch_stack()
In reply to Ingo Molnarprefetch_stack() is defined by IA64, but not actually used anywhere anymore.
Remove it.
--- arch/ia64/include/asm/processor.h | 2 -- arch/ia64/kernel/entry.S | 23 ----------------------- include/linux/sched.h | 6 ------ 3 files changed, 31 deletions(-)
arch/ia64/include/asm/processor.h +0 -2
@@ -19,8 +19,6 @@#include <asm/ptrace.h> #include <asm/ustack.h> -#define ARCH_HAS_PREFETCH_SWITCH_STACK -#define IA64_NUM_PHYS_STACK_REG 96#define IA64_NUM_DBG_REGS 8
arch/ia64/kernel/entry.S +0 -23
@@ -455,29 +455,6 @@ GLOBAL_ENTRY(load_switch_stack) br.cond.sptk.many b7 END(load_switch_stack) -GLOBAL_ENTRY(prefetch_stack) - add r14 = -IA64_SWITCH_STACK_SIZE, sp - add r15 = IA64_TASK_THREAD_KSP_OFFSET, in0 - ;; - ld8 r16 = [r15] // load next's stack pointer - lfetch.fault.excl [r14], 128 - ;; - lfetch.fault.excl [r14], 128 - lfetch.fault [r16], 128 - ;; - lfetch.fault.excl [r14], 128 - lfetch.fault [r16], 128 - ;; - lfetch.fault.excl [r14], 128 - lfetch.fault [r16], 128 - ;; - lfetch.fault.excl [r14], 128 - lfetch.fault [r16], 128 - ;; - lfetch.fault [r16], 128 - br.ret.sptk.many rp -END(prefetch_stack) - /* * Invoke a system call, but do some tracing before and after the call. * We MUST preserve the current register frame throughout this routine
include/linux/sched.h +0 -6
@@ -252,12 +252,6 @@ struct sched_info {# define SCHED_FIXEDPOINT_SHIFT 10# define SCHED_FIXEDPOINT_SCALE (1L << SCHED_FIXEDPOINT_SHIFT) -#ifdef ARCH_HAS_PREFETCH_SWITCH_STACK -extern void prefetch_stack (struct task_struct *t); -#else -static inline void prefetch_stack (struct task_struct *t) { } -#endif -struct load_weight {unsigned long weight;u32 inv_weight;
Signature · 1 line
2.7.4
Ingo Molnar
maintainerPATCH 65/89 sched/headers: Move 'init_task' and 'init_thread_union' from <linux/sched.h> to <linux/sched/task.h>
In reply to Ingo Molnar'init_task' is really not part of core scheduler APIs but part of the fork() interface between the scheduler and process management.
So move the declarations - and update affected code.
--- arch/arm64/kernel/setup.c | 1 + arch/arm64/mm/kasan_init.c | 1 + arch/frv/mm/init.c | 1 + arch/metag/mm/init.c | 1 + arch/nios2/kernel/setup.c | 1 + arch/powerpc/kernel/paca.c | 1 + arch/um/kernel/skas/process.c | 1 + arch/um/kernel/um_arch.c | 2 ++ arch/x86/kernel/cpu/common.c | 1 + arch/x86/mm/kasan_init_64.c | 1 + fs/namespace.c | 2 ++ include/linux/sched.h | 3 --- include/linux/sched/signal.h | 1 + include/linux/sched/task.h | 8 ++++++-- init/init_task.c | 1 + kernel/delayacct.c | 1 + lib/is_single_threaded.c | 1 + mm/vmacache.c | 1 + 18 files changed, 24 insertions(+), 5 deletions(-)
arch/arm64/kernel/setup.c +1 -0
@@ -42,6 +42,7 @@#include <linux/of_fdt.h> #include <linux/efi.h> #include <linux/psci.h> +#include <linux/sched/task.h> #include <asm/acpi.h> #include <asm/fixmap.h>
arch/arm64/mm/kasan_init.c +1 -0
@@ -13,6 +13,7 @@#define pr_fmt (fmt) "kasan: " fmt#include <linux/kasan.h> #include <linux/kernel.h> +#include <linux/sched/task.h> #include <linux/memblock.h> #include <linux/start_kernel.h>
arch/frv/mm/init.c +1 -0
@@ -18,6 +18,7 @@#include <linux/signal.h> #include <linux/sched.h> +#include <linux/sched/task.h> #include <linux/pagemap.h> #include <linux/gfp.h> #include <linux/swap.h>
arch/metag/mm/init.c +1 -0
@@ -12,6 +12,7 @@#include <linux/percpu.h> #include <linux/memblock.h> #include <linux/initrd.h> +#include <linux/sched/task.h> #include <asm/setup.h> #include <asm/page.h>
arch/nios2/kernel/setup.c +1 -0
@@ -14,6 +14,7 @@#include <linux/kernel.h> #include <linux/mm.h> #include <linux/sched.h> +#include <linux/sched/task.h> #include <linux/console.h> #include <linux/bootmem.h> #include <linux/initrd.h>
arch/powerpc/kernel/paca.c +1 -0
@@ -10,6 +10,7 @@#include <linux/smp.h> #include <linux/export.h> #include <linux/memblock.h> +#include <linux/sched/task.h> #include <asm/lppaca.h> #include <asm/paca.h>
arch/um/kernel/skas/process.c +1 -0
@@ -6,6 +6,7 @@#include <linux/init.h> #include <linux/sched/mm.h> #include <linux/sched/task_stack.h> +#include <linux/sched/task.h> #include <as-layout.h> #include <kern.h>
arch/um/kernel/um_arch.c +2 -0
@@ -11,7 +11,9 @@#include <linux/string.h> #include <linux/utsname.h> #include <linux/sched.h> +#include <linux/sched/task.h> #include <linux/kmsg_dump.h> +#include <asm/pgtable.h> #include <asm/processor.h> #include <asm/sections.h>
arch/x86/kernel/cpu/common.c +1 -0
@@ -9,6 +9,7 @@#include <linux/delay.h> #include <linux/sched.h> #include <linux/sched/clock.h> +#include <linux/sched/task.h> #include <linux/init.h> #include <linux/kprobes.h> #include <linux/kgdb.h>
arch/x86/mm/kasan_init_64.c +1 -0
@@ -4,6 +4,7 @@#include <linux/kdebug.h> #include <linux/mm.h> #include <linux/sched.h> +#include <linux/sched/task.h> #include <linux/vmalloc.h> #include <asm/tlbflush.h>
fs/namespace.c +2 -0
@@ -25,6 +25,8 @@#include <linux/magic.h> #include <linux/bootmem.h> #include <linux/task_work.h> +#include <linux/sched/task.h> +#include "pnode.h" #include "internal.h"
include/linux/sched.h +0 -3
@@ -1459,9 +1459,6 @@ static inline int kstack_end(void *addr) }#endif -extern union thread_union init_thread_union; -extern struct task_struct init_task; -/* * find a task by one of its numerical ids *
include/linux/sched/signal.h +1 -0
@@ -4,6 +4,7 @@#include <linux/signal.h> #include <linux/sched.h> #include <linux/sched/jobctl.h> +#include <linux/sched/task.h> #include <linux/cred.h> /*
include/linux/sched/task.h +6 -2
@@ -3,13 +3,14 @@#include <linux/spinlock.h> -struct task_struct ; -/* * Interface between the scheduler and various task lifetime (fork()/exit()) * functionality: */ +struct task_struct ; +union thread_union ; +/* * This serializes "schedule()" and also protects * the run-queue from deletions/modifications (but
@@ -19,6 +20,9 @@ struct task_struct;extern rwlock_t tasklist_lock;extern spinlock_t mmlist_lock; +extern union thread_union init_thread_union; +extern struct task_struct init_task; +#ifdef CONFIG_PROVE_RCU extern int lockdep_tasklist_lock_is_held (void );#endif /* #ifdef CONFIG_PROVE_RCU */
init/init_task.c +1 -0
@@ -4,6 +4,7 @@#include <linux/sched.h> #include <linux/sched/sysctl.h> #include <linux/sched/rt.h> +#include <linux/sched/task.h> #include <linux/init.h> #include <linux/fs.h> #include <linux/mm.h>
kernel/delayacct.c +1 -0
@@ -14,6 +14,7 @@*/ #include <linux/sched.h> +#include <linux/sched/task.h> #include <linux/slab.h> #include <linux/taskstats.h> #include <linux/time.h>
lib/is_single_threaded.c +1 -0
@@ -10,6 +10,7 @@* 2 of the Licence, or (at your option) any later version. */ #include <linux/sched/signal.h> +#include <linux/sched/task.h> #include <linux/sched/mm.h> /*
mm/vmacache.c +1 -0
@@ -2,6 +2,7 @@* Copyright (C) 2014 Davidlohr Bueso. */ #include <linux/sched/signal.h> +#include <linux/sched/task.h> #include <linux/mm.h> #include <linux/vmacache.h>
Signature · 1 line
2.7.4
Ingo Molnar
maintainerPATCH 88/89 sched/headers: Remove #ifdefs from <linux/sched.h>
In reply to Ingo MolnarWe can remove two pairs of #ifdefs by defining structures in a smarter way.
--- include/linux/sched.h | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
include/linux/sched.h +4 -8
@@ -224,8 +224,8 @@ struct task_cputime {#define prof_exp stime#define sched_exp sum_exec_runtime -#ifdef CONFIG_SCHED_INFOstruct sched_info { +#ifdef CONFIG_SCHED_INFO /* cumulative counters */ unsigned long pcount;/* # of times run on this cpu */ unsigned long long run_delay;/* time spent waiting on a runqueue */
@@ -233,8 +233,8 @@ struct sched_info {/* timestamps */ unsigned long long last_arrival,/* when we last ran on a cpu */ last_queued;/* when we were last queued to run */ -};#endif /* CONFIG_SCHED_INFO */ +};/* * Integer metrics need fixed point arithmetic, e.g., sched/fair
@@ -309,8 +309,8 @@ struct sched_avg {unsigned long load_avg, util_avg; }; -#ifdef CONFIG_SCHEDSTATSstruct sched_statistics { +#ifdef CONFIG_SCHEDSTATS u64 wait_start;u64 wait_max;u64 wait_count;
@@ -342,8 +342,8 @@ struct sched_statistics {u64 nr_wakeups_affine_attempts;u64 nr_wakeups_passive;u64 nr_wakeups_idle; -};#endif +};struct sched_entity {struct load_weight load;/* for load-balancing */
@@ -358,9 +358,7 @@ struct sched_entity {u64 nr_migrations; -#ifdef CONFIG_SCHEDSTATS struct sched_statistics statistics; -#endif #ifdef CONFIG_FAIR_GROUP_SCHED int depth;
@@ -526,9 +524,7 @@ struct task_struct {int rcu_tasks_idle_cpu;#endif /* #ifdef CONFIG_TASKS_RCU */ -#ifdef CONFIG_SCHED_INFO struct sched_info sched_info; -#endif struct list_head tasks;#ifdef CONFIG_SMP
Signature · 1 line
2.7.4
Ingo Molnar
maintainerPATCH 89/89 sched/headers: Clean up <linux/sched.h>
In reply to Ingo MolnarNow that <linux/sched.h> dependencies have been sorted out, do various trivial cleanups:
- remove unnecessary structure predeclarations
- fix various typos
- update comments where necessary
- remove pointless comments
- use consistent types
- tabulate consistently
- use a consistent comment style
- clean up the header section a bit
- use a consistent style of a single field per line
- remove line-breaks where they make the code look worse
- etc ...
No change in functionality.
--- include/linux/sched.h | 1224 +++++++++++++++++++++++++++++++++++++-------------------------------- 1 file changed, 652 insertions(+), 572 deletions(-)
include/linux/sched.h +652 -572
@@ -1,38 +1,38 @@#ifndef _LINUX_SCHED_H#define _LINUX_SCHED_H -#include <uapi/linux/sched.h> +/* +* Define 'struct task_struct' and provide the main scheduler +* APIs (schedule(), wakeup variants, etc.) +*/ -#include <linux/sched/prio.h> -#include <linux/nodemask.h> +#include <uapi/linux/sched.h> -#include <linux/mutex.h> -#include <linux/plist.h> -#include <linux/mm_types_task.h> +#include <asm/current.h> +#include <linux/pid.h> #include <linux/sem.h> #include <linux/shm.h> -#include <linux/signal_types.h> -#include <linux/pid.h> +#include <linux/kcov.h> +#include <linux/mutex.h> +#include <linux/plist.h> +#include <linux/hrtimer.h> #include <linux/seccomp.h> +#include <linux/nodemask.h> #include <linux/rcupdate.h> -#include <linux/resource.h> -#include <linux/hrtimer.h> -#include <linux/kcov.h> -#include <linux/task_io_accounting.h> #include <linux/latencytop.h> +#include <linux/sched/prio.h> +#include <linux/signal_types.h> +#include <linux/mm_types_task.h> +#include <linux/task_io_accounting.h> -#include <asm/current.h> - -/* task_struct member predeclarations: */ +/* task_struct member predeclarations (sorted alphabetically): */ struct audit_context ; -struct autogroup ;struct backing_dev_info ;struct bio_list ;struct blk_plug ;struct cfs_rq ; -struct filename ;struct fs_struct ;struct futex_pi_state ;struct io_context ;
@@ -52,8 +52,6 @@ struct sighand_struct;struct signal_struct ;struct task_delay_info ;struct task_group ; -struct task_struct ; -struct uts_namespace ;/* * Task state bitmask. NOTE! These bits are also
@@ -65,50 +63,53 @@ struct uts_namespace;* modifying one set can't modify the other one by * mistake. */ -#define TASK_RUNNING 0 -#define TASK_INTERRUPTIBLE 1 -#define TASK_UNINTERRUPTIBLE 2 -#define __TASK_STOPPED 4 -#define __TASK_TRACED 8 -/* in tsk->exit_state */ -#define EXIT_DEAD 16 -#define EXIT_ZOMBIE 32 -#define EXIT_TRACE (EXIT_ZOMBIE | EXIT_DEAD) -/* in tsk->state again */ -#define TASK_DEAD 64 -#define TASK_WAKEKILL 128 -#define TASK_WAKING 256 -#define TASK_PARKED 512 -#define TASK_NOLOAD 1024 -#define TASK_NEW 2048 -#define TASK_STATE_MAX 4096 - -#define TASK_STATE_TO_CHAR_STR "RSDTtXZxKWPNn" - -/* Convenience macros for the sake of set_current_state */ -#define TASK_KILLABLE (TASK_WAKEKILL | TASK_UNINTERRUPTIBLE) -#define TASK_STOPPED (TASK_WAKEKILL | __TASK_STOPPED) -#define TASK_TRACED (TASK_WAKEKILL | __TASK_TRACED) - -#define TASK_IDLE (TASK_UNINTERRUPTIBLE | TASK_NOLOAD) - -/* Convenience macros for the sake of wake_up */ -#define TASK_NORMAL (TASK_INTERRUPTIBLE | TASK_UNINTERRUPTIBLE) -#define TASK_ALL (TASK_NORMAL | __TASK_STOPPED | __TASK_TRACED) - -/* get_task_state() */ -#define TASK_REPORT (TASK_RUNNING | TASK_INTERRUPTIBLE | \ - TASK_UNINTERRUPTIBLE | __TASK_STOPPED | \ - __TASK_TRACED | EXIT_ZOMBIE | EXIT_DEAD) - -#define task_is_traced (task) ((task->state & __TASK_TRACED) != 0) -#define task_is_stopped (task) ((task->state & __TASK_STOPPED) != 0) -#define task_is_stopped_or_traced (task) \ - ((task->state & (__TASK_STOPPED | __TASK_TRACED)) != 0) -#define task_contributes_to_load (task) \ - ((task->state & TASK_UNINTERRUPTIBLE) != 0 && \ - (task->flags & PF_FROZEN) == 0 && \ - (task->state & TASK_NOLOAD) == 0) + +/* Used in tsk->state: */ +#define TASK_RUNNING 0 +#define TASK_INTERRUPTIBLE 1 +#define TASK_UNINTERRUPTIBLE 2 +#define __TASK_STOPPED 4 +#define __TASK_TRACED 8 +/* Used in tsk->exit_state: */ +#define EXIT_DEAD 16 +#define EXIT_ZOMBIE 32 +#define EXIT_TRACE (EXIT_ZOMBIE | EXIT_DEAD) +/* Used in tsk->state again: */ +#define TASK_DEAD 64 +#define TASK_WAKEKILL 128 +#define TASK_WAKING 256 +#define TASK_PARKED 512 +#define TASK_NOLOAD 1024 +#define TASK_NEW 2048 +#define TASK_STATE_MAX 4096 + +#define TASK_STATE_TO_CHAR_STR "RSDTtXZxKWPNn" + +/* Convenience macros for the sake of set_current_state: */ +#define TASK_KILLABLE (TASK_WAKEKILL | TASK_UNINTERRUPTIBLE) +#define TASK_STOPPED (TASK_WAKEKILL | __TASK_STOPPED) +#define TASK_TRACED (TASK_WAKEKILL | __TASK_TRACED) + +#define TASK_IDLE (TASK_UNINTERRUPTIBLE | TASK_NOLOAD) + +/* Convenience macros for the sake of wake_up(): */ +#define TASK_NORMAL (TASK_INTERRUPTIBLE | TASK_UNINTERRUPTIBLE) +#define TASK_ALL (TASK_NORMAL | __TASK_STOPPED | __TASK_TRACED) + +/* get_task_state(): */ +#define TASK_REPORT (TASK_RUNNING | TASK_INTERRUPTIBLE | \ + TASK_UNINTERRUPTIBLE | __TASK_STOPPED | \ + __TASK_TRACED | EXIT_ZOMBIE | EXIT_DEAD) + +#define task_is_traced (task) ((task->state & __TASK_TRACED) != 0) + +#define task_is_stopped (task) ((task->state & __TASK_STOPPED) != 0) + +#define task_is_stopped_or_traced (task) ((task->state & (__TASK_STOPPED | __TASK_TRACED)) != 0) + +#define task_contributes_to_load (task) ((task->state & TASK_UNINTERRUPTIBLE) != 0 && \ + (task->flags & PF_FROZEN) == 0 && \ + (task->state & TASK_NOLOAD) == 0)#ifdef CONFIG_DEBUG_ATOMIC_SLEEP
@@ -158,26 +159,24 @@ struct uts_namespace;* * Also see the comments of try_to_wake_up(). */ -#define __set_current_state (state_value) \ - do { current->state = (state_value); } while (0) -#define set_current_state (state_value) \ - smp_store_mb(current->state, (state_value)) - +#define __set_current_state (state_value) do { current->state = (state_value); } while (0) +#define set_current_state (state_value) smp_store_mb(current->state, (state_value))#endif -/* Task command name length */ -#define TASK_COMM_LEN 16 +/* Task command name length: */ +#define TASK_COMM_LEN 16 -extern cpumask_var_t cpu_isolated_map; +extern cpumask_var_t cpu_isolated_map;extern void scheduler_tick (void ); -#define MAX_SCHEDULE_TIMEOUT LONG_MAX -extern signed long schedule_timeout (signed long timeout); -extern signed long schedule_timeout_interruptible (signed long timeout); -extern signed long schedule_timeout_killable (signed long timeout); -extern signed long schedule_timeout_uninterruptible (signed long timeout); -extern signed long schedule_timeout_idle (signed long timeout); +#define MAX_SCHEDULE_TIMEOUT LONG_MAX + +extern long schedule_timeout (long timeout); +extern long schedule_timeout_interruptible (long timeout); +extern long schedule_timeout_killable (long timeout); +extern long schedule_timeout_uninterruptible (long timeout); +extern long schedule_timeout_idle (long timeout); asmlinkage void schedule(void);extern void schedule_preempt_disabled (void );
@@ -197,9 +196,9 @@ extern void io_schedule(void);*/ struct prev_cputime {#ifndef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE -u64 utime; -u64 stime; -raw_spinlock_t lock; +u64 utime; +u64 stime; +raw_spinlock_t lock;#endif };
@@ -214,25 +213,34 @@ struct prev_cputime {* these counts together and treat all three of them in parallel. */ struct task_cputime { -u64 utime; -u64 stime; -unsigned long long sum_exec_runtime; +u64 utime; +u64 stime; +unsigned long long sum_exec_runtime; }; -/* Alternate field names when used to cache expirations. */ -#define virt_exp utime -#define prof_exp stime -#define sched_exp sum_exec_runtime +/* Alternate field names when used on cache expirations: */ +#define virt_exp utime +#define prof_exp stime +#define sched_exp sum_exec_runtimestruct sched_info {#ifdef CONFIG_SCHED_INFO -/* cumulative counters */ -unsigned long pcount;/* # of times run on this cpu */ -unsigned long long run_delay;/* time spent waiting on a runqueue */ +/* Cumulative counters: */ + +/* # of times we have run on this CPU: */ +unsigned long pcount; + +/* Time spent waiting on a runqueue: */ +unsigned long long run_delay; + +/* Timestamps: */ + +/* When did we last run on a CPU? */ +unsigned long long last_arrival; + +/* When were we last queued to run? */ +unsigned long long last_queued; -/* timestamps */ -unsigned long long last_arrival,/* when we last ran on a cpu */ - last_queued;/* when we were last queued to run */ #endif /* CONFIG_SCHED_INFO */ };
@@ -243,12 +251,12 @@ struct sched_info {* We define a basic fixed point arithmetic range, and then formalize * all these metrics based on that basic range. */ -# define SCHED_FIXEDPOINT_SHIFT 10 -# define SCHED_FIXEDPOINT_SCALE (1L << SCHED_FIXEDPOINT_SHIFT) +# define SCHED_FIXEDPOINT_SHIFT 10 +# define SCHED_FIXEDPOINT_SCALE (1L << SCHED_FIXEDPOINT_SHIFT)struct load_weight { -unsigned long weight; -u32 inv_weight; +unsigned long weight; +u32 inv_weight; };/*
@@ -304,69 +312,73 @@ struct load_weight {* issues. */ struct sched_avg { -u64 last_update_time, load_sum; -u32 util_sum, period_contrib; -unsigned long load_avg, util_avg; +u64 last_update_time; +u64 load_sum; +u32 util_sum; +u32 period_contrib; +unsigned long load_avg; +unsigned long util_avg; };struct sched_statistics {#ifdef CONFIG_SCHEDSTATS -u64 wait_start; -u64 wait_max; -u64 wait_count; -u64 wait_sum; -u64 iowait_count; -u64 iowait_sum; - -u64 sleep_start; -u64 sleep_max; -s64 sum_sleep_runtime; - -u64 block_start; -u64 block_max; -u64 exec_max; -u64 slice_max; - -u64 nr_migrations_cold; -u64 nr_failed_migrations_affine; -u64 nr_failed_migrations_running; -u64 nr_failed_migrations_hot; -u64 nr_forced_migrations; - -u64 nr_wakeups; -u64 nr_wakeups_sync; -u64 nr_wakeups_migrate; -u64 nr_wakeups_local; -u64 nr_wakeups_remote; -u64 nr_wakeups_affine; -u64 nr_wakeups_affine_attempts; -u64 nr_wakeups_passive; -u64 nr_wakeups_idle; +u64 wait_start; +u64 wait_max; +u64 wait_count; +u64 wait_sum; +u64 iowait_count; +u64 iowait_sum; + +u64 sleep_start; +u64 sleep_max; +s64 sum_sleep_runtime; + +u64 block_start; +u64 block_max; +u64 exec_max; +u64 slice_max; + +u64 nr_migrations_cold; +u64 nr_failed_migrations_affine; +u64 nr_failed_migrations_running; +u64 nr_failed_migrations_hot; +u64 nr_forced_migrations; + +u64 nr_wakeups; +u64 nr_wakeups_sync; +u64 nr_wakeups_migrate; +u64 nr_wakeups_local; +u64 nr_wakeups_remote; +u64 nr_wakeups_affine; +u64 nr_wakeups_affine_attempts; +u64 nr_wakeups_passive; +u64 nr_wakeups_idle;#endif };struct sched_entity { -struct load_weight load;/* for load-balancing */ -struct rb_node run_node; -struct list_head group_node; -unsigned int on_rq; +/* For load-balancing: */ +struct load_weight load; +struct rb_node run_node; +struct list_head group_node; +unsigned int on_rq; -u64 exec_start; -u64 sum_exec_runtime; -u64 vruntime; -u64 prev_sum_exec_runtime; +u64 exec_start; +u64 sum_exec_runtime; +u64 vruntime; +u64 prev_sum_exec_runtime; -u64 nr_migrations; +u64 nr_migrations; -struct sched_statistics statistics; +struct sched_statistics statistics;#ifdef CONFIG_FAIR_GROUP_SCHED -int depth; -struct sched_entity *parent; +int depth; +struct sched_entity *parent;/* rq on which this entity is (to be) queued: */ -struct cfs_rq *cfs_rq; +struct cfs_rq *cfs_rq;/* rq "owned" by this entity/group: */ -struct cfs_rq *my_q; +struct cfs_rq *my_q;#endif #ifdef CONFIG_SMP
@@ -376,49 +388,49 @@ struct sched_entity {* Put into separate cache line so it does not * collide with read-mostly values above. */ -struct sched_avg avg____cacheline_aligned_in_smp ; +struct sched_avg avg____cacheline_aligned_in_smp ;#endif };struct sched_rt_entity { -struct list_head run_list; -unsigned long timeout; -unsigned long watchdog_stamp; -unsigned int time_slice; -unsigned short on_rq; -unsigned short on_list; - -struct sched_rt_entity *back; +struct list_head run_list; +unsigned long timeout; +unsigned long watchdog_stamp; +unsigned int time_slice; +unsigned short on_rq; +unsigned short on_list; + +struct sched_rt_entity *back;#ifdef CONFIG_RT_GROUP_SCHED -struct sched_rt_entity *parent; +struct sched_rt_entity *parent;/* rq on which this entity is (to be) queued: */ -struct rt_rq *rt_rq; +struct rt_rq *rt_rq;/* rq "owned" by this entity/group: */ -struct rt_rq *my_q; +struct rt_rq *my_q;#endif };struct sched_dl_entity { -struct rb_node rb_node; +struct rb_node rb_node;/* * Original scheduling parameters. Copied here from sched_attr * during sched_setattr(), they will remain the same until * the next sched_setattr(). */ -u64 dl_runtime;/* maximum runtime for each instance */ -u64 dl_deadline;/* relative deadline of each instance */ -u64 dl_period;/* separation of two instances (period) */ -u64 dl_bw;/* dl_runtime / dl_deadline */ +u64 dl_runtime;/* Maximum runtime for each instance */ +u64 dl_deadline;/* Relative deadline of each instance */ +u64 dl_period;/* Separation of two instances (period) */ +u64 dl_bw;/* dl_runtime / dl_deadline */ /* * Actual scheduling parameters. Initialized with the values above, * they are continously updated during task execution. Note that * the remaining runtime could be < 0 in case we are in overrun. */ -s64 runtime;/* remaining runtime for this instance */ -u64 deadline;/* absolute deadline for this instance */ -unsigned int flags;/* specifying the scheduler behaviour */ +s64 runtime;/* Remaining runtime for this instance */ +u64 deadline;/* Absolute deadline for this instance */ +unsigned int flags;/* Specifying the scheduler behaviour */ /* * Some bool flags:
@@ -431,24 +443,28 @@ struct sched_dl_entity {* outside bandwidth enforcement mechanism (but only until we * exit the critical section); * -* @dl_yielded tells if task gave up the cpu before consuming +* @dl_yielded tells if task gave up the CPU before consuming * all its available runtime during the last job. */ -int dl_throttled, dl_boosted, dl_yielded; +int dl_throttled; +int dl_boosted; +int dl_yielded;/* * Bandwidth enforcement timer. Each -deadline task has its * own bandwidth to be enforced, thus we need one timer per task. */ -struct hrtimer dl_timer; +struct hrtimer dl_timer; };union rcu_special {struct { -u8 blocked; -u8 need_qs; -u8 exp_need_qs; -u8 pad;/* Otherwise the compiler can store garbage here. */ +u8 blocked; +u8 need_qs; +u8 exp_need_qs; + +/* Otherwise the compiler can store garbage here: */ +u8 pad; } b;/* Bits. */ u32 s;/* Set of bits. */ };
@@ -466,361 +482,417 @@ struct task_struct {* For reasons of header soup (see current_thread_info()), this * must be the first element of task_struct. */ -struct thread_info thread_info; +struct thread_info thread_info;#endif -volatile long state;/* -1 unrunnable, 0 runnable, >0 stopped */ -void *stack; -atomic_t usage; -unsigned int flags;/* per process flags, defined below */ -unsigned int ptrace; +/* -1 unrunnable, 0 runnable, >0 stopped: */ +volatile long state; +void *stack; +atomic_t usage; +/* Per task flags (PF_*), defined further below: */ +unsigned int flags; +unsigned int ptrace;#ifdef CONFIG_SMP -struct llist_node wake_entry; -int on_cpu; +struct llist_node wake_entry; +int on_cpu;#ifdef CONFIG_THREAD_INFO_IN_TASK -unsigned int cpu;/* current CPU */ +/* Current CPU: */ +unsigned int cpu;#endif -unsigned int wakee_flips; -unsigned long wakee_flip_decay_ts; -struct task_struct *last_wakee; +unsigned int wakee_flips; +unsigned long wakee_flip_decay_ts; +struct task_struct *last_wakee; -int wake_cpu; +int wake_cpu;#endif -int on_rq; +int on_rq; + +int prio; +int static_prio; +int normal_prio; +unsigned int rt_priority; -int prio, static_prio, normal_prio; -unsigned int rt_priority; -const struct sched_class *sched_class; -struct sched_entity se; -struct sched_rt_entity rt; +const struct sched_class *sched_class; +struct sched_entity se; +struct sched_rt_entity rt;#ifdef CONFIG_CGROUP_SCHED -struct task_group *sched_task_group; +struct task_group *sched_task_group;#endif -struct sched_dl_entity dl; +struct sched_dl_entity dl;#ifdef CONFIG_PREEMPT_NOTIFIERS -/* list of struct preempt_notifier: */ -struct hlist_head preempt_notifiers; +/* List of struct preempt_notifier: */ +struct hlist_head preempt_notifiers;#endif #ifdef CONFIG_BLK_DEV_IO_TRACE -unsigned int btrace_seq; +unsigned int btrace_seq;#endif -unsigned int policy; -int nr_cpus_allowed; -cpumask_t cpus_allowed; +unsigned int policy; +int nr_cpus_allowed; +cpumask_t cpus_allowed;#ifdef CONFIG_PREEMPT_RCU -int rcu_read_lock_nesting; -union rcu_special rcu_read_unlock_special; -struct list_head rcu_node_entry; -struct rcu_node *rcu_blocked_node; +int rcu_read_lock_nesting; +union rcu_special rcu_read_unlock_special; +struct list_head rcu_node_entry; +struct rcu_node *rcu_blocked_node;#endif /* #ifdef CONFIG_PREEMPT_RCU */ +#ifdef CONFIG_TASKS_RCU -unsigned long rcu_tasks_nvcsw; -bool rcu_tasks_holdout; -struct list_head rcu_tasks_holdout_list; -int rcu_tasks_idle_cpu; +unsigned long rcu_tasks_nvcsw; +bool rcu_tasks_holdout; +struct list_head rcu_tasks_holdout_list; +int rcu_tasks_idle_cpu;#endif /* #ifdef CONFIG_TASKS_RCU */ -struct sched_info sched_info; +struct sched_info sched_info; -struct list_head tasks; +struct list_head tasks;#ifdef CONFIG_SMP -struct plist_node pushable_tasks; -struct rb_node pushable_dl_tasks; +struct plist_node pushable_tasks; +struct rb_node pushable_dl_tasks;#endif -struct mm_struct *mm, *active_mm; +struct mm_struct *mm; +struct mm_struct *active_mm;/* Per-thread vma caching: */ -struct vmacache vmacache; - -#if defined(SPLIT_RSS_COUNTING ) -struct task_rss_stat rss_stat; -#endif -/* task state */ -int exit_state; -int exit_code, exit_signal; -int pdeath_signal;/* The signal sent when the parent dies */ -unsigned long jobctl;/* JOBCTL_*, siglock protected */ - -/* Used for emulating ABI behavior of previous Linux versions */ -unsigned int personality; - -/* scheduler bits, serialized by scheduler locks */ - unsigned sched_reset_on_fork:1; - unsigned sched_contributes_to_load:1; - unsigned sched_migrated:1; - unsigned sched_remote_wakeup:1; - unsigned :0; /* force alignment to the next boundary */ - -/* unserialized, strictly 'current' */ - unsigned in_execve:1; /* bit to tell LSMs we're in execve */ - unsigned in_iowait:1; -#if !defined(TIF_RESTORE_SIGMASK ) - unsigned restore_sigmask:1; +struct vmacache vmacache; + +#ifdef SPLIT_RSS_COUNTING +struct task_rss_stat rss_stat; +#endif +int exit_state; +int exit_code; +int exit_signal; +/* The signal sent when the parent dies: */ +int pdeath_signal; +/* JOBCTL_*, siglock protected: */ +unsigned long jobctl; + +/* Used for emulating ABI behavior of previous Linux versions: */ +unsigned int personality; + +/* Scheduler bits, serialized by scheduler locks: */ + unsigned sched_reset_on_fork:1; + unsigned sched_contributes_to_load:1; + unsigned sched_migrated:1; + unsigned sched_remote_wakeup:1; +/* Force alignment to the next boundary: */ + unsigned :0; + +/* Unserialized, strictly 'current' */ + +/* Bit to tell LSMs we're in execve(): */ + unsigned in_execve:1; + unsigned in_iowait:1; +#ifndef TIF_RESTORE_SIGMASK + unsigned restore_sigmask:1;#endif #ifdef CONFIG_MEMCG - unsigned memcg_may_oom:1; + unsigned memcg_may_oom:1;#ifndef CONFIG_SLOB - unsigned memcg_kmem_skip_account:1; + unsigned memcg_kmem_skip_account:1;#endif #endif #ifdef CONFIG_COMPAT_BRK - unsigned brk_randomized:1; + unsigned brk_randomized:1;#endif -unsigned long atomic_flags;/* Flags needing atomic access. */ +unsigned long atomic_flags;/* Flags requiring atomic access. */ -struct restart_block restart_block; +struct restart_block restart_block; -pid_t pid; -pid_t tgid; +pid_t pid; +pid_t tgid;#ifdef CONFIG_CC_STACKPROTECTOR -/* Canary value for the -fstack-protector gcc feature */ -unsigned long stack_canary; +/* Canary value for the -fstack-protector GCC feature: */ +unsigned long stack_canary;#endif /* -* pointers to (original) parent process, youngest child, younger sibling, +* Pointers to the (original) parent process, youngest child, younger sibling, * older sibling, respectively. (p->father can be replaced with * p->real_parent->pid) */ -struct task_struct __rcu *real_parent;/* real parent process */ -struct task_struct __rcu *parent;/* recipient of SIGCHLD, wait4() reports */ + +/* Real parent process: */ +struct task_struct __rcu *real_parent; + +/* Recipient of SIGCHLD, wait4() reports: */ +struct task_struct __rcu *parent; +/* -* children/sibling forms the list of my natural children +* Children/sibling form the list of natural children: */ -struct list_head children;/* list of my children */ -struct list_head sibling;/* linkage in my parent's children list */ -struct task_struct *group_leader;/* threadgroup leader */ +struct list_head children; +struct list_head sibling; +struct task_struct *group_leader;/* -* ptraced is the list of tasks this task is using ptrace on. +* 'ptraced' is the list of tasks this task is using ptrace() on. +* * This includes both natural children and PTRACE_ATTACH targets. -* p->ptrace_entry is p's link on the p->parent->ptraced list. +* 'ptrace_entry' is this task's link on the p->parent->ptraced list. */ -struct list_head ptraced; -struct list_head ptrace_entry; +struct list_head ptraced; +struct list_head ptrace_entry;/* PID/PID hash table linkage. */ -struct pid_link pids[PIDTYPE_MAX ]; -struct list_head thread_group; -struct list_head thread_node; +struct pid_link pids[PIDTYPE_MAX ]; +struct list_head thread_group; +struct list_head thread_node; + +struct completion *vfork_done; -struct completion *vfork_done;/* for vfork() */ -int __user *set_child_tid;/* CLONE_CHILD_SETTID */ -int __user *clear_child_tid;/* CLONE_CHILD_CLEARTID */ +/* CLONE_CHILD_SETTID: */ +int __user *set_child_tid; -u64 utime, stime; +/* CLONE_CHILD_CLEARTID: */ +int __user *clear_child_tid; + +u64 utime; +u64 stime;#ifdef CONFIG_ARCH_HAS_SCALED_CPUTIME -u64 utimescaled, stimescaled; +u64 utimescaled; +u64 stimescaled;#endif -u64 gtime; -struct prev_cputime prev_cputime; +u64 gtime; +struct prev_cputime prev_cputime;#ifdef CONFIG_VIRT_CPU_ACCOUNTING_GEN -seqcount_t vtime_seqcount; -unsigned long long vtime_snap; +seqcount_t vtime_seqcount; +unsigned long long vtime_snap;enum { -/* Task is sleeping or running in a CPU with VTIME inactive */ +/* Task is sleeping or running in a CPU with VTIME inactive: */ VTIME_INACTIVE =0 , -/* Task runs in userspace in a CPU with VTIME active */ +/* Task runs in userspace in a CPU with VTIME active: */ VTIME_USER , -/* Task runs in kernelspace in a CPU with VTIME active */ +/* Task runs in kernelspace in a CPU with VTIME active: */ VTIME_SYS , } vtime_snap_whence;#endif #ifdef CONFIG_NO_HZ_FULL -atomic_t tick_dep_mask; +atomic_t tick_dep_mask;#endif -unsigned long nvcsw, nivcsw;/* context switch counts */ -u64 start_time;/* monotonic time in nsec */ -u64 real_start_time;/* boot based time in nsec */ -/* mm fault and swap info: this can arguably be seen as either mm-specific or thread-specific */ -unsigned long min_flt, maj_flt; +/* Context switch counts: */ +unsigned long nvcsw; +unsigned long nivcsw; + +/* Monotonic time in nsecs: */ +u64 start_time; + +/* Boot based time in nsecs: */ +u64 real_start_time; + +/* MM fault and swap info: this can arguably be seen as either mm-specific or thread-specific: */ +unsigned long min_flt; +unsigned long maj_flt;#ifdef CONFIG_POSIX_TIMERS -struct task_cputime cputime_expires; -struct list_head cpu_timers[3 ]; -#endif - -/* process credentials */ -const struct cred __rcu *ptracer_cred;/* Tracer's credentials at attach */ -const struct cred __rcu *real_cred;/* objective and real subjective task -* credentials (COW) */ -const struct cred __rcu *cred;/* effective (overridable) subjective task -* credentials (COW) */ -char comm[TASK_COMM_LEN ];/* executable name excluding path -- access with [gs]et_task_comm (which lock -it with task_lock()) -- initialized normally by setup_new_exec */ -/* file system info */ -struct nameidata *nameidata; +struct task_cputime cputime_expires; +struct list_head cpu_timers[3 ]; +#endif + +/* Process credentials: */ + +/* Tracer's credentials at attach: */ +const struct cred __rcu *ptracer_cred; + +/* Objective and real subjective task credentials (COW): */ +const struct cred __rcu *real_cred; + +/* Effective (overridable) subjective task credentials (COW): */ +const struct cred __rcu *cred; + +/* +* executable name, excluding path. +* +* - normally initialized setup_new_exec() +* - access it with [gs]et_task_comm() +* - lock it with task_lock() +*/ +char comm[TASK_COMM_LEN ]; + +struct nameidata *nameidata; +#ifdef CONFIG_SYSVIPC -/* ipc stuff */ -struct sysv_sem sysvsem; -struct sysv_shm sysvshm; +struct sysv_sem sysvsem; +struct sysv_shm sysvshm;#endif #ifdef CONFIG_DETECT_HUNG_TASK -/* hung task detection */ -unsigned long last_switch_count; -#endif -/* filesystem information */ -struct fs_struct *fs; -/* open file information */ -struct files_struct *files; -/* namespaces */ -struct nsproxy *nsproxy; -/* signal handlers */ -struct signal_struct *signal; -struct sighand_struct *sighand; - -sigset_t blocked, real_blocked; -sigset_t saved_sigmask;/* restored if set_restore_sigmask() was used */ -struct sigpending pending; - -unsigned long sas_ss_sp; -size_t sas_ss_size; -unsigned sas_ss_flags; - -struct callback_head *task_works; - -struct audit_context *audit_context; +unsigned long last_switch_count; +#endif +/* Filesystem information: */ +struct fs_struct *fs; + +/* Open file information: */ +struct files_struct *files; + +/* Namespaces: */ +struct nsproxy *nsproxy; + +/* Signal handlers: */ +struct signal_struct *signal; +struct sighand_struct *sighand; +sigset_t blocked; +sigset_t real_blocked; +/* Restored if set_restore_sigmask() was used: */ +sigset_t saved_sigmask; +struct sigpending pending; +unsigned long sas_ss_sp; +size_t sas_ss_size; +unsigned int sas_ss_flags; + +struct callback_head *task_works; + +struct audit_context *audit_context;#ifdef CONFIG_AUDITSYSCALL -kuid_t loginuid; -unsigned int sessionid; +kuid_t loginuid; +unsigned int sessionid;#endif -struct seccomp seccomp; +struct seccomp seccomp; -/* Thread group tracking */ -u32 parent_exec_id; -u32 self_exec_id; -/* Protection of (de-)allocation: mm, files, fs, tty, keyrings, mems_allowed, -* mempolicy */ -spinlock_t alloc_lock; +/* Thread group tracking: */ +u32 parent_exec_id; +u32 self_exec_id; + +/* Protection against (de-)allocation: mm, files, fs, tty, keyrings, mems_allowed, mempolicy: */ +spinlock_t alloc_lock;/* Protection of the PI data structures: */ -raw_spinlock_t pi_lock; +raw_spinlock_t pi_lock; -void *wake_q; +void *wake_q;#ifdef CONFIG_RT_MUTEXES -/* PI waiters blocked on a rt_mutex held by this task */ -struct rb_root pi_waiters; -struct rb_node *pi_waiters_leftmost; -/* Deadlock detection and priority inheritance handling */ -struct rt_mutex_waiter *pi_blocked_on; +/* PI waiters blocked on a rt_mutex held by this task: */ +struct rb_root pi_waiters; +struct rb_node *pi_waiters_leftmost; +/* Deadlock detection and priority inheritance handling: */ +struct rt_mutex_waiter *pi_blocked_on;#endif #ifdef CONFIG_DEBUG_MUTEXES -/* mutex deadlock detection */ -struct mutex_waiter *blocked_on; +/* Mutex deadlock detection: */ +struct mutex_waiter *blocked_on;#endif +#ifdef CONFIG_TRACE_IRQFLAGS -unsigned int irq_events; -unsigned long hardirq_enable_ip; -unsigned long hardirq_disable_ip; -unsigned int hardirq_enable_event; -unsigned int hardirq_disable_event; -int hardirqs_enabled; -int hardirq_context; -unsigned long softirq_disable_ip; -unsigned long softirq_enable_ip; -unsigned int softirq_disable_event; -unsigned int softirq_enable_event; -int softirqs_enabled; -int softirq_context; +unsigned int irq_events; +unsigned long hardirq_enable_ip; +unsigned long hardirq_disable_ip; +unsigned int hardirq_enable_event; +unsigned int hardirq_disable_event; +int hardirqs_enabled; +int hardirq_context; +unsigned long softirq_disable_ip; +unsigned long softirq_enable_ip; +unsigned int softirq_disable_event; +unsigned int softirq_enable_event; +int softirqs_enabled; +int softirq_context;#endif +#ifdef CONFIG_LOCKDEP -# define MAX_LOCK_DEPTH 48UL -u64 curr_chain_key; -int lockdep_depth; -unsigned int lockdep_recursion; -struct held_lock held_locks[MAX_LOCK_DEPTH ]; -gfp_t lockdep_reclaim_gfp; +# define MAX_LOCK_DEPTH 48UL +u64 curr_chain_key; +int lockdep_depth; +unsigned int lockdep_recursion; +struct held_lock held_locks[MAX_LOCK_DEPTH ]; +gfp_t lockdep_reclaim_gfp;#endif +#ifdef CONFIG_UBSAN -unsigned int in_ubsan; +unsigned int in_ubsan;#endif -/* journalling filesystem info */ -void *journal_info; +/* Journalling filesystem info: */ +void *journal_info; -/* stacked block device info */ -struct bio_list *bio_list; +/* Stacked block device info: */ +struct bio_list *bio_list;#ifdef CONFIG_BLOCK -/* stack plugging */ -struct blk_plug *plug; +/* Stack plugging: */ +struct blk_plug *plug;#endif -/* VM state */ -struct reclaim_state *reclaim_state; +/* VM state: */ +struct reclaim_state *reclaim_state; + +struct backing_dev_info *backing_dev_info; -struct backing_dev_info *backing_dev_info; +struct io_context *io_context; -struct io_context *io_context; +/* Ptrace state: */ +unsigned long ptrace_message; +siginfo_t *last_siginfo; -unsigned long ptrace_message; -siginfo_t *last_siginfo;/* For ptrace use. */ -struct task_io_accounting ioac; -#if defined(CONFIG_TASK_XACCT ) -u64 acct_rss_mem1;/* accumulated rss usage */ -u64 acct_vm_mem1;/* accumulated virtual memory usage */ -u64 acct_timexpd;/* stime + utime since last update */ +struct task_io_accounting ioac; +#ifdef CONFIG_TASK_XACCT +/* Accumulated RSS usage: */ +u64 acct_rss_mem1; +/* Accumulated virtual memory usage: */ +u64 acct_vm_mem1; +/* stime + utime since last update: */ +u64 acct_timexpd;#endif #ifdef CONFIG_CPUSETS -nodemask_t mems_allowed;/* Protected by alloc_lock */ -seqcount_t mems_allowed_seq;/* Seqence no to catch updates */ -int cpuset_mem_spread_rotor; -int cpuset_slab_spread_rotor; +/* Protected by ->alloc_lock: */ +nodemask_t mems_allowed; +/* Seqence number to catch updates: */ +seqcount_t mems_allowed_seq; +int cpuset_mem_spread_rotor; +int cpuset_slab_spread_rotor;#endif #ifdef CONFIG_CGROUPS -/* Control Group info protected by css_set_lock */ -struct css_set __rcu *cgroups; -/* cg_list protected by css_set_lock and tsk->alloc_lock */ -struct list_head cg_list; +/* Control Group info protected by css_set_lock: */ +struct css_set __rcu *cgroups; +/* cg_list protected by css_set_lock and tsk->alloc_lock: */ +struct list_head cg_list;#endif #ifdef CONFIG_INTEL_RDT_A -int closid; +int closid;#endif #ifdef CONFIG_FUTEX -struct robust_list_head __user *robust_list; +struct robust_list_head __user *robust_list;#ifdef CONFIG_COMPAT struct compat_robust_list_head __user *compat_robust_list;#endif -struct list_head pi_state_list; -struct futex_pi_state *pi_state_cache; +struct list_head pi_state_list; +struct futex_pi_state *pi_state_cache;#endif #ifdef CONFIG_PERF_EVENTS -struct perf_event_context *perf_event_ctxp[perf_nr_task_contexts]; -struct mutex perf_event_mutex; -struct list_head perf_event_list; +struct perf_event_context *perf_event_ctxp[perf_nr_task_contexts]; +struct mutex perf_event_mutex; +struct list_head perf_event_list;#endif #ifdef CONFIG_DEBUG_PREEMPT -unsigned long preempt_disable_ip; +unsigned long preempt_disable_ip;#endif #ifdef CONFIG_NUMA -struct mempolicy *mempolicy;/* Protected by alloc_lock */ -short il_next; -short pref_node_fork; +/* Protected by alloc_lock: */ +struct mempolicy *mempolicy; +short il_next; +short pref_node_fork;#endif #ifdef CONFIG_NUMA_BALANCING -int numa_scan_seq; -unsigned int numa_scan_period; -unsigned int numa_scan_period_max; -int numa_preferred_nid; -unsigned long numa_migrate_retry; -u64 node_stamp;/* migration stamp */ -u64 last_task_numa_placement; -u64 last_sum_exec_runtime; -struct callback_head numa_work; - -struct list_head numa_entry; -struct numa_group *numa_group; +int numa_scan_seq; +unsigned int numa_scan_period; +unsigned int numa_scan_period_max; +int numa_preferred_nid; +unsigned long numa_migrate_retry; +/* Migration stamp: */ +u64 node_stamp; +u64 last_task_numa_placement; +u64 last_sum_exec_runtime; +struct callback_head numa_work; + +struct list_head numa_entry; +struct numa_group *numa_group;/* * numa_faults is an array split into four regions:
@@ -836,8 +908,8 @@ struct task_struct {* during the current scan window. When the scan completes, the counts * in faults_memory and faults_cpu decay and these values are copied. */ -unsigned long *numa_faults; -unsigned long total_numa_faults; +unsigned long *numa_faults; +unsigned long total_numa_faults;/* * numa_faults_locality tracks if faults recorded during the last
@@ -845,117 +917,130 @@ struct task_struct {* period is adapted based on the locality of the faults with different * weights depending on whether they were shared or private faults */ -unsigned long numa_faults_locality[3 ]; +unsigned long numa_faults_locality[3 ]; -unsigned long numa_pages_migrated; +unsigned long numa_pages_migrated;#endif /* CONFIG_NUMA_BALANCING */ -struct tlbflush_unmap_batch tlb_ubc; +struct tlbflush_unmap_batch tlb_ubc; -struct rcu_head rcu; +struct rcu_head rcu; -/* -* cache last used pipe for splice -*/ -struct pipe_inode_info *splice_pipe; +/* Cache last used pipe for splice(): */ +struct pipe_inode_info *splice_pipe; -struct page_frag task_frag; +struct page_frag task_frag; -struct task_delay_info *delays; +struct task_delay_info *delays;#ifdef CONFIG_FAULT_INJECTION -int make_it_fail; +int make_it_fail;#endif /* -* when (nr_dirtied >= nr_dirtied_pause), it's time to call -* balance_dirty_pages() for some dirty throttling pause +* When (nr_dirtied >= nr_dirtied_pause), it's time to call +* balance_dirty_pages() for a dirty throttling pause: */ -int nr_dirtied; -int nr_dirtied_pause; -unsigned long dirty_paused_when;/* start of a write-and-pause period */ +int nr_dirtied; +int nr_dirtied_pause; +/* Start of a write-and-pause period: */ +unsigned long dirty_paused_when;#ifdef CONFIG_LATENCYTOP -int latency_record_count; -struct latency_record latency_record[LT_SAVECOUNT ]; +int latency_record_count; +struct latency_record latency_record[LT_SAVECOUNT ];#endif /* -* time slack values; these are used to round up poll() and +* Time slack values; these are used to round up poll() and * select() etc timeout values. These are in nanoseconds. */ -u64 timer_slack_ns; -u64 default_timer_slack_ns; +u64 timer_slack_ns; +u64 default_timer_slack_ns;#ifdef CONFIG_KASAN -unsigned int kasan_depth; +unsigned int kasan_depth;#endif +#ifdef CONFIG_FUNCTION_GRAPH_TRACER -/* Index of current stored address in ret_stack */ -int curr_ret_stack; -/* Stack of return addresses for return function tracing */ -struct ftrace_ret_stack *ret_stack; -/* time stamp for last schedule */ -unsigned long long ftrace_timestamp; +/* Index of current stored address in ret_stack: */ +int curr_ret_stack; + +/* Stack of return addresses for return function tracing: */ +struct ftrace_ret_stack *ret_stack; + +/* Timestamp for last schedule: */ +unsigned long long ftrace_timestamp; +/* * Number of functions that haven't been traced -* because of depth overrun. +* because of depth overrun: */ -atomic_t trace_overrun; -/* Pause for the tracing */ -atomic_t tracing_graph_pause; +atomic_t trace_overrun; + +/* Pause tracing: */ +atomic_t tracing_graph_pause;#endif +#ifdef CONFIG_TRACING -/* state flags for use by tracers */ -unsigned long trace; -/* bitmask and counter of trace recursion */ -unsigned long trace_recursion; +/* State flags for use by tracers: */ +unsigned long trace; + +/* Bitmask and counter of trace recursion: */ +unsigned long trace_recursion;#endif /* CONFIG_TRACING */ +#ifdef CONFIG_KCOV -/* Coverage collection mode enabled for this task (0 if disabled). */ -enum kcov_mode kcov_mode; -/* Size of the kcov_area. */ -unsigned kcov_size; -/* Buffer for coverage collection. */ -void *kcov_area; -/* kcov desciptor wired with this task or NULL. */ -struct kcov *kcov; +/* Coverage collection mode enabled for this task (0 if disabled): */ +enum kcov_mode kcov_mode; + +/* Size of the kcov_area: */ +unsigned int kcov_size; + +/* Buffer for coverage collection: */ +void *kcov_area; + +/* KCOV descriptor wired with this task or NULL: */ +struct kcov *kcov;#endif +#ifdef CONFIG_MEMCG -struct mem_cgroup *memcg_in_oom; -gfp_t memcg_oom_gfp_mask; -int memcg_oom_order; +struct mem_cgroup *memcg_in_oom; +gfp_t memcg_oom_gfp_mask; +int memcg_oom_order; -/* number of pages to reclaim on returning to userland */ -unsigned int memcg_nr_pages_over_high; +/* Number of pages to reclaim on returning to userland: */ +unsigned int memcg_nr_pages_over_high;#endif +#ifdef CONFIG_UPROBES -struct uprobe_task *utask; +struct uprobe_task *utask;#endif #if defined(CONFIG_BCACHE ) || defined(CONFIG_BCACHE_MODULE ) -unsigned int sequential_io; -unsigned int sequential_io_avg; +unsigned int sequential_io; +unsigned int sequential_io_avg;#endif #ifdef CONFIG_DEBUG_ATOMIC_SLEEP -unsigned long task_state_change; +unsigned long task_state_change;#endif -int pagefault_disabled; +int pagefault_disabled;#ifdef CONFIG_MMU -struct task_struct *oom_reaper_list; +struct task_struct *oom_reaper_list;#endif #ifdef CONFIG_VMAP_STACK -struct vm_struct *stack_vm_area; +struct vm_struct *stack_vm_area;#endif #ifdef CONFIG_THREAD_INFO_IN_TASK -/* A live task holds one reference. */ -atomic_t stack_refcount; +/* A live task holds one reference: */ +atomic_t stack_refcount;#endif -/* CPU-specific state of this task */ -struct thread_struct thread; -/* -* WARNING: on x86, 'thread_struct' contains a variable-sized -* structure. It *MUST* be at the end of 'task_struct'. -* -* Do not put anything below here! -*/ +/* CPU-specific state of this task: */ +struct thread_struct thread; + +/* +* WARNING: on x86, 'thread_struct' contains a variable-sized +* structure. It *MUST* be at the end of 'task_struct'. +* +* Do not put anything below here! +*/ };static inline struct pid *task_pid (struct task_struct *task)
@@ -969,7 +1054,7 @@ static inline struct pid *task_tgid(struct task_struct *task) }/* -* Without tasklist or rcu lock it is not safe to dereference +* Without tasklist or RCU lock it is not safe to dereference * the result of task_pgrp/task_session even if task == current, * we can race with another thread doing sys_setsid/sys_setpgid. */
@@ -996,16 +1081,14 @@ static inline struct pid *task_session(struct task_struct *task)* * see also pid_nr() etc in include/linux/pid.h */ -pid_t __task_pid_nr_ns (struct task_struct *task,enum pid_type type, -struct pid_namespace *ns); +pid_t __task_pid_nr_ns (struct task_struct *task,enum pid_type type,struct pid_namespace *ns);static inline pid_t task_pid_nr (struct task_struct *tsk) {return tsk->pid; } -static inline pid_t task_pid_nr_ns (struct task_struct *tsk, -struct pid_namespace *ns) +static inline pid_t task_pid_nr_ns (struct task_struct *tsk,struct pid_namespace *ns) {return __task_pid_nr_ns (tsk,PIDTYPE_PID , ns); }
@@ -1021,15 +1104,28 @@ static inline pid_t task_tgid_nr(struct task_struct *tsk)return tsk->tgid; } -pid_t task_tgid_nr_ns (struct task_struct *tsk,struct pid_namespace *ns); +extern pid_t task_tgid_nr_ns (struct task_struct *tsk,struct pid_namespace *ns);static inline pid_t task_tgid_vnr (struct task_struct *tsk) {return pid_vnr (task_tgid (tsk)); } +/** +* pid_alive - check that a task structure is not stale +* @p: Task structure to be checked. +* +* Test if a process is not yet dead (at most zombie state) +* If pid_alive fails, then pointers within the task structure +* can be stale and must not be dereferenced. +* +* Return: 1 if the process is alive. 0 otherwise. +*/ +static inline int pid_alive (const struct task_struct *p) +{ +return p->pids[PIDTYPE_PID ].pid !=NULL ; +} -static inline int pid_alive (const struct task_struct *p);static inline pid_t task_ppid_nr_ns (const struct task_struct *tsk,struct pid_namespace *ns) {pid_t pid =0 ;
@@ -1047,8 +1143,7 @@ static inline pid_t task_ppid_nr(const struct task_struct *tsk)return task_ppid_nr_ns (tsk, &init_pid_ns); } -static inline pid_t task_pgrp_nr_ns (struct task_struct *tsk, -struct pid_namespace *ns) +static inline pid_t task_pgrp_nr_ns (struct task_struct *tsk,struct pid_namespace *ns) {return __task_pid_nr_ns (tsk,PIDTYPE_PGID , ns); }
@@ -1059,8 +1154,7 @@ static inline pid_t task_pgrp_vnr(struct task_struct *tsk) } -static inline pid_t task_session_nr_ns (struct task_struct *tsk, -struct pid_namespace *ns) +static inline pid_t task_session_nr_ns (struct task_struct *tsk,struct pid_namespace *ns) {return __task_pid_nr_ns (tsk,PIDTYPE_SID , ns); }
@@ -1070,28 +1164,13 @@ static inline pid_t task_session_vnr(struct task_struct *tsk)return __task_pid_nr_ns (tsk,PIDTYPE_SID ,NULL ); } -/* obsolete, do not use */ +/* Obsolete, do not use: */ static inline pid_t task_pgrp_nr (struct task_struct *tsk) {return task_pgrp_nr_ns (tsk, &init_pid_ns); }/** -* pid_alive - check that a task structure is not stale -* @p: Task structure to be checked. -* -* Test if a process is not yet dead (at most zombie state) -* If pid_alive fails, then pointers within the task structure -* can be stale and must not be dereferenced. -* -* Return: 1 if the process is alive. 0 otherwise. -*/ -static inline int pid_alive (const struct task_struct *p) -{ -return p->pids[PIDTYPE_PID ].pid !=NULL ; -} - -/** * is_global_init - check if a task structure is init. Since init * is free to have sub-threads we need to check tgid. * @tsk: Task structure to be checked.
@@ -1110,34 +1189,34 @@ extern struct pid *cad_pid;/* * Per process flags */ -#define PF_IDLE 0x00000002/* I am an IDLE thread */ -#define PF_EXITING 0x00000004/* getting shut down */ -#define PF_EXITPIDONE 0x00000008/* pi exit done on shut down */ -#define PF_VCPU 0x00000010/* I'm a virtual CPU */ -#define PF_WQ_WORKER 0x00000020/* I'm a workqueue worker */ -#define PF_FORKNOEXEC 0x00000040/* forked but didn't exec */ -#define PF_MCE_PROCESS 0x00000080/* process policy on mce errors */ -#define PF_SUPERPRIV 0x00000100/* used super-user privileges */ -#define PF_DUMPCORE 0x00000200/* dumped core */ -#define PF_SIGNALED 0x00000400/* killed by a signal */ -#define PF_MEMALLOC 0x00000800/* Allocating memory */ -#define PF_NPROC_EXCEEDED 0x00001000/* set_user noticed that RLIMIT_NPROC was exceeded */ -#define PF_USED_MATH 0x00002000/* if unset the fpu must be initialized before use */ -#define PF_USED_ASYNC 0x00004000/* used async_schedule*(), used by module init */ -#define PF_NOFREEZE 0x00008000/* this thread should not be frozen */ -#define PF_FROZEN 0x00010000/* frozen for system suspend */ -#define PF_FSTRANS 0x00020000/* inside a filesystem transaction */ -#define PF_KSWAPD 0x00040000/* I am kswapd */ -#define PF_MEMALLOC_NOIO 0x00080000/* Allocating memory without IO involved */ -#define PF_LESS_THROTTLE 0x00100000/* Throttle me less: I clean memory */ -#define PF_KTHREAD 0x00200000/* I am a kernel thread */ -#define PF_RANDOMIZE 0x00400000/* randomize virtual address space */ -#define PF_SWAPWRITE 0x00800000/* Allowed to write to swap */ -#define PF_NO_SETAFFINITY 0x04000000/* Userland is not allowed to meddle with cpus_allowed */ -#define PF_MCE_EARLY 0x08000000/* Early kill for mce process policy */ -#define PF_MUTEX_TESTER 0x20000000/* Thread belongs to the rt mutex tester */ -#define PF_FREEZER_SKIP 0x40000000/* Freezer should not count it as freezable */ -#define PF_SUSPEND_TASK 0x80000000/* this thread called freeze_processes and should not be frozen */ +#define PF_IDLE 0x00000002/* I am an IDLE thread */ +#define PF_EXITING 0x00000004/* Getting shut down */ +#define PF_EXITPIDONE 0x00000008/* PI exit done on shut down */ +#define PF_VCPU 0x00000010/* I'm a virtual CPU */ +#define PF_WQ_WORKER 0x00000020/* I'm a workqueue worker */ +#define PF_FORKNOEXEC 0x00000040/* Forked but didn't exec */ +#define PF_MCE_PROCESS 0x00000080/* Process policy on mce errors */ +#define PF_SUPERPRIV 0x00000100/* Used super-user privileges */ +#define PF_DUMPCORE 0x00000200/* Dumped core */ +#define PF_SIGNALED 0x00000400/* Killed by a signal */ +#define PF_MEMALLOC 0x00000800/* Allocating memory */ +#define PF_NPROC_EXCEEDED 0x00001000/* set_user() noticed that RLIMIT_NPROC was exceeded */ +#define PF_USED_MATH 0x00002000/* If unset the fpu must be initialized before use */ +#define PF_USED_ASYNC 0x00004000/* Used async_schedule*(), used by module init */ +#define PF_NOFREEZE 0x00008000/* This thread should not be frozen */ +#define PF_FROZEN 0x00010000/* Frozen for system suspend */ +#define PF_FSTRANS 0x00020000/* Inside a filesystem transaction */ +#define PF_KSWAPD 0x00040000/* I am kswapd */ +#define PF_MEMALLOC_NOIO 0x00080000/* Allocating memory without IO involved */ +#define PF_LESS_THROTTLE 0x00100000/* Throttle me less: I clean memory */ +#define PF_KTHREAD 0x00200000/* I am a kernel thread */ +#define PF_RANDOMIZE 0x00400000/* Randomize virtual address space */ +#define PF_SWAPWRITE 0x00800000/* Allowed to write to swap */ +#define PF_NO_SETAFFINITY 0x04000000/* Userland is not allowed to meddle with cpus_allowed */ +#define PF_MCE_EARLY 0x08000000/* Early kill for mce process policy */ +#define PF_MUTEX_TESTER 0x20000000/* Thread belongs to the rt mutex tester */ +#define PF_FREEZER_SKIP 0x40000000/* Freezer should not count it as freezable */ +#define PF_SUSPEND_TASK 0x80000000/* This thread called freeze_processes() and should not be frozen */ /* * Only the _current_ task can read/write to tsk->flags, but other
@@ -1150,33 +1229,38 @@ extern struct pid *cad_pid;* child is not running and in turn not changing child->flags * at the same time the parent does it. */ -#define clear_stopped_child_used_math (child) do { (child)->flags &= ~PF_USED_MATH; } while (0) -#define set_stopped_child_used_math (child) do { (child)->flags |= PF_USED_MATH; } while (0) -#define clear_used_math () clear_stopped_child_used_math(current) -#define set_used_math () set_stopped_child_used_math(current) +#define clear_stopped_child_used_math (child) do { (child)->flags &= ~PF_USED_MATH; } while (0) +#define set_stopped_child_used_math (child) do { (child)->flags |= PF_USED_MATH; } while (0) +#define clear_used_math () clear_stopped_child_used_math(current) +#define set_used_math () set_stopped_child_used_math(current) +#define conditional_stopped_child_used_math (condition, child) \ do { (child)->flags &= ~PF_USED_MATH, (child)->flags |= (condition) ? PF_USED_MATH : 0; } while (0) -#define conditional_used_math (condition) \ - conditional_stopped_child_used_math(condition, current) + +#define conditional_used_math (condition) conditional_stopped_child_used_math(condition, current) +#define copy_to_stopped_child_used_math (child) \ do { (child)->flags &= ~PF_USED_MATH, (child)->flags |= current->flags & PF_USED_MATH; } while (0) +/* NOTE: this will return 0 or PF_USED_MATH, it will never return 1 */ -#define tsk_used_math (p) ((p)->flags & PF_USED_MATH) -#define used_math () tsk_used_math(current) +#define tsk_used_math (p) ((p)->flags & PF_USED_MATH) +#define used_math () tsk_used_math(current)/* Per-process atomic flags. */ -#define PFA_NO_NEW_PRIVS 0/* May not gain new privileges. */ -#define PFA_SPREAD_PAGE 1/* Spread page cache over cpuset */ -#define PFA_SPREAD_SLAB 2/* Spread some slab caches over cpuset */ -#define PFA_LMK_WAITING 3/* Lowmemorykiller is waiting */ +#define PFA_NO_NEW_PRIVS 0/* May not gain new privileges. */ +#define PFA_SPREAD_PAGE 1/* Spread page cache over cpuset */ +#define PFA_SPREAD_SLAB 2/* Spread some slab caches over cpuset */ +#define PFA_LMK_WAITING 3/* Lowmemorykiller is waiting */ #define TASK_PFA_TEST (name, func) \ static inline bool task_##func(struct task_struct *p) \ { return test_bit(PFA_##name, &p->atomic_flags); } +#define TASK_PFA_SET (name, func) \ static inline void task_set_##func(struct task_struct *p) \ { set_bit(PFA_##name, &p->atomic_flags); } +#define TASK_PFA_CLEAR (name, func) \ static inline void task_clear_##func(struct task_struct *p) \ { clear_bit(PFA_##name, &p->atomic_flags); }
@@ -1195,30 +1279,23 @@ TASK_PFA_CLEAR(SPREAD_SLAB, spread_slab) TASK_PFA_TEST(LMK_WAITING, lmk_waiting) TASK_PFA_SET(LMK_WAITING, lmk_waiting) -static inline void tsk_restore_flags (struct task_struct *task, -unsigned long orig_flags,unsigned long flags) +static inline void +tsk_restore_flags (struct task_struct *task,unsigned long orig_flags,unsigned long flags) { task->flags &= ~flags; task->flags |= orig_flags & flags; } -extern int cpuset_cpumask_can_shrink (const struct cpumask *cur, -const struct cpumask *trial); -extern int task_can_attach (struct task_struct *p, -const struct cpumask *cs_cpus_allowed); +extern int cpuset_cpumask_can_shrink (const struct cpumask *cur,const struct cpumask *trial); +extern int task_can_attach (struct task_struct *p,const struct cpumask *cs_cpus_allowed);#ifdef CONFIG_SMP -extern void do_set_cpus_allowed (struct task_struct *p, -const struct cpumask *new_mask); - -extern int set_cpus_allowed_ptr (struct task_struct *p, -const struct cpumask *new_mask); +extern void do_set_cpus_allowed (struct task_struct *p,const struct cpumask *new_mask); +extern int set_cpus_allowed_ptr (struct task_struct *p,const struct cpumask *new_mask);#else -static inline void do_set_cpus_allowed (struct task_struct *p, -const struct cpumask *new_mask) +static inline void do_set_cpus_allowed (struct task_struct *p,const struct cpumask *new_mask) { } -static inline int set_cpus_allowed_ptr (struct task_struct *p, -const struct cpumask *new_mask) +static inline int set_cpus_allowed_ptr (struct task_struct *p,const struct cpumask *new_mask) {if (!cpumask_test_cpu (0 , new_mask))return -EINVAL ;
@@ -1233,6 +1310,7 @@ static inline int set_cpus_allowed_ptr(struct task_struct *p,extern int yield_to (struct task_struct *p,bool preempt);extern void set_user_nice (struct task_struct *p,long nice);extern int task_prio (const struct task_struct *p); +/** * task_nice - return the nice value of a given task. * @p: the task in question.
@@ -1243,16 +1321,15 @@ static inline int task_nice(const struct task_struct *p) {return PRIO_TO_NICE ((p)->static_prio); } +extern int can_nice (const struct task_struct *p,const int nice);extern int task_curr (const struct task_struct *p);extern int idle_cpu (int cpu); -extern int sched_setscheduler (struct task_struct *,int , -const struct sched_param *); -extern int sched_setscheduler_nocheck (struct task_struct *,int , -const struct sched_param *); -extern int sched_setattr (struct task_struct *, -const struct sched_attr *); +extern int sched_setscheduler (struct task_struct *,int ,const struct sched_param *); +extern int sched_setscheduler_nocheck (struct task_struct *,int ,const struct sched_param *); +extern int sched_setattr (struct task_struct *,const struct sched_attr *);extern struct task_struct *idle_task (int cpu); +/** * is_idle_task - is the specified task an idle task? * @p: the task in question.
@@ -1263,6 +1340,7 @@ static inline bool is_idle_task(const struct task_struct *p) {return !!(p->flags &PF_IDLE ); } +extern struct task_struct *curr_task (int cpu);extern void ia64_set_curr_task (int cpu,struct task_struct *p);
@@ -1296,23 +1374,25 @@ static inline struct thread_info *task_thread_info(struct task_struct *task)*/ extern struct task_struct *find_task_by_vpid (pid_t nr); -extern struct task_struct *find_task_by_pid_ns (pid_t nr, -struct pid_namespace *ns); +extern struct task_struct *find_task_by_pid_ns (pid_t nr,struct pid_namespace *ns);extern int wake_up_state (struct task_struct *tsk,unsigned int state);extern int wake_up_process (struct task_struct *tsk);extern void wake_up_new_task (struct task_struct *tsk); +#ifdef CONFIG_SMP -extern void kick_process (struct task_struct *tsk); +extern void kick_process (struct task_struct *tsk);#else -static inline void kick_process (struct task_struct *tsk) { } +static inline void kick_process (struct task_struct *tsk) { }#endif extern void __set_task_comm (struct task_struct *tsk,const char *from,bool exec); +static inline void set_task_comm (struct task_struct *tsk,const char *from) {__set_task_comm (tsk, from, false); } +extern char *get_task_comm (char *to,struct task_struct *tsk);#ifdef CONFIG_SMP
@@ -1320,15 +1400,15 @@ void scheduler_ipi(void);extern unsigned long wait_task_inactive (struct task_struct *,long match_state);#else static inline void scheduler_ipi (void ) { } -static inline unsigned long wait_task_inactive (struct task_struct *p, -long match_state) +static inline unsigned long wait_task_inactive (struct task_struct *p,long match_state) {return 1 ; }#endif -/* set thread flags in other task's structures -* - see asm/thread_info.h for TIF_xxxx flags available +/* +* Set thread flags in other task's structures. +* See asm/thread_info.h for TIF_xxxx flags available: */ static inline void set_tsk_thread_flag (struct task_struct *tsk,int flag) {
Signature · 1 line
2.7.4
Ingo Molnar
maintainerPATCH 69/89 sched/headers: Move sched_info_on() and force_schedstat_enabled() from <linux/sched.h> to <linux/sched/stat.h>
In reply to Ingo MolnarThese APIs are not core scheduler but statistics related.
Update usage sites.
--- arch/x86/kvm/cpuid.c | 2 ++ arch/x86/kvm/x86.c | 2 ++ fs/proc/base.c | 1 + include/linux/sched.h | 16 ---------------- include/linux/sched/stat.h | 16 ++++++++++++++++ kernel/latencytop.c | 1 + kernel/profile.c | 2 ++ 7 files changed, 24 insertions(+), 16 deletions(-)
arch/x86/kvm/cpuid.c +2 -0
@@ -16,6 +16,8 @@#include <linux/export.h> #include <linux/vmalloc.h> #include <linux/uaccess.h> +#include <linux/sched/stat.h> +#include <asm/processor.h> #include <asm/user.h> #include <asm/fpu/xstate.h>
arch/x86/kvm/x86.c +2 -0
@@ -54,6 +54,8 @@#include <linux/pvclock_gtod.h> #include <linux/kvm_irqfd.h> #include <linux/irqbypass.h> +#include <linux/sched/stat.h> +#include <trace/events/kvm.h> #include <asm/debugreg.h>
fs/proc/base.c +1 -0
@@ -89,6 +89,7 @@#include <linux/sched/mm.h> #include <linux/sched/coredump.h> #include <linux/sched/debug.h> +#include <linux/sched/stat.h> #include <linux/flex_array.h> #include <linux/posix-timers.h> #ifdef CONFIG_HARDWALL
include/linux/sched.h +0 -16
@@ -242,22 +242,6 @@ struct sched_info { };#endif /* CONFIG_SCHED_INFO */ -static inline int sched_info_on (void ) -{ -#ifdef CONFIG_SCHEDSTATS -return 1 ; -#elif defined(CONFIG_TASK_DELAY_ACCT ) -extern int delayacct_on; -return delayacct_on; -#else -return 0 ; -#endif -} - -#ifdef CONFIG_SCHEDSTATS -void force_schedstat_enabled (void ); -#endif -/* * Integer metrics need fixed point arithmetic, e.g., sched/fair * has a few: load, load_avg, util_avg, freq, and capacity.
include/linux/sched/stat.h +16 -0
@@ -21,4 +21,20 @@ extern unsigned long nr_iowait(void);extern unsigned long nr_iowait_cpu (int cpu);extern void get_iowait_load (unsigned long *nr_waiters,unsigned long *load); +static inline int sched_info_on (void ) +{ +#ifdef CONFIG_SCHEDSTATS +return 1 ; +#elif defined(CONFIG_TASK_DELAY_ACCT ) +extern int delayacct_on; +return delayacct_on; +#else +return 0 ; +#endif +} + +#ifdef CONFIG_SCHEDSTATS +void force_schedstat_enabled (void ); +#endif +#endif /* _LINUX_SCHED_STAT_H */
kernel/latencytop.c +1 -0
@@ -56,6 +56,7 @@#include <linux/export.h> #include <linux/sched.h> #include <linux/sched/debug.h> +#include <linux/sched/stat.h> #include <linux/list.h> #include <linux/stacktrace.h>
kernel/profile.c +2 -0
@@ -25,6 +25,8 @@#include <linux/mutex.h> #include <linux/slab.h> #include <linux/vmalloc.h> +#include <linux/sched/stat.h> +#include <asm/sections.h> #include <asm/irq_regs.h> #include <asm/ptrace.h>
Signature · 1 line
2.7.4
Ingo Molnar
maintainerPATCH 68/89 sched/headers: Split cputime functionality out of <linux/sched.h>, into <linux/sched/cputime.h>
In reply to Ingo MolnarMove cputime related functionality out of <linux/sched.h>, as most code that includes <linux/sched.h> does not use that functionality.
Move data types that are not included in task_struct directly to the signal definitions, into <linux/sched/signal.h>.
Also merge the (small) existing <linux/cputime.h> header into <linux/sched/cputime.h>.
Update all code that relies on these facilities.
--- arch/alpha/kernel/osf_sys.c | 1 + arch/ia64/kernel/time.c | 2 +- arch/powerpc/kernel/time.c | 2 +- arch/s390/kernel/idle.c | 2 +- arch/s390/kernel/vtime.c | 2 +- arch/x86/kernel/apm_32.c | 1 + arch/x86/kvm/hyperv.c | 2 + drivers/isdn/mISDN/stack.c | 1 + drivers/s390/cio/cio.c | 2 +- fs/binfmt_elf.c | 1 + fs/binfmt_elf_fdpic.c | 1 + fs/proc/array.c | 1 + fs/proc/stat.c | 2 +- include/linux/cputime.h | 13 ----- include/linux/sched.h | 89 ----------------------------- include/linux/sched/cputime.h | 187 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ include/linux/sched/signal.h | 33 +++++++++++ kernel/acct.c | 2 + kernel/delayacct.c | 1 + kernel/exit.c | 1 + kernel/fork.c | 1 + kernel/sched/cputime.c | 2 +- kernel/sched/sched.h | 1 + kernel/sched/stats.h | 111 ------------------------------------ kernel/signal.c | 1 + kernel/sys.c | 1 + kernel/time/itimer.c | 1 + kernel/time/posix-cpu-timers.c | 1 + kernel/tsacct.c | 1 + 29 files changed, 246 insertions(+), 220 deletions(-)
arch/alpha/kernel/osf_sys.c +1 -0
@@ -14,6 +14,7 @@#include <linux/sched/signal.h> #include <linux/sched/mm.h> #include <linux/sched/task_stack.h> +#include <linux/sched/cputime.h> #include <linux/kernel.h> #include <linux/mm.h> #include <linux/smp.h>
arch/ia64/kernel/time.c +1 -1
@@ -22,7 +22,7 @@#include <linux/timex.h> #include <linux/timekeeper_internal.h> #include <linux/platform_device.h> -#include <linux/cputime.h> +#include <linux/sched/cputime.h> #include <asm/machvec.h> #include <asm/delay.h>
arch/powerpc/kernel/time.c +1 -1
@@ -58,7 +58,7 @@#include <linux/clk-provider.h> #include <linux/suspend.h> #include <linux/rtc.h> -#include <linux/cputime.h> +#include <linux/sched/cputime.h> #include <asm/trace.h> #include <asm/io.h>
arch/s390/kernel/idle.c +1 -1
@@ -12,7 +12,7 @@#include <linux/notifier.h> #include <linux/init.h> #include <linux/cpu.h> -#include <linux/cputime.h> +#include <linux/sched/cputime.h> #include <asm/nmi.h> #include <asm/smp.h> #include "entry.h"
arch/s390/kernel/vtime.c +1 -1
@@ -6,7 +6,7 @@*/ #include <linux/kernel_stat.h> -#include <linux/cputime.h> +#include <linux/sched/cputime.h> #include <linux/export.h> #include <linux/kernel.h> #include <linux/timex.h>
arch/x86/kernel/apm_32.c +1 -0
@@ -219,6 +219,7 @@#include <linux/init.h> #include <linux/time.h> #include <linux/sched/signal.h> +#include <linux/sched/cputime.h> #include <linux/pm.h> #include <linux/capability.h> #include <linux/device.h>
arch/x86/kvm/hyperv.c +2 -0
@@ -28,6 +28,8 @@#include <linux/kvm_host.h> #include <linux/highmem.h> +#include <linux/sched/cputime.h> +#include <asm/apicdef.h> #include <trace/events/kvm.h>
drivers/isdn/mISDN/stack.c +1 -0
@@ -19,6 +19,7 @@#include <linux/mISDNif.h> #include <linux/kthread.h> #include <linux/sched.h> +#include <linux/sched/cputime.h> #include <linux/signal.h> #include "core.h"
drivers/s390/cio/cio.c +1 -1
@@ -29,7 +29,7 @@#include <asm/chpid.h> #include <asm/airq.h> #include <asm/isc.h> -#include <linux/cputime.h> +#include <linux/sched/cputime.h> #include <asm/fcx.h> #include <asm/nmi.h> #include <asm/crw.h>
fs/binfmt_elf.c +1 -0
@@ -37,6 +37,7 @@#include <linux/sched.h> #include <linux/sched/coredump.h> #include <linux/sched/task_stack.h> +#include <linux/sched/cputime.h> #include <linux/cred.h> #include <linux/dax.h> #include <linux/uaccess.h>
fs/binfmt_elf_fdpic.c +1 -0
@@ -17,6 +17,7 @@#include <linux/sched.h> #include <linux/sched/coredump.h> #include <linux/sched/task_stack.h> +#include <linux/sched/cputime.h> #include <linux/mm.h> #include <linux/mman.h> #include <linux/errno.h>
fs/proc/array.c +1 -0
@@ -63,6 +63,7 @@#include <linux/sched/mm.h> #include <linux/sched/numa_balancing.h> #include <linux/sched/task.h> +#include <linux/sched/cputime.h> #include <linux/proc_fs.h> #include <linux/ioport.h> #include <linux/uaccess.h>
fs/proc/stat.c +1 -1
@@ -10,7 +10,7 @@#include <linux/slab.h> #include <linux/time.h> #include <linux/irqnr.h> -#include <linux/cputime.h> +#include <linux/sched/cputime.h> #include <linux/tick.h> #ifndef arch_irq_stat_cpu
include/linux/cputime.h deleted +0 -13
@@ -1,13 +0,0 @@ -#ifndef __LINUX_CPUTIME_H -#define __LINUX_CPUTIME_H - -#ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE -#include <asm/cputime.h> - -#ifndef cputime_to_nsecs -# define cputime_to_nsecs (__ct) \ - (cputime_to_usecs(__ct) * NSEC_PER_USEC) -#endif - -#endif /* CONFIG_VIRT_CPU_ACCOUNTING_NATIVE */ -#endif /* __LINUX_CPUTIME_H */
include/linux/sched.h +0 -89
119 lines not on this page · raw message
include/linux/sched/cputime.h new file +187 -0
187 lines not on this page · raw message
include/linux/sched/signal.h +33 -0
@@ -36,6 +36,39 @@ struct cpu_itimer { };/* +* This is the atomic variant of task_cputime, which can be used for +* storing and updating task_cputime statistics without locking. +*/ +struct task_cputime_atomic { +atomic64_t utime; +atomic64_t stime; +atomic64_t sum_exec_runtime; +}; + +#define INIT_CPUTIME_ATOMIC \ + (struct task_cputime_atomic) { \ + .utime = ATOMIC64_INIT(0), \ + .stime = ATOMIC64_INIT(0), \ + .sum_exec_runtime = ATOMIC64_INIT(0), \ + } +/** +* struct thread_group_cputimer - thread group interval timer counts +* @cputime_atomic: atomic thread group interval timers. +* @running: true when there are timers running and +* @cputime_atomic receives updates. +* @checking_timer: true when a thread in the group is in the +* process of checking for thread group timers. +* +* This structure contains the version of task_cputime, above, that is +* used for thread group CPU timer calculations. +*/ +struct thread_group_cputimer { +struct task_cputime_atomic cputime_atomic; +bool running; +bool checking_timer; +}; + +/* * NOTE! "signal_struct" does not have its own * locking, because a shared signal_struct always * implies a shared sighand_struct, so locking
kernel/acct.c +2 -0
@@ -56,6 +56,8 @@#include <linux/syscalls.h> #include <linux/mount.h> #include <linux/uaccess.h> +#include <linux/sched/cputime.h> +#include <asm/div64.h> #include <linux/blkdev.h> /* sector_div */ #include <linux/pid_namespace.h>
kernel/delayacct.c +1 -0
@@ -15,6 +15,7 @@#include <linux/sched.h> #include <linux/sched/task.h> +#include <linux/sched/cputime.h> #include <linux/slab.h> #include <linux/taskstats.h> #include <linux/time.h>
kernel/exit.c +1 -0
@@ -11,6 +11,7 @@#include <linux/sched/stat.h> #include <linux/sched/task.h> #include <linux/sched/task_stack.h> +#include <linux/sched/cputime.h> #include <linux/interrupt.h> #include <linux/module.h> #include <linux/capability.h>
kernel/fork.c +1 -0
@@ -20,6 +20,7 @@#include <linux/sched/stat.h> #include <linux/sched/task.h> #include <linux/sched/task_stack.h> +#include <linux/sched/cputime.h> #include <linux/rtmutex.h> #include <linux/init.h> #include <linux/unistd.h>
kernel/sched/cputime.c +1 -1
@@ -4,7 +4,7 @@#include <linux/kernel_stat.h> #include <linux/static_key.h> #include <linux/context_tracking.h> -#include <linux/cputime.h> +#include <linux/sched/cputime.h> #include "sched.h" #ifdef CONFIG_IRQ_TIME_ACCOUNTING
kernel/sched/sched.h +1 -0
@@ -17,6 +17,7 @@#include <linux/sched/hotplug.h> #include <linux/sched/task.h> #include <linux/sched/task_stack.h> +#include <linux/sched/cputime.h> #include <linux/u64_stats_sync.h> #include <linux/kernel_stat.h>
kernel/sched/stats.h +0 -111
114 lines not on this page · raw message
kernel/signal.c +1 -0
@@ -18,6 +18,7 @@#include <linux/sched/debug.h> #include <linux/sched/task.h> #include <linux/sched/task_stack.h> +#include <linux/sched/cputime.h> #include <linux/fs.h> #include <linux/tty.h> #include <linux/binfmts.h>
kernel/sys.c +1 -0
@@ -55,6 +55,7 @@#include <linux/sched/mm.h> #include <linux/sched/coredump.h> #include <linux/sched/task.h> +#include <linux/sched/cputime.h> #include <linux/rcupdate.h> #include <linux/uidgid.h> #include <linux/cred.h>
kernel/time/itimer.c +1 -0
@@ -11,6 +11,7 @@#include <linux/syscalls.h> #include <linux/time.h> #include <linux/sched/signal.h> +#include <linux/sched/cputime.h> #include <linux/posix-timers.h> #include <linux/hrtimer.h> #include <trace/events/timer.h>
kernel/time/posix-cpu-timers.c +1 -0
@@ -3,6 +3,7 @@*/ #include <linux/sched/signal.h> +#include <linux/sched/cputime.h> #include <linux/posix-timers.h> #include <linux/errno.h> #include <linux/math64.h>
kernel/tsacct.c +1 -0
@@ -19,6 +19,7 @@#include <linux/kernel.h> #include <linux/sched/signal.h> #include <linux/sched/mm.h> +#include <linux/sched/cputime.h> #include <linux/tsacct_kern.h> #include <linux/acct.h> #include <linux/jiffies.h>
Signature · 1 line
2.7.4
Ingo Molnar
maintainerPATCH 67/89 sched/headers: Move the task_lock()/unlock() APIs to <linux/sched/task.h>
In reply to Ingo MolnarThe task_lock()/task_unlock() APIs are not realated to core scheduling, they are task lifetime APIs, i.e. they belong into <linux/sched/task.h>.
Move them and update the code that uses these facilities.
--- arch/mips/math-emu/dsemul.c | 1 + block/blk-ioc.c | 1 + block/ioprio.c | 1 + drivers/staging/android/ion/ion.c | 1 + drivers/staging/lustre/lustre/ptlrpc/sec.c | 1 + fs/proc/internal.h | 1 + fs/proc/proc_net.c | 1 + fs/proc_namespace.c | 2 ++ include/linux/cpuset.h | 1 + include/linux/sched.h | 20 -------------------- include/linux/sched/task.h | 22 +++++++++++++++++++++- ipc/namespace.c | 1 + kernel/cpuset.c | 1 + kernel/sched/debug.c | 1 + kernel/utsname.c | 1 + mm/mempolicy.c | 1 + mm/mmu_context.c | 1 + net/core/net_namespace.c | 2 ++ net/core/netclassid_cgroup.c | 2 ++ net/core/netprio_cgroup.c | 2 ++ 20 files changed, 43 insertions(+), 21 deletions(-)
arch/mips/math-emu/dsemul.c +1 -0
@@ -1,6 +1,7 @@#include <linux/err.h> #include <linux/slab.h> #include <linux/mm_types.h> +#include <linux/sched/task.h> #include <asm/branch.h> #include <asm/cacheflush.h>
block/blk-ioc.c +1 -0
@@ -7,6 +7,7 @@#include <linux/bio.h> #include <linux/blkdev.h> #include <linux/slab.h> +#include <linux/sched/task.h> #include "blk.h"
block/ioprio.c +1 -0
@@ -27,6 +27,7 @@#include <linux/blkdev.h> #include <linux/capability.h> #include <linux/sched/user.h> +#include <linux/sched/task.h> #include <linux/syscalls.h> #include <linux/security.h> #include <linux/pid_namespace.h>
drivers/staging/android/ion/ion.c +1 -0
@@ -36,6 +36,7 @@#include <linux/debugfs.h> #include <linux/dma-buf.h> #include <linux/idr.h> +#include <linux/sched/task.h> #include "ion.h" #include "ion_priv.h"
drivers/staging/lustre/lustre/ptlrpc/sec.c +1 -0
@@ -40,6 +40,7 @@#include <linux/crypto.h> #include <linux/cred.h> #include <linux/key.h> +#include <linux/sched/task.h> #include "../include/obd.h" #include "../include/obd_class.h"
fs/proc/internal.h +1 -0
@@ -15,6 +15,7 @@#include <linux/atomic.h> #include <linux/binfmts.h> #include <linux/sched/coredump.h> +#include <linux/sched/task.h> struct ctl_table_header ;struct mempolicy ;
fs/proc/proc_net.c +1 -0
@@ -17,6 +17,7 @@#include <linux/slab.h> #include <linux/init.h> #include <linux/sched.h> +#include <linux/sched/task.h> #include <linux/module.h> #include <linux/bitops.h> #include <linux/mount.h>
fs/proc_namespace.c +2 -0
@@ -10,6 +10,8 @@#include <linux/nsproxy.h> #include <linux/security.h> #include <linux/fs_struct.h> +#include <linux/sched/task.h> +#include "proc/internal.h" /* only for get_proc_task() in ->open() */ #include "pnode.h"
include/linux/cpuset.h +1 -0
@@ -10,6 +10,7 @@#include <linux/sched.h> #include <linux/sched/topology.h> +#include <linux/sched/task.h> #include <linux/cpumask.h> #include <linux/nodemask.h> #include <linux/mm.h>
include/linux/sched.h +0 -20
@@ -1514,26 +1514,6 @@ static inline unsigned long wait_task_inactive(struct task_struct *p, }#endif -/* -* Protects ->fs, ->files, ->mm, ->group_info, ->comm, keyring -* subscriptions and synchronises with wait4(). Also used in procfs. Also -* pins the final release of task.io_context. Also protects ->cpuset and -* ->cgroup.subsys[]. And ->vfork_done. -* -* Nests both inside and outside of read_lock(&tasklist_lock). -* It must not be nested with write_lock_irq(&tasklist_lock), -* neither inside nor outside. -*/ -static inline void task_lock (struct task_struct *p) -{ -spin_lock (&p->alloc_lock); -} - -static inline void task_unlock (struct task_struct *p) -{ -spin_unlock (&p->alloc_lock); -} -/* set thread flags in other task's structures * - see asm/thread_info.h for TIF_xxxx flags available */
include/linux/sched/task.h +21 -1
@@ -1,7 +1,7 @@#ifndef _LINUX_SCHED_TASK_H#define _LINUX_SCHED_TASK_H -#include <linux/spinlock.h> +#include <linux/sched.h> /* * Interface between the scheduler and various task lifetime (fork()/exit())
@@ -91,4 +91,24 @@ static inline struct vm_struct *task_stack_vm_area(const struct task_struct *t) }#endif +/* +* Protects ->fs, ->files, ->mm, ->group_info, ->comm, keyring +* subscriptions and synchronises with wait4(). Also used in procfs. Also +* pins the final release of task.io_context. Also protects ->cpuset and +* ->cgroup.subsys[]. And ->vfork_done. +* +* Nests both inside and outside of read_lock(&tasklist_lock). +* It must not be nested with write_lock_irq(&tasklist_lock), +* neither inside nor outside. +*/ +static inline void task_lock (struct task_struct *p) +{ +spin_lock (&p->alloc_lock); +} + +static inline void task_unlock (struct task_struct *p) +{ +spin_unlock (&p->alloc_lock); +} +#endif /* _LINUX_SCHED_TASK_H */
ipc/namespace.c +1 -0
@@ -14,6 +14,7 @@#include <linux/mount.h> #include <linux/user_namespace.h> #include <linux/proc_ns.h> +#include <linux/sched/task.h> #include "util.h"
kernel/cpuset.c +1 -0
@@ -45,6 +45,7 @@#include <linux/rcupdate.h> #include <linux/sched.h> #include <linux/sched/mm.h> +#include <linux/sched/task.h> #include <linux/seq_file.h> #include <linux/security.h> #include <linux/slab.h>
kernel/sched/debug.c +1 -0
@@ -12,6 +12,7 @@#include <linux/proc_fs.h> #include <linux/sched/mm.h> +#include <linux/sched/task.h> #include <linux/seq_file.h> #include <linux/kallsyms.h> #include <linux/utsname.h>
kernel/utsname.c +1 -0
@@ -17,6 +17,7 @@#include <linux/cred.h> #include <linux/user_namespace.h> #include <linux/proc_ns.h> +#include <linux/sched/task.h> static struct ucounts *inc_uts_namespaces (struct user_namespace *ns) {
mm/mempolicy.c +1 -0
@@ -75,6 +75,7 @@#include <linux/sched.h> #include <linux/sched/mm.h> #include <linux/sched/numa_balancing.h> +#include <linux/sched/task.h> #include <linux/nodemask.h> #include <linux/cpuset.h> #include <linux/slab.h>
mm/mmu_context.c +1 -0
@@ -6,6 +6,7 @@#include <linux/mm.h> #include <linux/sched.h> #include <linux/sched/mm.h> +#include <linux/sched/task.h> #include <linux/mmu_context.h> #include <linux/export.h>
net/core/net_namespace.c +2 -0
@@ -16,6 +16,8 @@#include <linux/export.h> #include <linux/user_namespace.h> #include <linux/net_namespace.h> +#include <linux/sched/task.h> +#include <net/sock.h> #include <net/netlink.h> #include <net/net_namespace.h>
net/core/netclassid_cgroup.c +2 -0
@@ -12,6 +12,8 @@#include <linux/slab.h> #include <linux/cgroup.h> #include <linux/fdtable.h> +#include <linux/sched/task.h> +#include <net/cls_cgroup.h> #include <net/sock.h>
net/core/netprio_cgroup.c +2 -0
@@ -19,6 +19,8 @@#include <linux/cgroup.h> #include <linux/rcupdate.h> #include <linux/atomic.h> +#include <linux/sched/task.h> +#include <net/rtnetlink.h> #include <net/pkt_cls.h> #include <net/sock.h>
Signature · 1 line
2.7.4
Ingo Molnar
maintainerPATCH 64/89 sched/headers: Remove 'init_pid_ns' prototype from <linux/sched.h>
In reply to Ingo Molnarpid.h already defines it.
--- include/linux/sched.h | 2 -- 1 file changed, 2 deletions(-)
include/linux/sched.h +0 -2
@@ -1462,8 +1462,6 @@ static inline int kstack_end(void *addr)extern union thread_union init_thread_union;extern struct task_struct init_task; -extern struct pid_namespace init_pid_ns; -/* * find a task by one of its numerical ids *
Signature · 1 line
2.7.4