On Tue, 31 Dec 2024 at 12:25, Oleg Nesterov <oleg@xxxxxxxxxx> wrote: > > But let me ask another question right now. what do you think about another > minor change below? Probably ok. Although I'm not convinced it makes things any more readable. > Again, mostly to make this logic more understandable. Although I am not > sure I really understand it... So see commit fe67f4dd8daa ("pipe: do FASYNC notifications for every pipe IO, not just state changes") on why that crazy poll_usage thing exists. Basically, epoll (and FASYNC) create *events*, not "state transitions". And people have sadly depended on getting an event for each pipe write, rather than getting an event on state transition. So epoll and FASYNC can't depend on "users only care about the pipe becoming readable". Which is why we have that poll_usage thing, and why the SIGIO is unconditional. The #ifdef CONFIG_EPOLL addition is straightforward enough and matches the existing comment. But you adding the FMODE_READ test should probably get a new comment about how we only do this for epoll readability, not for writability.. Technically epoll might notice "read done" vs "became writable", but nobody ever reported that, so we never did that poll_usage hack for the pipe_read() side. So "poll_usage" realyl is very much a hack for "user space depended on _this_ particular thing being an event, not that other thing". Linus