Re: [PATCH 1/3] media: smiapp: core: add range to usleep_range

From: Sakari Ailus
Date: Tue May 07 2019 - 17:06:29 EST


On Sat, May 04, 2019 at 11:46:35AM +0200, Nicholas Mc Guire wrote:
> On Tue, Apr 30, 2019 at 04:49:44PM +0300, Sakari Ailus wrote:
> > Hi Nicholas,
> >
> > On Sun, Apr 07, 2019 at 04:16:02AM +0200, Nicholas Mc Guire wrote:
> > > Allow the hrtimer subsystem to coalesce delay timers of lower accuracy
> > > by providing a suitable range
> > >
> > > Signed-off-by: Nicholas Mc Guire <hofrat@xxxxxxxxxxx>
> > > ---
> > >
> > > Problem located by an experimental coccinelle script
> > >
> > > hrtimers in atomic context have limited accuracy due to possible
> > > context-switching and interruption so the accuracy is limited
> > > anyway. Giving the hrtimer subsystem a reasonable range for merging
> > > hrtimers helps to reduce the load on the hrtimer subsystem. As this
> > > delays do not seem to mandate high accuracy the range of a factor
> > > two seems acceptable.
> > >
> > > Patch was compile tested with: x86_64_defconfig + MEDIA_SUPPORT=m,
> > > MEDIA_CAMERA_SUPPORT=y, MEDIA_CONTROLLER=y, VIDEO_V4L2_SUBDEV_API=y,
> > > VIDEO_SMIAPP=m
> > > (with a number of sparse warnings on sizeof() usage)
> > >
> > > Patch is against 5.1-rc3 (localversion-next is next-20190405)
> >
> > The delays are exact for the reason that they are user-visible delays in
> > image capturing related use cases. Sometimes milliseconds matter, or at
> > least adding more does not help.
> >
>
> Actually it can be better iwith respect to jitter to let the hrtimer
> subsystem use an existing timer event than to have a close by second event
> and the accuracy is determined by the non-atomic context anyway -
> so while the proposed delay extension might be excessive in your case
> I would still suggest to try to get away from a range of 0 - even if
> you only end up with (1000,1050) that would be an advantage for the
> timer subsystem.

Sounds reasonable to me. Would you like to send v2?

Thanks.

--
Sakari Ailus