Variations of memset()

Carlos O'Donell carlos@redhat.com
Fri Aug 4 19:11:00 GMT 2017


On 08/04/2017 03:02 PM, Matthew Wilcox wrote:
> Here's the sample usage from the symbios driver:
> 
> -               for (i = 0 ; i < 64 ; i++)
> -                       tp->luntbl[i] = cpu_to_scr(vtobus(&np->badlun_sa));
> +               memset32(tp->luntbl, cpu_to_scr(vtobus(&np->badlun_sa)), 64);
> 
> I expect a lot of users would be of this type; simply replacing the
> explicit for-loop equivalent with a library call.
 
Have you measured the performance of this kind of conversion when using a
simple application and a library implementing your various memset routines?
In the kernel is one thing, outside of the kernel we have dynamic linking
and no-inling across that shared object boundary.

Should the compiler be doing better?

-- 
Cheers,
Carlos.



More information about the Libc-alpha mailing list