[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220124221447.1030-1-kuniyu@amazon.co.jp>
Date: Tue, 25 Jan 2022 07:14:47 +0900
From: Kuniyuki Iwashima <kuniyu@...zon.co.jp>
To: <dave.hansen@...el.com>
CC: <benh@...zon.com>, <bp@...en8.de>, <dave.hansen@...ux.intel.com>,
<kuni1840@...il.com>, <kuniyu@...zon.co.jp>,
<linux-kernel@...r.kernel.org>, <mingo@...hat.com>,
<tglx@...utronix.de>, <x86@...nel.org>
Subject: Re: [PATCH] x86/boot: Avoid redundant address overlap tests in memcpy().
From: Dave Hansen <dave.hansen@...el.com>
Date: Mon, 24 Jan 2022 09:38:40 -0800
> On 1/22/22 17:58, Kuniyuki Iwashima wrote:
> > -void *memmove(void *dest, const void *src, size_t n)
> > +void *____memmove(void *dest, const void *src, size_t n)
> > {
> > unsigned char *d = dest;
> > const unsigned char *s = src;
> >
> > - if (d <= s || d - s >= n)
> > - return ____memcpy(dest, src, n);
> > -
> > while (n-- > 0)
> > d[n] = s[n];
> >
> > return dest;
> > }
>
> The ___ naming is pretty cruel. Could we call it memmove_no_overlap()
> or memmove_unsafe()? Surely we can put some *useful* bytes in the name
> rather than padding it out with _'s. No need to perpetuate the
> ____memcpy() naming.
Sure. I will rename it to memmove_unsafe() because it supports another
overlap case. (d > s)
>
> Also, is this worth the churn? It probably saves less than 10
> instructions, all of which are ridiculously cheap. Is there a *reason*
> for this other than being a pure cleanup?
This is just for cleanup.
Powered by blists - more mailing lists