CHECK_ASYM_PACKING(9) Driver Basics CHECK_ASYM_PACKING(9)NAME
check_asym_packing - Check to see if the group is packed into the sched doman.
SYNOPSIS
int check_asym_packing(struct lb_env * env, struct sd_lb_stats * sds);
ARGUMENTS
env
The load balancing environment.
sds
Statistics of the sched_domain which is to be packed
DESCRIPTION
This is primarily intended to used at the sibling level. Some cores like POWER7 prefer to use lower numbered SMT threads. In the case of
POWER7, it can move to lower SMT modes only when higher threads are idle. When in lower SMT modes, the threads will perform better since
they share less core resources. Hence when we have idle threads, we want them to be the higher ones.
This packing function is run on idle threads. It checks to see if the busiest CPU in this domain (core in the P7 case) has a higher CPU
number than the packing function is being run on. Here we are assuming lower CPU number will be equivalent to lower a SMT thread number.
RETURN
1 when packing is required and a task should be moved to this CPU. The amount of the imbalance is returned in *imbalance.
COPYRIGHT Kernel Hackers Manual 3.10 June 2014 CHECK_ASYM_PACKING(9)
Check Out this Related Man Page
RUNQUEUE(9) BSD Kernel Developer's Manual RUNQUEUE(9)NAME
choosethread, procrunnable, remrunqueue, setrunqueue -- manage the queue of runnable processes
SYNOPSIS
#include <sys/param.h>
#include <sys/proc.h>
extern struct rq itqueues[];
extern struct rq rtqueues[];
extern struct rq queues[];
extern struct rq idqueues[];
struct thread *
choosethread(void);
int
procrunnable(void);
void
remrunqueue(struct thread *td);
void
setrunqueue(struct thread *td);
DESCRIPTION
The run queue consists of four priority queues: itqueues for interrupt threads, rtqueues for realtime priority processes, queues for time
sharing processes, and idqueues for idle priority processes. Each priority queue consists of an array of NQS queue header structures. Each
queue header identifies a list of runnable processes of equal priority. Each queue also has a single word that contains a bit mask identify-
ing non-empty queues to assist in selecting a process quickly. These are named itqueuebits, rtqueuebits, queuebits, and idqueuebits. The
run queues are protected by the sched_lock mutex.
procrunnable() returns zero if there are no runnable processes other than the idle process. If there is at least one runnable process other
than the idle process, it will return a non-zero value. Note that the sched_lock mutex does not need to be held when this function is
called. There is a small race window where one CPU may place a process on the run queue when there are currently no other runnable processes
while another CPU is calling this function. In that case the second CPU will simply travel through the idle loop one additional time before
noticing that there is a runnable process. This works because idle CPUs are not halted in SMP systems. If idle CPUs are halted in SMP sys-
tems, then this race condition might have more serious repercussions in the losing case, and procrunnable() may have to require that the
sched_lock mutex be acquired.
choosethread() returns the highest priority runnable thread. If there are no runnable threads, then the idle thread is returned. This func-
tion is called by cpu_switch() and cpu_throw() to determine which thread to switch to. choosethread() must be called with the sched_lock
mutex held.
setrunqueue() adds the thread td to the tail of the appropriate queue in the proper priority queue. The thread must be runnable, i.e. p_stat
must be set to SRUN. This function must be called with the sched_lock mutex held.
remrunqueue() removes thread td from its run queue. If td is not on a run queue, then the kernel will panic(9). This function must be
called with the sched_lock mutex held.
SEE ALSO cpu_switch(9), scheduler(9), sleepqueue(9)BSD August 15, 2010 BSD