Re: [PATCH v1 1/1] usb: gadget: configfs: Use memcpy_and_pad()

From: 'Andy Shevchenko'
Date: Fri Feb 03 2023 - 06:27:25 EST


On Thu, Feb 02, 2023 at 10:21:09PM +0000, David Laight wrote:
> From: Andy Shevchenko
> > Sent: 02 February 2023 15:18
> >
> > Instead of zeroing some memory and then copying data in part or all of it,
> > use memcpy_and_pad().
> > This avoids writing some memory twice and should save a few cycles.
>
> Maybe, maybe not.
> It rather depends on the lengths involved (the code doesn't seem to be in the
> main tree).
>
> The cost of the conditionals and the misaligned length/start for the
> memset() could easily overwhelm any apparent saving.
>
> A memset() of a constant whole number of words is going to be significantly
> faster than the partial one.


Then you can put some (little I suppose) efforts in optimizing memcpy_and_pad()
once for all, no?

--
With Best Regards,
Andy Shevchenko