Re: [PATCH 2/3] cgroup: add lockless fast-path checks to cgroup_file_notify()
From: Shakeel Butt
Date: Mon Mar 02 2026 - 12:13:47 EST
On Mon, Mar 02, 2026 at 08:14:05AM -0800, Shakeel Butt wrote:
> Hi Chen, thanks for taking a look.
>
> On Mon, Mar 02, 2026 at 09:50:53AM +0800, Chen Ridong wrote:
> >
[...]
> > > + last = READ_ONCE(cfile->notified_at);
> > > + if (time_before_eq(jiffies, last + CGROUP_FILE_NOTIFY_MIN_INTV))
> > > + return;
> > > +
> >
> > Previously, if a notification arrived within the rate-limit window, we would
> > still call timer_reduce(&cfile->notify_timer, next) to schedule a deferred
> > notification.
> >
> > With this change, returning early here bypasses that timer scheduling entirely.
> > Does this risk missing notifications that would have been delivered by the timer?
> >
>
> You are indeed right that this can cause missed notifications. After giving some
> thought I think the lockless check-and-return can be pretty much simplified to
> timer_pending() check. If timer is active, just do nothing and the notification
> will be delivered eventually.
>
> I will send the updated version soon. Any comments on the other two patches?
>
Something like the following: