Re: [PATCH] KUnit: memcpy: add benchmark
From: Matteo Croce
Date: Thu Jan 29 2026 - 19:08:33 EST
Il giorno ven 30 gen 2026 alle ore 01:04 Matteo Croce
<technoboy85@xxxxxxxxx> ha scritto:
>
> Il giorno ven 30 gen 2026 alle ore 00:53 Andrew Morton
> <akpm@xxxxxxxxxxxxxxxxxxxx> ha scritto:
> >
> > On Fri, 30 Jan 2026 00:36:30 +0100 Matteo Croce <technoboy85@xxxxxxxxx> wrote:
> >
> > > > Is cond_resched() inside preempt_disable() actually legal?
> > > >
> > > > Might be, but it doesn't make a lot of sense, does it?
> > > >
> > > > > + }
> > > > > + preempt_enable();
> > > > > +
> > > >
> > >
> > > Right. In a previous version I was doing
> > > preempt_disable()/preempt_enable() around the two ktime_get_ns(), but
> > > then I thought that enabling and disabling preemption 100 time was too
> > > much.
> > > I'll restore the preempt macros around the actual copy and remove
> > > cond_resched().
> >
> > OK.
> >
> > local_irq_save() would be more accurate.
> >
>
> Right, even more strict.
>
> > Does it really need to copy 4MB? Smaller would make
> > local_irq_disable() more viable.
> >
> > kmalloc(4MB) does seem to be pushing our luck. I'm spotting
> >
> > ./arch/arm/configs/pxa_defconfig:CONFIG_ARCH_FORCE_MAX_ORDER=8
> >
> > which is 1MB?
>
> I wanted to stay outside of the caches as much as possible.
> What about using "PAGE_SIZE * (1 << CONFIG_ARCH_FORCE_MAX_ORDER)" so
> it adjusts itself?
>
Or "PAGE_SIZE << MAX_PAGE_ORDER", if I grep it I see it's already used
here and there.
--
Matteo Croce
perl -e 'for($t=0;;$t++){print chr($t*($t>>8|$t>>13)&255)}' |aplay