- 论坛徽章:
- 0
|
非常感谢您的答复
poll_wqueues确实分配了N_INLINE_POLL_ENTRIES个inline_entries
但是inline_index 永远只增加不会减少,所以这个inline_entries总会用完的啊
所以可能还是很难避免去分配新的页面,之后再去add_wait_queue
(我看的是2.6.27)
static struct poll_table_entry *poll_get_entry(poll_table *_p)
{
struct poll_wqueues *p = container_of(_p, struct poll_wqueues, pt);
struct poll_table_page *table = p->table;
if (p->inline_index < N_INLINE_POLL_ENTRIES) //inline_index总会增加到超过inline entries的时候啊
return p->inline_entries + p->inline_index++;
if (!table || POLL_TABLE_FULL(table)) {
struct poll_table_page *new_table;
new_table = (struct poll_table_page *) __get_free_page(GFP_KERNEL);
if (!new_table) {
p->error = -ENOMEM;
__set_current_state(TASK_RUNNING);
return NULL;
}
new_table->entry = new_table->entries;
new_table->next = table;
p->table = new_table;
table = new_table;
}
return table->entry++;
}
我理解的对吗?如果理解的对,我仍然很困惑啊
在进入等待的时候有个必须:就是必须先把进程放到wakeup队列中,然后再设置进程状态到TASK_INTERRUPTIBLE...我怀疑的就是do_select会不会把设置进程状态放到add wait queue之前去了。。。?? |
|