Lines Matching refs:pq

46 static ALWAYS_INLINE void z_priq_mq_add(struct _priq_mq *pq, struct k_thread *thread);
47 static ALWAYS_INLINE void z_priq_mq_remove(struct _priq_mq *pq, struct k_thread *thread);
62 static ALWAYS_INLINE void z_priq_dumb_init(sys_dlist_t *pq) in z_priq_dumb_init() argument
64 sys_dlist_init(pq); in z_priq_dumb_init()
67 static ALWAYS_INLINE void z_priq_dumb_remove(sys_dlist_t *pq, struct k_thread *thread) in z_priq_dumb_remove() argument
69 ARG_UNUSED(pq); in z_priq_dumb_remove()
74 static ALWAYS_INLINE struct k_thread *z_priq_dumb_best(sys_dlist_t *pq) in z_priq_dumb_best() argument
77 sys_dnode_t *n = sys_dlist_peek_head(pq); in z_priq_dumb_best()
85 static ALWAYS_INLINE void z_priq_rb_init(struct _priq_rb *pq) in z_priq_rb_init() argument
87 *pq = (struct _priq_rb) { in z_priq_rb_init()
94 static ALWAYS_INLINE void z_priq_rb_add(struct _priq_rb *pq, struct k_thread *thread) in z_priq_rb_add() argument
98 thread->base.order_key = pq->next_order_key; in z_priq_rb_add()
99 ++pq->next_order_key; in z_priq_rb_add()
107 if (!pq->next_order_key) { in z_priq_rb_add()
108 RB_FOR_EACH_CONTAINER(&pq->tree, t, base.qnode_rb) { in z_priq_rb_add()
109 t->base.order_key = pq->next_order_key; in z_priq_rb_add()
110 ++pq->next_order_key; in z_priq_rb_add()
114 rb_insert(&pq->tree, &thread->base.qnode_rb); in z_priq_rb_add()
117 static ALWAYS_INLINE void z_priq_rb_remove(struct _priq_rb *pq, struct k_thread *thread) in z_priq_rb_remove() argument
119 rb_remove(&pq->tree, &thread->base.qnode_rb); in z_priq_rb_remove()
121 if (!pq->tree.root) { in z_priq_rb_remove()
122 pq->next_order_key = 0; in z_priq_rb_remove()
126 static ALWAYS_INLINE struct k_thread *z_priq_rb_best(struct _priq_rb *pq) in z_priq_rb_best() argument
129 struct rbnode *n = rb_get_min(&pq->tree); in z_priq_rb_best()
137 static ALWAYS_INLINE struct k_thread *z_priq_mq_best(struct _priq_mq *pq) in z_priq_mq_best() argument
142 if (!pq->bitmask[i]) { in z_priq_mq_best()
147 sys_dlist_t *l = &pq->queues[i * 64 + u64_count_trailing_zeros(pq->bitmask[i])]; in z_priq_mq_best()
149 sys_dlist_t *l = &pq->queues[i * 32 + u32_count_trailing_zeros(pq->bitmask[i])]; in z_priq_mq_best()
189 static ALWAYS_INLINE void z_priq_mq_add(struct _priq_mq *pq, in z_priq_mq_add() argument
194 sys_dlist_append(&pq->queues[pos.offset_prio], &thread->base.qnode_dlist); in z_priq_mq_add()
195 pq->bitmask[pos.idx] |= BIT(pos.bit); in z_priq_mq_add()
198 static ALWAYS_INLINE void z_priq_mq_remove(struct _priq_mq *pq, in z_priq_mq_remove() argument
204 if (sys_dlist_is_empty(&pq->queues[pos.offset_prio])) { in z_priq_mq_remove()
205 pq->bitmask[pos.idx] &= ~BIT(pos.bit); in z_priq_mq_remove()
213 static ALWAYS_INLINE struct k_thread *z_priq_dumb_mask_best(sys_dlist_t *pq) in z_priq_dumb_mask_best() argument
220 SYS_DLIST_FOR_EACH_CONTAINER(pq, thread, base.qnode_dlist) { in z_priq_dumb_mask_best()
231 static ALWAYS_INLINE void z_priq_dumb_add(sys_dlist_t *pq, in z_priq_dumb_add() argument
236 SYS_DLIST_FOR_EACH_CONTAINER(pq, t, base.qnode_dlist) { in z_priq_dumb_add()
244 sys_dlist_append(pq, &thread->base.qnode_dlist); in z_priq_dumb_add()