/**
 * wait_queue_t of Linux (version < 2.6.34) is a FIFO list for exclusively
 * waiting threads, which is not always desirable because all threads will
 * be waken up again and again, even user only needs a few of them to be
 * active most time. This is not good for performance because cache can
 * be polluted by different threads.
 *
 * LIFO list can resolve this problem because we always wakeup the most
 * recent active thread by default.
 *
 * NB: please don't call non-exclusive & exclusive wait on the same
 * waitq if add_wait_queue_exclusive_head is used.
 */
void
add_wait_queue_exclusive_head(wait_queue_head_t *waitq, wait_queue_t *link)
{
	unsigned long flags;

	spin_lock_irqsave(&LINUX_WAITQ_HEAD(waitq)->lock, flags);
	__add_wait_queue_exclusive(LINUX_WAITQ_HEAD(waitq), LINUX_WAITQ(link));
	spin_unlock_irqrestore(&LINUX_WAITQ_HEAD(waitq)->lock, flags);
}
void
init_waitqueue_entry_current(wait_queue_t *link)
{
	init_waitqueue_entry(LINUX_WAITQ(link), current);
}
Пример #3
0
void
cfs_waitlink_init(cfs_waitlink_t *link)
{
        init_waitqueue_entry(LINUX_WAITQ(link), current);
}
Пример #4
0
void
cfs_waitq_add_exclusive(cfs_waitq_t *waitq,
                        cfs_waitlink_t *link)
{
        add_wait_queue_exclusive(LINUX_WAITQ_HEAD(waitq), LINUX_WAITQ(link));
}
Пример #5
0
void
cfs_waitq_del(cfs_waitq_t *waitq, cfs_waitlink_t *link)
{
        remove_wait_queue(LINUX_WAITQ_HEAD(waitq), LINUX_WAITQ(link));
}