[PATCH v2 1/5] perf: Allow periodic events to alternate between two sample periods

Leo Yan leo.yan at arm.com
Mon Mar 10 03:55:51 PDT 2025


On Fri, Mar 07, 2025 at 08:28:13PM +0000, Mark Barnett wrote:
> On 1/21/25 13:01, Leo Yan wrote:
> > >   	local64_set(&hwc->period_left, hwc->sample_period);
> > > +	if (attr->alt_sample_period) {
> > > +		hwc->sample_period = attr->alt_sample_period;
> > > +		hwc->using_alt_sample_period = true;
> > > +	}
> > 
> > My understanding it sets a short sample window for the first period.
> > Would it initialize the `hwc->period_left` with the updated sample
> > period?
> > 
> 
> It sets the long period first: hwc->period_left is used to program the PMU
> when setting up the event, and hwc->sample_period is queued up as the next
> period to switch to.

Makes sense to me.  Thanks for explanation.

Leo



More information about the linux-arm-kernel mailing list