我们看看内核中一个简单的sleep_on()函数: /* wq为某个等待队列的队列头 */voidsleep_on(wait_queue_head_t*wq){/* 声明一个等待队列结点 */wait_queue_t wait;/* 用当前进程初始化这个等待队列结点 */init_waitqueue_entry(&wait,current);/* 设置当前进程状态为TASK_UNINTERRUPTIBLE */current->state=...
init_waitqueue_entry (&wait, current); /* 设置当前进程状态为TASK_UNINTERRUPTIBLE */ current->state = TASK_UNINTERRUPTIBLE; /* 将这个代表着当前进程的等待队列结点加入到wq这个等待队列 */ add_wait_queue (wq, &wait); /* 请求调度器进行调度,执行完schedule后进程会被移除CPU运行队列,只有等待队列唤醒...
* current io wait handle: wait queue entry to use for io waits * If this thread is processing aio, this points at the waitqueue * inside the currently handled kiocb. It may be NULL (i.e. default * to a stack based synchronous wait) if its doing sync IO. */ wait_queue_t *io_w...
unsigned int policy;int nr_cpus_allowed;constcpumask_t*cpus_ptr;cpumask_t cpus_mask;#ifdefCONFIG_PREEMPT_RCUint rcu_read_lock_nesting;union rcu_special rcu_read_unlock_special;struct list_head rcu_node_entry;struct rcu_node*rcu_blocked_node;#endif/* #ifdef CONFIG_PREEMPT_RCU */#ifdefCONFI...
(and for tasks being destroyed), so it can be read * from any of the following contexts: * - RCU read-side critical section * - current->numa_group from everywhere * - task's runqueue locked, task not running */ struct numa_group __rcu *numa_group; /* * numa_faults is an ...
(1)struct wait_queue *wait_chldexit 在进程结束时,或发出系统调用wait 时,为了等待子进程的结束,而将自己(父进程)睡眠在该等待队列上,设置状态标志为TASK_INTERRUPTIBLE,并且把控制权转给调度程序。 (2)Struct rlimit rlim[RLIM_NLIMITS] 每一个进程可以通过系统调用setrlimit 和getrlimit 来限制它资源的使用。
PG_head,/*Must be in bit 6*/PG_waiters,/*Page has waiters, check its waitqueue. Must be bit #7 and in the same byte as "PG_locked"*/PG_active, PG_workingset, PG_error, PG_slab, PG_owner_priv_1,/*Owner use. If pagecache, fs may use*/PG_arch_1, ...
wait_queue_head_t *sleep; /* 等待队列,通常指向socket的wait域 */ struct dst_entry *dst_cache; /* 目的地缓存,用于路由查找结果 */ rwlock_t dst_lock; /* 目的地缓存锁*/ atomic_t rmem_alloc; /* 已接收队列字节数 */ struct sk_buff_head receive_queue; /* 接收包队列 */ ...
init_waitqueue_func_entry(&iwa->wo.child_wait, io_waitid_wait);iwa->wo.child_wait.private = req->task;iwa->wo.child_wait.private = req->tctx->task;iw->head = ¤t->signal->wait_chldexit;add_wait_queue(iw->head, &iwa->wo.child_wait);...
* page_waitqueue(page)是等待页面解锁的所有任务的等待队列。 * * PG_swapbacked is set when a page uses swap as a backing storage. This are * usually PageAnon or shmem pages but please note that even anonymous pages * might lose their PG_swapbacked flag when they simply can be dropped ...