Re: [RFC][PATCH 1/7] wait: Provide infrastructure to deal with nested blocking

From: Oleg Nesterov
Date: Mon Aug 04 2014 - 14:38:03 EST


On 08/04, Peter Zijlstra wrote:
>
> I just noticed that poll_schedule_timeout() uses set_mb() for clearing
> its triggered variable. But I'm not entirely sure I see why..

At least we need to ensure that this "pwq->triggered = 0" can't be reordered
after the next ->poll() returns 0. In this case we should sleep unless pollwake()
was called and it set "->triggered = 1". So without this mb() we can miss an
event.

But I can hardly understand the "data written before wake up is always visible
after wake up" part... Probably this means that if we didn't actually sleep
because pwq->triggered == 1 we need to ensure that the next ->poll(file) should
see all changes which were the reason for wakeup.

Oleg.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/