Re: [PATCH v2 1/2] kernel/events: Add option to notify through signals on wakeup

From: Naveen N. Rao
Date: Fri Aug 04 2017 - 13:31:02 EST

Hi Peter,

On 2017/08/04 12:20PM, Peter Zijlstra wrote:
> On Tue, Aug 01, 2017 at 08:14:03PM +0530, Naveen N. Rao wrote:
> > Add a new option 'signal_on_wakeup' to request for a signal to be
> > delivered on ring buffer wakeup controlled through watermark and
> > {wakeup_events, wakeup_watermark}. HUP is signaled on exit.
> This fails to tell us why you'd want this. What is wrong with the
> existing POLL_IN notification?

Yes, sorry - I should have included some of the explanation from the
cover letter as part of this patch description.

The primary use-case is for self-profiling. If a process wants to
profile itself and wishes to receive notification via signals, we do not
have any control over when we can receive such notifications -- a
POLL_IN is generated on each overflow. We may just want to be notified
every n events, rather than on each event.

Furthermore, some side band events are useful by themself and it will be
desirable to be notified on those events. This again is not possible
today with IOC_ENABLE/IOC_REFRESH (addressed with Patch 2/2 in this