Re: [PATCH 0/3] epoll: Add epoll_pwait1 syscall
From: Andy Lutomirski
Date: Thu Jan 08 2015 - 21:25:13 EST
On Thu, Jan 8, 2015 at 5:52 PM, Fam Zheng <famz@xxxxxxxxxx> wrote:
> On Thu, 01/08 17:28, Andy Lutomirski wrote:
>> On Thu, Jan 8, 2015 at 5:25 PM, Fam Zheng <famz@xxxxxxxxxx> wrote:
>> > On Thu, 01/08 09:57, Andy Lutomirski wrote:
>> >> I'd like to see a more ambitious change, since the timer isn't the
>> >> only problem like this. Specifically, I'd like a syscall that does a
>> >> list of epoll-related things and then waits. The list of things could
>> >> include, at least:
>> >>
>> >> - EPOLL_CTL_MOD actions: level-triggered epoll users are likely to
>> >> want to turn on and off their requests for events on a somewhat
>> >> regular basis.
>> >
>> > This sounds good to me.
>> >
>> >>
>> >> - timerfd_settime actions: this allows a single syscall to wait and
>> >> adjust *both* monotonic and real-time wakeups.
>> >
>> > I'm not sure, doesn't this break orthogonality between epoll and timerfd?
>>
>> Yes. It's not very elegant, and more elegant ideas are welcome.
>
> What is the purpose of embedding timerfd operation here? Modifying timerfd
> for each poll doesn't sound a common pattern to me.
Setting a timeout is definitely a common pattern, hence this thread.
But the current timeout interface sucks, and people should really use
absolute time. (My epoll software uses absolute time.) But then
users need to decide whether to have their timeout based on the
monotonic clock or the realtime clock (or something else entirely).
Some bigger programs may want both -- they may have internal events
queued for certain times and for certain timeouts, and those should
use realtime and monotonic respectively. Heck, users may also want
separate slack values on those.
Timerfd is the only thing we have right now that is anywhere near
flexible enough. Obviously if epoll became fancy enough, then we
could do away with the timerfd entirely here.
>
>>
>> >
>> >>
>> >> Would this make sense? It could look like:
>> >>
>> >> int epoll_mod_and_pwait(int epfd,
>> >> struct epoll_event *events, int maxevents,
>> >> struct epoll_command *commands, int ncommands,
>> >> const sigset_t *sigmask);
>> >
>> > What about flags?
>> >
>>
>> No room. Maybe it should just be a struct for everything instead of
>> separate args.
>
> Also no room for timeout. A single struct sounds the only way to go.
That's what timerfd is for. I think it would be a bit weird to
support "timeout" and detailed timerfd control.
--Andy
--
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/