unsigned overcommit_wakes;
int state;
+ unsigned has_pollin;
};
struct pwqr_task {
if (sb->running > sb->concurrency) {
printk(KERN_DEBUG "wake up poll");
wake_up_poll(&sb->wqh_poll, POLLIN);
+ sb->has_pollin = 1;
}
pwqr_sb_unlock_irqrestore(sb, flags);
}
kref_init(&sb->kref);
init_waitqueue_head(&sb->wqh);
+ init_waitqueue_head(&sb->wqh_poll);
sb->concurrency = num_online_cpus();
init_timer(&sb->timer);
sb->timer.function = pwqr_sb_timer_cb;
poll_wait(filp, &sb->wqh_poll, wait);
pwqr_sb_lock_irqsave(sb, flags);
- if (sb->running > sb->concurrency)
+ if (sb->has_pollin)
events |= POLLIN;
if (sb->state < 0)
events |= POLLHUP;
remove_wait_queue(&sb->wqh_poll, &wait);
__set_current_state(TASK_RUNNING);
}
- if (likely(rc == 0))
+ if (likely(rc == 0)) {
*cnt = sb->running - sb->concurrency;
+ sb->has_pollin = 0;
+ }
spin_unlock_irq(&sb->wqh.lock);
return rc;