| PCU(9) | Kernel Developer's Manual | PCU(9) |
pcu — per-CPU unit
(PCU)
#include
<sys/pcu.h>
void
pcu_load(const
pcu_ops_t *pcu);
void
pcu_save(const
pcu_ops_t *pcu, lwp_t
*l);
void
pcu_save_all(lwp_t
*l);
void
pcu_discard(const
pcu_ops_t *pcu, lwp_t
*l, bool
valid);
void
pcu_discard_all(lwp_t
*l);
bool
pcu_valid_p(const
pcu_ops_t *pcu);
Per CPU Unit (PCU) is an interface to manage synchronization of any per-CPU context (unit) tied to an LWP context. Typical use of PCU is for "lazy-switch" synchronization of the FPU state. Each PCU has its operations defined by a pcu_ops_t structure. Members of pcu_ops_t are
u_int pcu_id;
void (*pcu_state_save)(lwp_t *l);
void (*pcu_state_load)(lwp_t *l, u_int flags);
void (*pcu_state_release)(lwp_t *l);
pcu_state_save()pcu_state_load()PCU_VALIDPCU_REENABLEpcu_state_release()pcu_load()
be called to reacquire the ownership. For example, this would normally be
the changing of a bit for a CPU to trap on the execution of one of the
PCU's instructions.pcu_load()pcu_save()pcu_discard()pcu_valid_p()pcu_load() is called by the
LWP. Otherwise, return false.pcu_discard_all()pcu_save_all()pcu is implemented within the file
sys/kern/subr_pcu.c.
PCU first appeared in NetBSD 6.0.
Mindaugas Rasiukevicius <rmind@NetBSD.org>
| May 16, 2017 | NetBSD 11.0 |