Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions | Variables
core.c File Reference
#include <linux/mm.h>
#include <linux/module.h>
#include <linux/nmi.h>
#include <linux/init.h>
#include <linux/uaccess.h>
#include <linux/highmem.h>
#include <asm/mmu_context.h>
#include <linux/interrupt.h>
#include <linux/capability.h>
#include <linux/completion.h>
#include <linux/kernel_stat.h>
#include <linux/debug_locks.h>
#include <linux/perf_event.h>
#include <linux/security.h>
#include <linux/notifier.h>
#include <linux/profile.h>
#include <linux/freezer.h>
#include <linux/vmalloc.h>
#include <linux/blkdev.h>
#include <linux/delay.h>
#include <linux/pid_namespace.h>
#include <linux/smp.h>
#include <linux/threads.h>
#include <linux/timer.h>
#include <linux/rcupdate.h>
#include <linux/cpu.h>
#include <linux/cpuset.h>
#include <linux/percpu.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <linux/sysctl.h>
#include <linux/syscalls.h>
#include <linux/times.h>
#include <linux/tsacct_kern.h>
#include <linux/kprobes.h>
#include <linux/delayacct.h>
#include <linux/unistd.h>
#include <linux/pagemap.h>
#include <linux/hrtimer.h>
#include <linux/tick.h>
#include <linux/debugfs.h>
#include <linux/ctype.h>
#include <linux/ftrace.h>
#include <linux/slab.h>
#include <linux/init_task.h>
#include <linux/binfmts.h>
#include <asm/switch_to.h>
#include <asm/tlb.h>
#include <asm/irq_regs.h>
#include <asm/mutex.h>
#include "sched.h"
#include "../workqueue_sched.h"
#include "../smpboot.h"
#include <trace/events/sched.h>
#include "features.h"

Go to the source code of this file.

Macros

#define CREATE_TRACE_POINTS
 
#define SCHED_FEAT(name, enabled)   (1UL << __SCHED_FEAT_##name) * enabled |
 
#define DEGRADE_SHIFT   7
 

Functions

void start_bandwidth_timer (struct hrtimer *period_timer, ktime_t period)
 
 DEFINE_MUTEX (sched_domains_mutex)
 
 DEFINE_PER_CPU_SHARED_ALIGNED (struct rq, runqueues)
 
void update_rq_clock (struct rq *rq)
 
void resched_task (struct task_struct *p)
 
void activate_task (struct rq *rq, struct task_struct *p, int flags)
 
void deactivate_task (struct rq *rq, struct task_struct *p, int flags)
 
void sched_set_stop_task (int cpu, struct task_struct *stop)
 
int task_curr (const struct task_struct *p)
 
void check_preempt_curr (struct rq *rq, struct task_struct *p, int flags)
 
int wake_up_process (struct task_struct *p)
 
 EXPORT_SYMBOL (wake_up_process)
 
int wake_up_state (struct task_struct *p, unsigned int state)
 
void sched_fork (struct task_struct *p)
 
void wake_up_new_task (struct task_struct *p)
 
asmlinkage void schedule_tail (struct task_struct *prev) __releases(rq-> lock)
 
unsigned long nr_running (void)
 
unsigned long nr_uninterruptible (void)
 
unsigned long long nr_context_switches (void)
 
unsigned long nr_iowait (void)
 
unsigned long nr_iowait_cpu (int cpu)
 
unsigned long this_cpu_load (void)
 
 EXPORT_SYMBOL (avenrun)
 
void get_avenrun (unsigned long *loads, unsigned long offset, int shift)
 
void calc_global_load (unsigned long ticks)
 
 DEFINE_PER_CPU (struct kernel_stat, kstat)
 
 DEFINE_PER_CPU (struct kernel_cpustat, kernel_cpustat)
 
 EXPORT_PER_CPU_SYMBOL (kstat)
 
 EXPORT_PER_CPU_SYMBOL (kernel_cpustat)
 
unsigned long long task_delta_exec (struct task_struct *p)
 
unsigned long long task_sched_runtime (struct task_struct *p)
 
void scheduler_tick (void)
 
notrace unsigned long get_parent_ip (unsigned long addr)
 
asmlinkage void __sched schedule (void)
 
 EXPORT_SYMBOL (schedule)
 
void __sched schedule_preempt_disabled (void)
 
int default_wake_function (wait_queue_t *curr, unsigned mode, int wake_flags, void *key)
 
 EXPORT_SYMBOL (default_wake_function)
 
void __wake_up (wait_queue_head_t *q, unsigned int mode, int nr_exclusive, void *key)
 
 EXPORT_SYMBOL (__wake_up)
 
void __wake_up_locked (wait_queue_head_t *q, unsigned int mode, int nr)
 
 EXPORT_SYMBOL_GPL (__wake_up_locked)
 
void __wake_up_locked_key (wait_queue_head_t *q, unsigned int mode, void *key)
 
 EXPORT_SYMBOL_GPL (__wake_up_locked_key)
 
void __wake_up_sync_key (wait_queue_head_t *q, unsigned int mode, int nr_exclusive, void *key)
 
 EXPORT_SYMBOL_GPL (__wake_up_sync_key)
 
void __wake_up_sync (wait_queue_head_t *q, unsigned int mode, int nr_exclusive)
 
 EXPORT_SYMBOL_GPL (__wake_up_sync)
 
void complete (struct completion *x)
 
 EXPORT_SYMBOL (complete)
 
void complete_all (struct completion *x)
 
 EXPORT_SYMBOL (complete_all)
 
void __sched wait_for_completion (struct completion *x)
 
 EXPORT_SYMBOL (wait_for_completion)
 
unsigned long __sched wait_for_completion_timeout (struct completion *x, unsigned long timeout)
 
 EXPORT_SYMBOL (wait_for_completion_timeout)
 
int __sched wait_for_completion_interruptible (struct completion *x)
 
 EXPORT_SYMBOL (wait_for_completion_interruptible)
 
long __sched wait_for_completion_interruptible_timeout (struct completion *x, unsigned long timeout)
 
 EXPORT_SYMBOL (wait_for_completion_interruptible_timeout)
 
int __sched wait_for_completion_killable (struct completion *x)
 
 EXPORT_SYMBOL (wait_for_completion_killable)
 
long __sched wait_for_completion_killable_timeout (struct completion *x, unsigned long timeout)
 
 EXPORT_SYMBOL (wait_for_completion_killable_timeout)
 
bool try_wait_for_completion (struct completion *x)
 
 EXPORT_SYMBOL (try_wait_for_completion)
 
bool completion_done (struct completion *x)
 
 EXPORT_SYMBOL (completion_done)
 
void __sched interruptible_sleep_on (wait_queue_head_t *q)
 
 EXPORT_SYMBOL (interruptible_sleep_on)
 
long __sched interruptible_sleep_on_timeout (wait_queue_head_t *q, long timeout)
 
 EXPORT_SYMBOL (interruptible_sleep_on_timeout)
 
void __sched sleep_on (wait_queue_head_t *q)
 
 EXPORT_SYMBOL (sleep_on)
 
long __sched sleep_on_timeout (wait_queue_head_t *q, long timeout)
 
 EXPORT_SYMBOL (sleep_on_timeout)
 
void set_user_nice (struct task_struct *p, long nice)
 
 EXPORT_SYMBOL (set_user_nice)
 
int can_nice (const struct task_struct *p, const int nice)
 
int task_prio (const struct task_struct *p)
 
int task_nice (const struct task_struct *p)
 
 EXPORT_SYMBOL (task_nice)
 
int idle_cpu (int cpu)
 
struct task_structidle_task (int cpu)
 
int sched_setscheduler (struct task_struct *p, int policy, const struct sched_param *param)
 
 EXPORT_SYMBOL_GPL (sched_setscheduler)
 
int sched_setscheduler_nocheck (struct task_struct *p, int policy, const struct sched_param *param)
 
 SYSCALL_DEFINE3 (sched_setscheduler, pid_t, pid, int, policy, struct sched_param __user *, param)
 
 SYSCALL_DEFINE2 (sched_setparam, pid_t, pid, struct sched_param __user *, param)
 
 SYSCALL_DEFINE1 (sched_getscheduler, pid_t, pid)
 
 SYSCALL_DEFINE2 (sched_getparam, pid_t, pid, struct sched_param __user *, param)
 
long sched_setaffinity (pid_t pid, const struct cpumask *in_mask)
 
 SYSCALL_DEFINE3 (sched_setaffinity, pid_t, pid, unsigned int, len, unsigned long __user *, user_mask_ptr)
 
long sched_getaffinity (pid_t pid, struct cpumask *mask)
 
 SYSCALL_DEFINE3 (sched_getaffinity, pid_t, pid, unsigned int, len, unsigned long __user *, user_mask_ptr)
 
 SYSCALL_DEFINE0 (sched_yield)
 
int __sched _cond_resched (void)
 
 EXPORT_SYMBOL (_cond_resched)
 
int __cond_resched_lock (spinlock_t *lock)
 
 EXPORT_SYMBOL (__cond_resched_lock)
 
int __sched __cond_resched_softirq (void)
 
 EXPORT_SYMBOL (__cond_resched_softirq)
 
void __sched yield (void)
 
 EXPORT_SYMBOL (yield)
 
bool __sched yield_to (struct task_struct *p, bool preempt)
 
 EXPORT_SYMBOL_GPL (yield_to)
 
void __sched io_schedule (void)
 
 EXPORT_SYMBOL (io_schedule)
 
long __sched io_schedule_timeout (long timeout)
 
 SYSCALL_DEFINE1 (sched_get_priority_max, int, policy)
 
 SYSCALL_DEFINE1 (sched_get_priority_min, int, policy)
 
 SYSCALL_DEFINE2 (sched_rr_get_interval, pid_t, pid, struct timespec __user *, interval)
 
void sched_show_task (struct task_struct *p)
 
void show_state_filter (unsigned long state_filter)
 
void __cpuinit init_idle_bootup_task (struct task_struct *idle)
 
void __cpuinit init_idle (struct task_struct *idle, int cpu)
 
void __init sched_init_smp (void)
 
int in_sched_functions (unsigned long addr)
 
 DECLARE_PER_CPU (cpumask_var_t, load_balance_tmpmask)
 
void __init sched_init (void)
 
int sched_rt_handler (struct ctl_table *table, int write, void __user *buffer, size_t *lenp, loff_t *ppos)
 

Variables

const_debug unsigned int sysctl_sched_features
 
const_debug unsigned int sysctl_sched_nr_migrate = 32
 
const_debug unsigned int sysctl_sched_time_avg = MSEC_PER_SEC
 
unsigned int sysctl_sched_rt_period = 1000000
 
__read_mostly int scheduler_running
 
int sysctl_sched_rt_runtime = 950000
 
unsigned long avenrun [3]
 
const_debug unsigned int sysctl_timer_migration = 1
 

Macro Definition Documentation

#define CREATE_TRACE_POINTS

Definition at line 88 of file core.c.

#define DEGRADE_SHIFT   7

Definition at line 2380 of file core.c.

#define SCHED_FEAT (   name,
  enabled 
)    (1UL << __SCHED_FEAT_##name) * enabled |

Definition at line 132 of file core.c.

Function Documentation

int __cond_resched_lock ( spinlock_t lock)

Definition at line 4219 of file core.c.

int __sched __cond_resched_softirq ( void  )

Definition at line 4239 of file core.c.

void __wake_up ( wait_queue_head_t q,
unsigned int  mode,
int  nr_exclusive,
void key 
)

__wake_up - wake up threads blocked on a waitqueue. : the waitqueue : which threads : how many wake-one or wake-many threads to wake up : is directly passed to the wakeup function

It may be assumed that this function implies a write memory barrier before changing the task state if and only if any tasks are woken up.

Definition at line 3088 of file core.c.

void __wake_up_locked ( wait_queue_head_t q,
unsigned int  mode,
int  nr 
)

Definition at line 3102 of file core.c.

void __wake_up_locked_key ( wait_queue_head_t q,
unsigned int  mode,
void key 
)

Definition at line 3108 of file core.c.

void __wake_up_sync ( wait_queue_head_t q,
unsigned int  mode,
int  nr_exclusive 
)

Definition at line 3152 of file core.c.

void __wake_up_sync_key ( wait_queue_head_t q,
unsigned int  mode,
int  nr_exclusive,
void key 
)

__wake_up_sync_key - wake up threads blocked on a waitqueue. : the waitqueue : which threads : how many wake-one or wake-many threads to wake up : opaque value to be passed to wakeup targets

The sync wakeup differs that the waker knows that it will schedule away soon, so while the target thread will be woken up, it will not be migrated to another CPU - ie. the two threads are 'synchronized' with each other. This can prevent needless bouncing between CPUs.

On UP it can prevent extra preemption.

It may be assumed that this function implies a write memory barrier before changing the task state if and only if any tasks are woken up.

Definition at line 3131 of file core.c.

int __sched _cond_resched ( void  )

Definition at line 4201 of file core.c.

void activate_task ( struct rq rq,
struct task_struct p,
int  flags 
)

Definition at line 727 of file core.c.

void calc_global_load ( unsigned long  ticks)

Definition at line 2302 of file core.c.

int can_nice ( const struct task_struct p,
const int  nice 
)

Definition at line 3560 of file core.c.

void check_preempt_curr ( struct rq rq,
struct task_struct p,
int  flags 
)

Definition at line 900 of file core.c.

void complete ( struct completion x)

complete: - signals a single thread waiting on this completion : holds the state of this particular completion

This will wake up a single thread waiting on this completion. Threads will be awakened in the same order in which they were queued.

See also complete_all(), wait_for_completion() and related routines.

It may be assumed that this function implies a write memory barrier before changing the task state if and only if any tasks are woken up.

Definition at line 3170 of file core.c.

void complete_all ( struct completion x)

complete_all: - signals all threads waiting on this completion : holds the state of this particular completion

This will wake up all threads waiting on this particular completion event.

It may be assumed that this function implies a write memory barrier before changing the task state if and only if any tasks are woken up.

Definition at line 3190 of file core.c.

bool completion_done ( struct completion x)

completion_done - Test to see if a completion has any waiters : completion structure

Returns: 0 if there are waiters (wait_for_completion() in progress) 1 if there are no waiters.

Definition at line 3382 of file core.c.

void deactivate_task ( struct rq rq,
struct task_struct p,
int  flags 
)

Definition at line 735 of file core.c.

DECLARE_PER_CPU ( cpumask_var_t  ,
load_balance_tmpmask   
)
int default_wake_function ( wait_queue_t curr,
unsigned  mode,
int  wake_flags,
void key 
)

Definition at line 3048 of file core.c.

DEFINE_MUTEX ( sched_domains_mutex  )
DEFINE_PER_CPU ( struct kernel_stat  ,
kstat   
)
DEFINE_PER_CPU ( struct kernel_cpustat  ,
kernel_cpustat   
)
DEFINE_PER_CPU_SHARED_ALIGNED ( struct rq  ,
runqueues   
)
EXPORT_PER_CPU_SYMBOL ( kstat  )
EXPORT_PER_CPU_SYMBOL ( kernel_cpustat  )
EXPORT_SYMBOL ( wake_up_process  )
EXPORT_SYMBOL ( avenrun  )
EXPORT_SYMBOL ( schedule  )
EXPORT_SYMBOL ( default_wake_function  )
EXPORT_SYMBOL ( __wake_up  )
EXPORT_SYMBOL ( complete  )
EXPORT_SYMBOL ( complete_all  )
EXPORT_SYMBOL ( wait_for_completion  )
EXPORT_SYMBOL ( wait_for_completion_timeout  )
EXPORT_SYMBOL ( wait_for_completion_interruptible  )
EXPORT_SYMBOL ( wait_for_completion_killable  )
EXPORT_SYMBOL ( try_wait_for_completion  )
EXPORT_SYMBOL ( completion_done  )
EXPORT_SYMBOL ( interruptible_sleep_on  )
EXPORT_SYMBOL ( interruptible_sleep_on_timeout  )
EXPORT_SYMBOL ( sleep_on  )
EXPORT_SYMBOL ( sleep_on_timeout  )
EXPORT_SYMBOL ( set_user_nice  )
EXPORT_SYMBOL ( task_nice  )
EXPORT_SYMBOL ( _cond_resched  )
EXPORT_SYMBOL ( __cond_resched_lock  )
EXPORT_SYMBOL ( __cond_resched_softirq  )
EXPORT_SYMBOL ( yield  )
EXPORT_SYMBOL ( io_schedule  )
EXPORT_SYMBOL_GPL ( __wake_up_locked  )
EXPORT_SYMBOL_GPL ( __wake_up_locked_key  )
EXPORT_SYMBOL_GPL ( __wake_up_sync_key  )
EXPORT_SYMBOL_GPL ( __wake_up_sync  )
EXPORT_SYMBOL_GPL ( sched_setscheduler  )
EXPORT_SYMBOL_GPL ( yield_to  )
void get_avenrun ( unsigned long loads,
unsigned long  offset,
int  shift 
)

get_avenrun - get the load average array : pointer to dest load array : offset to add : shift count to shift the result left

These values are estimates at best, so no need for locking.

Definition at line 2031 of file core.c.

notrace unsigned long get_parent_ip ( unsigned long  addr)

Definition at line 2645 of file core.c.

int idle_cpu ( int  cpu)

idle_cpu - is a given cpu idle currently? : the processor in question.

Definition at line 3638 of file core.c.

struct task_struct* idle_task ( int  cpu)
read

idle_task - return the idle task for a given cpu. : the processor in question.

Definition at line 3660 of file core.c.

int in_sched_functions ( unsigned long  addr)

Definition at line 6726 of file core.c.

void __cpuinit init_idle ( struct task_struct idle,
int  cpu 
)

init_idle - set up an idle thread for a given CPU : task in question : cpu the idle task belongs to

NOTE: this function does not set the idle thread's NEED_RESCHED flag, to make booting more robust.

Definition at line 4551 of file core.c.

void __cpuinit init_idle_bootup_task ( struct task_struct idle)

Definition at line 4538 of file core.c.

void __sched interruptible_sleep_on ( wait_queue_head_t q)

Definition at line 3416 of file core.c.

long __sched interruptible_sleep_on_timeout ( wait_queue_head_t q,
long  timeout 
)

Definition at line 3423 of file core.c.

void __sched io_schedule ( void  )

Definition at line 4347 of file core.c.

long __sched io_schedule_timeout ( long  timeout)

Definition at line 4362 of file core.c.

unsigned long long nr_context_switches ( void  )

Definition at line 1936 of file core.c.

unsigned long nr_iowait ( void  )

Definition at line 1947 of file core.c.

unsigned long nr_iowait_cpu ( int  cpu)

Definition at line 1957 of file core.c.

unsigned long nr_running ( void  )

Definition at line 1909 of file core.c.

unsigned long nr_uninterruptible ( void  )

Definition at line 1919 of file core.c.

void resched_task ( struct task_struct p)

Definition at line 643 of file core.c.

void sched_fork ( struct task_struct p)

Definition at line 1541 of file core.c.

long sched_getaffinity ( pid_t  pid,
struct cpumask mask 
)

Definition at line 4099 of file core.c.

void __init sched_init ( void  )

Definition at line 6740 of file core.c.

void __init sched_init_smp ( void  )

Definition at line 6718 of file core.c.

int sched_rt_handler ( struct ctl_table table,
int  write,
void __user buffer,
size_t lenp,
loff_t *  ppos 
)

Definition at line 7432 of file core.c.

void sched_set_stop_task ( int  cpu,
struct task_struct stop 
)

Definition at line 803 of file core.c.

long sched_setaffinity ( pid_t  pid,
const struct cpumask in_mask 
)

Definition at line 4003 of file core.c.

int sched_setscheduler ( struct task_struct p,
int  policy,
const struct sched_param param 
)

sched_setscheduler - change the scheduling policy and/or RT priority of a thread. : the task in question. : new policy.

Parameters
structure containing the new RT priority.

NOTE that the task may be already dead.

Definition at line 3867 of file core.c.

int sched_setscheduler_nocheck ( struct task_struct p,
int  policy,
const struct sched_param param 
)

sched_setscheduler_nocheck - change the scheduling policy and/or RT priority of a thread from kernelspace. : the task in question. : new policy.

Parameters
structure containing the new RT priority.

Just like sched_setscheduler, only don't bother checking if the current context has permission. For example, this is needed in stop_machine(): we create temporary high priority worker threads, but our caller might not have that capability.

Definition at line 3885 of file core.c.

void sched_show_task ( struct task_struct p)

Definition at line 4474 of file core.c.

asmlinkage void __sched schedule ( void  )

Definition at line 2905 of file core.c.

void __sched schedule_preempt_disabled ( void  )

schedule_preempt_disabled - called with preemption disabled

Returns with preemption disabled. Note: preempt_count must be 1

Definition at line 2934 of file core.c.

asmlinkage void schedule_tail ( struct task_struct prev) -> lock)

schedule_tail - first thing a freshly forked thread must call. : the thread we just switched away from.

Definition at line 1826 of file core.c.

void scheduler_tick ( void  )

Definition at line 2623 of file core.c.

void set_user_nice ( struct task_struct p,
long  nice 
)

Definition at line 3508 of file core.c.

void show_state_filter ( unsigned long  state_filter)

Definition at line 4503 of file core.c.

void __sched sleep_on ( wait_queue_head_t q)

Definition at line 3429 of file core.c.

long __sched sleep_on_timeout ( wait_queue_head_t q,
long  timeout 
)

Definition at line 3435 of file core.c.

void start_bandwidth_timer ( struct hrtimer period_timer,
ktime_t  period 
)

Definition at line 91 of file core.c.

SYSCALL_DEFINE0 ( sched_yield  )

sys_sched_yield - yield the current processor to other threads.

This function yields the current CPU to other tasks. If there are no other threads running on this CPU then this function will return.

Definition at line 4168 of file core.c.

SYSCALL_DEFINE1 ( sched_getscheduler  ,
pid_t  ,
pid   
)

sys_sched_getscheduler - get the policy (scheduling class) of a thread : the pid in question.

Definition at line 3943 of file core.c.

SYSCALL_DEFINE1 ( sched_get_priority_max  ,
int  ,
policy   
)

sys_sched_get_priority_max - return maximum RT priority. : scheduling class.

this syscall returns the maximum rt_priority that can be used by a given scheduling class.

Definition at line 4385 of file core.c.

SYSCALL_DEFINE1 ( sched_get_priority_min  ,
int  ,
policy   
)

sys_sched_get_priority_min - return minimum RT priority. : scheduling class.

this syscall returns the minimum rt_priority that can be used by a given scheduling class.

Definition at line 4410 of file core.c.

SYSCALL_DEFINE2 ( sched_setparam  ,
pid_t  ,
pid  ,
struct sched_param __user ,
param   
)

sys_sched_setparam - set/change the RT priority of a thread : the pid in question.

Parameters
structure containing the new RT priority.

Definition at line 3934 of file core.c.

SYSCALL_DEFINE2 ( sched_getparam  ,
pid_t  ,
pid  ,
struct sched_param __user ,
param   
)

sys_sched_getparam - get the RT priority of a thread : the pid in question.

Parameters
structure containing the RT priority.

Definition at line 3969 of file core.c.

SYSCALL_DEFINE2 ( sched_rr_get_interval  ,
pid_t  ,
pid  ,
struct timespec __user ,
interval   
)

sys_sched_rr_get_interval - return the default timeslice of a process. : pid of the process. : userspace pointer to the timeslice value.

this syscall writes the default timeslice value of a given process into the user-space timespec buffer. A value of '0' means infinity.

Definition at line 4435 of file core.c.

SYSCALL_DEFINE3 ( sched_setscheduler  ,
pid_t  ,
pid  ,
int  ,
policy  ,
struct sched_param __user ,
param   
)

sys_sched_setscheduler - set/change the scheduler policy and RT priority : the pid in question. : new policy.

Parameters
structure containing the new RT priority.

Definition at line 3919 of file core.c.

SYSCALL_DEFINE3 ( sched_setaffinity  ,
pid_t  ,
pid  ,
unsigned  int,
len  ,
unsigned long __user ,
user_mask_ptr   
)

sys_sched_setaffinity - set the cpu affinity of a process : pid of the process : length in bytes of the bitmask pointed to by user_mask_ptr : user-space pointer to the new cpu mask

Definition at line 4083 of file core.c.

SYSCALL_DEFINE3 ( sched_getaffinity  ,
pid_t  ,
pid  ,
unsigned  int,
len  ,
unsigned long __user ,
user_mask_ptr   
)

sys_sched_getaffinity - get the cpu affinity of a process : pid of the process : length in bytes of the bitmask pointed to by user_mask_ptr : user-space pointer to hold the current cpu mask

Definition at line 4134 of file core.c.

int task_curr ( const struct task_struct p)
inline

task_curr - is this task currently executing on a CPU? : the task in question.

Definition at line 883 of file core.c.

unsigned long long task_delta_exec ( struct task_struct p)

Definition at line 2588 of file core.c.

int task_nice ( const struct task_struct p)

task_nice - return the nice value of a given task. : the task in question.

Definition at line 3628 of file core.c.

int task_prio ( const struct task_struct p)

task_prio - return the priority value of a given task. : the task in question.

This is the priority value as seen by users in /proc. RT tasks are offset by -200. Normal tasks are centered around 0, value goes from -16 to +15.

Definition at line 3619 of file core.c.

unsigned long long task_sched_runtime ( struct task_struct p)

Definition at line 2606 of file core.c.

unsigned long this_cpu_load ( void  )

Definition at line 1963 of file core.c.

bool try_wait_for_completion ( struct completion x)

try_wait_for_completion - try to decrement a completion without blocking : completion structure

Returns: 0 if a decrement cannot be done without blocking 1 if a decrement succeeded.

If a completion is being used as a counting completion, attempt to decrement the counter without blocking. This enables us to avoid waiting if the resource the completion is protecting is not available.

Definition at line 3359 of file core.c.

void update_rq_clock ( struct rq rq)

Definition at line 116 of file core.c.

void __sched wait_for_completion ( struct completion x)

wait_for_completion: - waits for completion of a task : holds the state of this particular completion

This waits to be signaled for completion of a specific task. It is NOT interruptible and there is no timeout.

See also similar routines (i.e. wait_for_completion_timeout()) with timeout and interrupt capability. Also see complete().

Definition at line 3247 of file core.c.

int __sched wait_for_completion_interruptible ( struct completion x)

wait_for_completion_interruptible: - waits for completion of a task (w/intr) : holds the state of this particular completion

This waits for completion of a specific task to be signaled. It is interruptible.

The return value is -ERESTARTSYS if interrupted, 0 if completed.

Definition at line 3281 of file core.c.

long __sched wait_for_completion_interruptible_timeout ( struct completion x,
unsigned long  timeout 
)

wait_for_completion_interruptible_timeout: - waits for completion (w/(to,intr)) : holds the state of this particular completion : timeout value in jiffies

This waits for either a completion of a specific task to be signaled or for a specified timeout to expire. It is interruptible. The timeout is in jiffies.

The return value is -ERESTARTSYS if interrupted, 0 if timed out, positive (at least 1, or number of jiffies left till timeout) if completed.

Definition at line 3302 of file core.c.

int __sched wait_for_completion_killable ( struct completion x)

wait_for_completion_killable: - waits for completion of a task (killable) : holds the state of this particular completion

This waits to be signaled for completion of a specific task. It can be interrupted by a kill signal.

The return value is -ERESTARTSYS if interrupted, 0 if completed.

Definition at line 3318 of file core.c.

long __sched wait_for_completion_killable_timeout ( struct completion x,
unsigned long  timeout 
)

wait_for_completion_killable_timeout: - waits for completion of a task (w/(to,killable)) : holds the state of this particular completion : timeout value in jiffies

This waits for either a completion of a specific task to be signaled or for a specified timeout to expire. It can be interrupted by a kill signal. The timeout is in jiffies.

The return value is -ERESTARTSYS if interrupted, 0 if timed out, positive (at least 1, or number of jiffies left till timeout) if completed.

Definition at line 3340 of file core.c.

unsigned long __sched wait_for_completion_timeout ( struct completion x,
unsigned long  timeout 
)

wait_for_completion_timeout: - waits for completion of a task (w/timeout) : holds the state of this particular completion : timeout value in jiffies

This waits for either a completion of a specific task to be signaled or for a specified timeout to expire. The timeout is in jiffies. It is not interruptible.

The return value is 0 if timed out, and positive (at least 1, or number of jiffies left till timeout) if completed.

Definition at line 3266 of file core.c.

void wake_up_new_task ( struct task_struct p)

Definition at line 1622 of file core.c.

int wake_up_process ( struct task_struct p)

wake_up_process - Wake up a specific process : The process to be woken up.

Attempt to wake up the nominated process and move it to the set of runnable processes. Returns 1 if the process was woken up, 0 if it was already running.

It may be assumed that this function implies a write memory barrier before changing the task state if and only if any tasks are woken up.

Definition at line 1498 of file core.c.

int wake_up_state ( struct task_struct p,
unsigned int  state 
)

Definition at line 1504 of file core.c.

void __sched yield ( void  )

yield - yield the current processor to other threads.

Do not ever use this function, there's a 99% chance you're doing it wrong.

The scheduler is at all times free to pick the calling task as the most eligible task to run, if removing the yield() call from your code breaks it, its already broken.

Typical broken usage is:

while (!event) 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 happen. Never use yield() as a progress guarantee!!

If you want to use yield() to wait for something, use wait_event(). If you want to use yield() to be 'nice' for others, use cond_resched(). If you still want to use yield(), do not!

Definition at line 4275 of file core.c.

bool __sched yield_to ( struct task_struct p,
bool  preempt 
)

yield_to - yield the current processor to another thread in your thread group, or accelerate that thread toward the processor it's on. : target task : whether task preemption is allowed or not

It's the caller's job to ensure that the target task struct can't go away on us before we can do any checks.

Returns true if we indeed boosted the target task.

Definition at line 4294 of file core.c.

Variable Documentation

unsigned long avenrun[3]

Definition at line 2020 of file core.c.

__read_mostly int scheduler_running

Definition at line 282 of file core.c.

const_debug unsigned int sysctl_sched_features
Initial value:
=
0

Definition at line 135 of file core.c.

const_debug unsigned int sysctl_sched_nr_migrate = 32

Definition at line 266 of file core.c.

unsigned int sysctl_sched_rt_period = 1000000

Definition at line 280 of file core.c.

int sysctl_sched_rt_runtime = 950000

Definition at line 288 of file core.c.

const_debug unsigned int sysctl_sched_time_avg = MSEC_PER_SEC

Definition at line 274 of file core.c.

const_debug unsigned int sysctl_timer_migration = 1

Definition at line 6724 of file core.c.