/* *DefinitionfornodewithintheRCUgrace-period-detectionhierarchy.
*/ struct rcu_node {
raw_spinlock_t __private lock; /* Root rcu_node's lock protects */ /* some rcu_state fields as well as */ /* following. */ unsignedlong gp_seq; /* Track rsp->gp_seq. */ unsignedlong gp_seq_needed; /* Track furthest future GP request. */ unsignedlong completedqs; /* All QSes done for this node. */ unsignedlong qsmask; /* CPUs or groups that need to switch in */ /* order for current grace period to proceed.*/ /* In leaf rcu_node, each bit corresponds to */ /* an rcu_data structure, otherwise, each */ /* bit corresponds to a child rcu_node */ /* structure. */ unsignedlong rcu_gp_init_mask; /* Mask of offline CPUs at GP init. */ unsignedlong qsmaskinit; /* Per-GP initial value for qsmask. */ /* Initialized from ->qsmaskinitnext at the */ /* beginning of each grace period. */ unsignedlong qsmaskinitnext; unsignedlong expmask; /* CPUs or groups that need to check in */ /* to allow the current expedited GP */ /* to complete. */ unsignedlong expmaskinit; /* Per-GP initial values for expmask. */ /* Initialized from ->expmaskinitnext at the */ /* beginning of each expedited GP. */ unsignedlong expmaskinitnext; /* Online CPUs for next expedited GP. */ /* Any CPU that has ever been online will */ /* have its bit set. */ struct kthread_worker *exp_kworker; /* Workers performing per node expedited GP */ /* initialization. */ unsignedlong cbovldmask; /* CPUs experiencing callback overload. */ unsignedlong ffmask; /* Fully functional CPUs. */ unsignedlong grpmask; /* Mask to apply to parent qsmask. */ /* Only one bit will be set in this mask. */ int grplo; /* lowest-numbered CPU here. */ int grphi; /* highest-numbered CPU here. */
u8 grpnum; /* group number for next level up. */
u8 level; /* root is at level 0. */ bool wait_blkd_tasks;/* Necessary to wait for blocked tasks to */ /* exit RCU read-side critical sections */ /* before propagating offline up the */ /* rcu_node tree? */ struct rcu_node *parent; struct list_head blkd_tasks; /* Tasks blocked in RCU read-side critical */ /* section. Tasks are placed at the head */ /* of this list and age towards the tail. */ struct list_head *gp_tasks; /* Pointer to the first task blocking the */ /* current grace period, or NULL if there */ /* is no such task. */ struct list_head *exp_tasks; /* Pointer to the first task blocking the */ /* current expedited grace period, or NULL */ /* if there is no such task. If there */ /* is no current expedited grace period, */ /* then there can cannot be any such task. */ struct list_head *boost_tasks; /* Pointer to first task that needs to be */ /* priority boosted, or NULL if no priority */ /* boosting is needed for this rcu_node */ /* structure. If there are no tasks */ /* queued on this rcu_node structure that */ /* are blocking the current grace period, */ /* there can be no such task. */ struct rt_mutex boost_mtx; /* Used only for the priority-boosting */ /* side effect, not as a lock. */ unsignedlong boost_time; /* When to start boosting (jiffies). */ struct mutex kthread_mutex; /* Exclusion for thread spawning and affinity */ /* manipulation. */ struct task_struct *boost_kthread_task; /* kthread that takes care of priority */ /* boosting for this rcu_node structure. */ unsignedint boost_kthread_status; /* State of boost_kthread_task for tracing. */ unsignedlong n_boosts; /* Number of boosts for this rcu_node structure. */ #ifdef CONFIG_RCU_NOCB_CPU struct swait_queue_head nocb_gp_wq[2]; /* Place for rcu_nocb_kthread() to wait GP. */ #endif/* #ifdef CONFIG_RCU_NOCB_CPU */
raw_spinlock_t fqslock ____cacheline_internodealigned_in_smp;
spinlock_t exp_lock ____cacheline_internodealigned_in_smp; unsignedlong exp_seq_rq;
wait_queue_head_t exp_wq[4]; struct rcu_exp_work rew; bool exp_need_flush; /* Need to flush workitem? */
raw_spinlock_t exp_poll_lock; /* Lock and data for polled expedited grace periods. */ unsignedlong exp_seq_poll_rq; struct work_struct exp_poll_wq;
} ____cacheline_internodealigned_in_smp;
/* Per-CPU data for read-copy update. */ struct rcu_data { /* 1) quiescent-state and grace-period handling : */ unsignedlong gp_seq; /* Track rsp->gp_seq counter. */ unsignedlong gp_seq_needed; /* Track furthest future GP request. */ union rcu_noqs cpu_no_qs; /* No QSes yet for this CPU. */ bool core_needs_qs; /* Core waits for quiescent state. */ bool beenonline; /* CPU online at least once. */ bool gpwrap; /* Possible ->gp_seq wrap. */ unsignedint gpwrap_count; /* Count of GP sequence wrap. */ bool cpu_started; /* RCU watching this onlining CPU. */ struct rcu_node *mynode; /* This CPU's leaf of hierarchy */ unsignedlong grpmask; /* Mask to apply to leaf qsmask. */ unsignedlong ticks_this_gp; /* The number of scheduling-clock */ /* ticks this CPU has handled */ /* during and after the last grace */ /* period it is aware of. */ struct irq_work defer_qs_iw; /* Obtain later scheduler attention. */ int defer_qs_iw_pending; /* Scheduler attention pending? */ struct work_struct strict_work; /* Schedule readers for strict GPs. */
/* 2) batch handling */ struct rcu_segcblist cblist; /* Segmented callback list, with */ /* different callbacks waiting for */ /* different grace periods. */ long qlen_last_fqs_check; /* qlen at last check for QS forcing */ unsignedlong n_cbs_invoked; /* # callbacks invoked since boot. */ unsignedlong n_force_qs_snap; /* did other CPU force QS recently? */ long blimit; /* Upper limit on a processed batch */
/* 3) dynticks interface. */ int watching_snap; /* Per-GP tracking for dynticks. */ bool rcu_need_heavy_qs; /* GP old, so heavy quiescent state! */ bool rcu_urgent_qs; /* GP old need light quiescent state. */ bool rcu_forced_tick; /* Forced tick to provide QS. */ bool rcu_forced_tick_exp; /* ... provide QS to expedited GP. */
/* 4) rcu_barrier(), OOM callbacks, and expediting. */ unsignedlong barrier_seq_snap; /* Snap of rcu_state.barrier_sequence. */ struct rcu_head barrier_head; int exp_watching_snap; /* Double-check need for IPI. */
/* 5) Callback offloading. */ #ifdef CONFIG_RCU_NOCB_CPU struct swait_queue_head nocb_cb_wq; /* For nocb kthreads to sleep on. */ struct swait_queue_head nocb_state_wq; /* For offloading state changes */ struct task_struct *nocb_gp_kthread;
raw_spinlock_t nocb_lock; /* Guard following pair of fields. */ int nocb_defer_wakeup; /* Defer wakeup of nocb_kthread. */ struct timer_list nocb_timer; /* Enforce finite deferral. */ unsignedlong nocb_gp_adv_time; /* Last call_rcu() CB adv (jiffies). */ struct mutex nocb_gp_kthread_mutex; /* Exclusion for nocb gp kthread */ /* spawning */
/* The following fields are used by call_rcu, hence own cacheline. */
raw_spinlock_t nocb_bypass_lock ____cacheline_internodealigned_in_smp; struct rcu_cblist nocb_bypass; /* Lock-contention-bypass CB list. */ unsignedlong nocb_bypass_first; /* Time (jiffies) of first enqueue. */ unsignedlong nocb_nobypass_last; /* Last ->cblist enqueue (jiffies). */ int nocb_nobypass_count; /* # ->cblist enqueues at ^^^ time. */
/* The following fields are used by GP kthread, hence own cacheline. */
raw_spinlock_t nocb_gp_lock ____cacheline_internodealigned_in_smp;
u8 nocb_gp_sleep; /* Is the nocb GP thread asleep? */
u8 nocb_gp_bypass; /* Found a bypass on last scan? */
u8 nocb_gp_gp; /* GP to wait for on last scan? */ unsignedlong nocb_gp_seq; /* If so, ->gp_seq to wait for. */ unsignedlong nocb_gp_loops; /* # passes through wait code. */ struct swait_queue_head nocb_gp_wq; /* For nocb kthreads to sleep on. */ bool nocb_cb_sleep; /* Is the nocb CB thread asleep? */ struct task_struct *nocb_cb_kthread; struct list_head nocb_head_rdp; /* *Headofrcu_datalistinwakeupchain, *ifrdp_gp.
*/ struct list_head nocb_entry_rdp; /* rcu_data node in wakeup chain. */ struct rcu_data *nocb_toggling_rdp; /* rdp queued for (de-)offloading */
/* The following fields are used by CB kthread, hence new cacheline. */ struct rcu_data *nocb_gp_rdp ____cacheline_internodealigned_in_smp; /* GP rdp takes GP-end wakeups. */ #endif/* #ifdef CONFIG_RCU_NOCB_CPU */
/* 7) Diagnostic data, including RCU CPU stall warnings. */ unsignedint softirq_snap; /* Snapshot of softirq activity. */ /* ->rcu_iw* fields protected by leaf rcu_node ->lock. */ struct irq_work rcu_iw; /* Check for non-irq activity. */ bool rcu_iw_pending; /* Is ->rcu_iw pending? */ unsignedlong rcu_iw_gp_seq; /* ->gp_seq associated with ->rcu_iw. */ unsignedlong rcu_ofl_gp_seq; /* ->gp_seq at last offline. */ short rcu_ofl_gp_state; /* ->gp_state at last offline. */ unsignedlong rcu_onl_gp_seq; /* ->gp_seq at last online. */ short rcu_onl_gp_state; /* ->gp_state at last online. */ unsignedlong last_fqs_resched; /* Time of last rcu_resched(). */ unsignedlong last_sched_clock; /* Jiffies of last rcu_sched_clock_irq(). */ struct rcu_snap_record snap_record; /* Snapshot of core stats at half of */ /* the first RCU stall timeout */
long lazy_len; /* Length of buffered lazy callbacks. */ int cpu;
};
/* Values for nocb_defer_wakeup field in struct rcu_data. */ #define RCU_NOCB_WAKE_NOT 0 #define RCU_NOCB_WAKE_BYPASS 1 #define RCU_NOCB_WAKE_LAZY 2 #define RCU_NOCB_WAKE 3 #define RCU_NOCB_WAKE_FORCE 4
#define RCU_JIFFIES_TILL_FORCE_QS (1 + (HZ > 250) + (HZ > 500)) /* For jiffies_till_first_fqs and */ /* and jiffies_till_next_fqs. */
#define RCU_JIFFIES_FQS_DIV 256/* Very large systems need more */ /* delay between bouts of */ /* quiescent-state forcing. */
#define RCU_STALL_RAT_DELAY 2/* Allow other CPUs time to take */ /* at least one scheduling clock */ /* irq before ratting on them. */
#define rcu_wait(cond) \ do { \ for (;;) { \
set_current_state(TASK_INTERRUPTIBLE); \ if (cond) \ break; \
schedule(); \
} \
__set_current_state(TASK_RUNNING); \
} while (0)
/* *RCUglobalstate,includingnodehierarchy.Thishierarchyis *representedin"heap"forminadensearray.Theroot(firstlevel) *ofthehierarchyisin->node[0](referencedby->level[0]),thesecond *levelin->node[1]through->node[m](->node[1]referencedby->level[1]), *andthethirdlevelin->node[m+1]andfollowing(->node[m+1]referenced *by->level[2]).Thenumberoflevelsisdeterminedbythenumberof *CPUsandbyCONFIG_RCU_FANOUT.Smallsystemswillhavea"hierarchy" *consistingofasinglercu_node.
*/ struct rcu_state { struct rcu_node node[NUM_RCU_NODES]; /* Hierarchy. */ struct rcu_node *level[RCU_NUM_LVLS + 1]; /* Hierarchy levels (+1 to */ /* shut bogus gcc warning) */ int ncpus; /* # CPUs seen so far. */ int n_online_cpus; /* # CPUs online for RCU. */
/* The following fields are guarded by the root rcu_node's lock. */
unsignedlong gp_seq ____cacheline_internodealigned_in_smp; /* Grace-period sequence #. */ unsignedlong gp_max; /* Maximum GP duration in */ /* jiffies. */ struct task_struct *gp_kthread; /* Task for grace periods. */ struct swait_queue_head gp_wq; /* Where GP task waits. */ short gp_flags; /* Commands for GP task. */ short gp_state; /* GP kthread sleep state. */ unsignedlong gp_wake_time; /* Last GP kthread wake. */ unsignedlong gp_wake_seq; /* ->gp_seq at ^^^. */ unsignedlong gp_seq_polled; /* GP seq for polled API. */ unsignedlong gp_seq_polled_snap; /* ->gp_seq_polled at normal GP start. */ unsignedlong gp_seq_polled_exp_snap; /* ->gp_seq_polled at expedited GP start. */
/* End of fields guarded by root rcu_node's lock. */
struct mutex barrier_mutex; /* Guards barrier fields. */
atomic_t barrier_cpu_count; /* # CPUs waiting on. */ struct completion barrier_completion; /* Wake at barrier end. */ unsignedlong barrier_sequence; /* ++ at start and end of */ /* rcu_barrier(). */ /* End of fields guarded by barrier_mutex. */
struct mutex exp_mutex; /* Serialize expedited GP. */ struct mutex exp_wake_mutex; /* Serialize wakeup. */ unsignedlong expedited_sequence; /* Take a ticket. */
atomic_t expedited_need_qs; /* # CPUs left to check in. */ struct swait_queue_head expedited_wq; /* Wait for check-ins. */ int ncpus_snap; /* # CPUs seen last time. */
u8 cbovld; /* Callback overload now? */
u8 cbovldnext; /* ^ ^ next time? */
unsignedlong jiffies_force_qs; /* Time at which to invoke */ /* force_quiescent_state(). */ unsignedlong jiffies_kick_kthreads; /* Time at which to kick */ /* kthreads, if configured. */ unsignedlong n_force_qs; /* Number of calls to */ /* force_quiescent_state(). */ unsignedlong gp_start; /* Time at which GP started, */ /* but in jiffies. */ unsignedlong gp_end; /* Time last GP ended, again */ /* in jiffies. */ unsignedlong gp_activity; /* Time of last GP kthread */ /* activity in jiffies. */ unsignedlong gp_req_activity; /* Time of last GP request */ /* in jiffies. */ unsignedlong jiffies_stall; /* Time at which to check */ /* for CPU stalls. */ int nr_fqs_jiffies_stall; /* Number of fqs loops after *whichreadjiffiesandset *jiffies_stall.Stall
* warnings disabled if !0. */ unsignedlong jiffies_resched; /* Time at which to resched */ /* a reluctant CPU. */ unsignedlong n_force_qs_gpstart; /* Snapshot of n_force_qs at */ /* GP start. */ constchar *name; /* Name of structure. */ char abbr; /* Abbreviated name. */
arch_spinlock_t ofl_lock ____cacheline_internodealigned_in_smp; /* Synchronize offline with */ /* GP pre-initialization. */
/* synchronize_rcu() part. */ struct llist_head srs_next; /* request a GP users. */ struct llist_node *srs_wait_tail; /* wait for GP users. */ struct llist_node *srs_done_tail; /* ready for GP users. */ struct sr_wait_node srs_wait_nodes[SR_NORMAL_GP_WAIT_HEAD_MAX]; struct work_struct srs_cleanup_work;
atomic_t srs_cleanups_pending; /* srs inflight worker cleanups. */
#ifdef CONFIG_RCU_NOCB_CPU struct mutex nocb_mutex; /* Guards (de-)offloading */ int nocb_is_setup; /* nocb is setup from boot */ #endif
};
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.