参照元

説明

引数

返り値

参考

$ grep -r init_waitqueue_func_entry 
drivers/vfio/virqfd.c:  init_waitqueue_func_entry(&virqfd->wait, virqfd_wakeup);
drivers/staging/android/sync.c: init_waitqueue_func_entry(&waiter->work, sync_fence_wake_up_wq);
drivers/vhost/vhost.c:  init_waitqueue_func_entry(&poll->wait, vhost_poll_wakeup);
mm/memcontrol.c:        init_waitqueue_func_entry(&event->wait, memcg_event_wake);
net/unix/af_unix.c:     init_waitqueue_func_entry(&u->peer_wake, unix_dgram_peer_wake_relay);
net/9p/trans_fd.c:      init_waitqueue_func_entry(&pwait->wait, p9_pollwake);
fs/select.c:    init_waitqueue_func_entry(&entry->wait, pollwake);
fs/cachefiles/rdwr.c:   init_waitqueue_func_entry(&monitor->monitor, cachefiles_read_waiter);
fs/cachefiles/rdwr.c:                   init_waitqueue_func_entry(&monitor->monitor,
fs/eventpoll.c:         init_waitqueue_func_entry(&pwq->wait, ep_poll_callback);
fs/userfaultfd.c:       init_waitqueue_func_entry(&uwq.wq, userfaultfd_wake_function);
kernel/exit.c:  init_waitqueue_func_entry(&wo->child_wait, child_wait_callback);
virt/kvm/eventfd.c:     init_waitqueue_func_entry(&irqfd->wait, irqfd_wakeup);
include/linux/wait.h:init_waitqueue_func_entry(wait_queue_t *q, wait_queue_func_t func)
$ grep -r -b1 init_waitqueue_func_entry fs/cachefiles/rdwr.c
6617-
6618:   init_waitqueue_func_entry(&monitor->monitor, cachefiles_read_waiter);
6689-
--
12906-                  monitor->op = fscache_get_retrieval(op);
12950:                  init_waitqueue_func_entry(&monitor->monitor,
12998-                                            cachefiles_read_waiter);

実装

/*
 * The core wakeup function. Non-exclusive wakeups (nr_exclusive == 0) just
 * wake everything up. If it's an exclusive wakeup (nr_exclusive == small +ve
 * number) then we wake all the non-exclusive tasks and one exclusive task.
 *
 * There are circumstances in which we can try to wake a task which has already
 * started to run but is not in state TASK_RUNNING. try_to_wake_up() returns
 * zero in this (rare) case, and we handle it by continuing to scan the queue.
 */
static void __wake_up_common(wait_queue_head_t *q, unsigned int mode,
			int nr_exclusive, int wake_flags, void *key)
{
	wait_queue_t *curr, *next;
	list_for_each_entry_safe(curr, next, &q->task_list, task_list) {
		unsigned flags = curr->flags;

		if (curr->func(curr, mode, wake_flags, key) &&
				(flags & WQ_FLAG_EXCLUSIVE) && !--nr_exclusive)
			break;
	}
}

コメント


トップ   編集 凍結 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2018-01-11 (木) 13:27:59