BENCHTESTS: memmove benchtests do not test overlapping memory regions

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

BENCHTESTS: memmove benchtests do not test overlapping memory regions

Anton Youdkevitch
Folks,

The current testing framework is using two buffers
for all sorts of string benchmarks. Considering how
the buffers get allocated (using mmap with the first
argument set to 0) they can never overlap.

So, the memmove benchtest actually tests memcpy
(with a little additional startup) instead of memmove.
I would like to adapt memmove benchset to cover the
case of overlapping memory regions as well.

--
   Thanks,
   Anton
Reply | Threaded
Open this post in threaded view
|

Re: BENCHTESTS: memmove benchtests do not test overlapping memory regions

Zack Weinberg-2
On Fri, Feb 8, 2019 at 10:51 AM Anton Youdkevitch
<[hidden email]> wrote:
> The current testing framework is using two buffers
> for all sorts of string benchmarks. Considering how
> the buffers get allocated (using mmap with the first
> argument set to 0) they can never overlap.
>
> So, the memmove benchtest actually tests memcpy
> (with a little additional startup) instead of memmove.
> I would like to adapt memmove benchset to cover the
> case of overlapping memory regions as well.

Yes, that would be a welcome improvement.  It's probably going to be
big enough that you will need to file contributor paperwork with the
FSF: please read and follow the instructions at
https://git.savannah.gnu.org/cgit/gnulib.git/plain/doc/Copyright/request-assign.future

zw
Reply | Threaded
Open this post in threaded view
|

Re: BENCHTESTS: memmove benchtests do not test overlapping memory regions

Steve Ellcey-6
On Fri, 2019-02-08 at 11:41 -0500, Zack Weinberg wrote:

> On Fri, Feb 8, 2019 at 10:51 AM Anton Youdkevitch
> <[hidden email]> wrote:
> > The current testing framework is using two buffers
> > for all sorts of string benchmarks. Considering how
> > the buffers get allocated (using mmap with the first
> > argument set to 0) they can never overlap.
> >
> > So, the memmove benchtest actually tests memcpy
> > (with a little additional startup) instead of memmove.
> > I would like to adapt memmove benchset to cover the
> > case of overlapping memory regions as well.
>
> Yes, that would be a welcome improvement.  It's probably going to be
> big enough that you will need to file contributor paperwork with the
> FSF: please read and follow the instructions at
>
https://git.savannah.gnu.org/cgit/gnulib.git/plain/doc/Copyright/request-assign.future
>
> zw

Zack,

Anton is doing this work under a contract that was signed with Cavium
and Cavium has a copyright assignment on file.  Cavium was recently
purchased by Marvell but I believe Marvell has a copyright assignment
as well.  I don't have a fencepost account anymore so I can't check
that myself, but that is my understanding.

Steve Ellcey
[hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: BENCHTESTS: memmove benchtests do not test overlapping memory regions

Stefan Liebler-2
In reply to this post by Anton Youdkevitch
On 02/08/2019 04:51 PM, Anton Youdkevitch wrote:

> Folks,
>
> The current testing framework is using two buffers
> for all sorts of string benchmarks. Considering how
> the buffers get allocated (using mmap with the first
> argument set to 0) they can never overlap.
>
> So, the memmove benchtest actually tests memcpy
> (with a little additional startup) instead of memmove.
> I would like to adapt memmove benchset to cover the
> case of overlapping memory regions as well.
>

Just as hint:
benchtests/bench-memmove.c: do_test():
...
   s1 = (char *) (buf1 + align1);
   s2 = (char *) (buf2 + align2);
...
     do_one_test (..., dst=s2, src=((char *) (buf2 + align1)),
orig_src=s1, ...);

Both src and dst are within buf2 and thus can overlap.

Reply | Threaded
Open this post in threaded view
|

Re: BENCHTESTS: memmove benchtests do not test overlapping memory regions

Anton Youdkevitch
In reply to this post by Zack Weinberg-2
Zach,

It turned out that memmove tests do OK regarding
overlapping memory. This is just not obvious from
the outside.

So, I might change the interface a bit so that it
would be clear that only one buffer is actually
used or just add a couple of comments pointing out
that two buffers here are just for the sake of
uniformity.

Considering the above is not going to be such big a
change can someone just push a change like this on my
behalf?

--
   Thanks,
   Anton

On 08/2/2019 19:41, Zack Weinberg wrote:

> On Fri, Feb 8, 2019 at 10:51 AM Anton Youdkevitch
> <[hidden email]> wrote:
>> The current testing framework is using two buffers
>> for all sorts of string benchmarks. Considering how
>> the buffers get allocated (using mmap with the first
>> argument set to 0) they can never overlap.
>>
>> So, the memmove benchtest actually tests memcpy
>> (with a little additional startup) instead of memmove.
>> I would like to adapt memmove benchset to cover the
>> case of overlapping memory regions as well.
>
> Yes, that would be a welcome improvement.  It's probably going to be
> big enough that you will need to file contributor paperwork with the
> FSF: please read and follow the instructions at
> https://git.savannah.gnu.org/cgit/gnulib.git/plain/doc/Copyright/request-assign.future
>
> zw
>

Reply | Threaded
Open this post in threaded view
|

Re: BENCHTESTS: memmove benchtests do not test overlapping memory regions

Siddhesh Poyarekar-8
On 13/02/19 8:54 PM, Anton Youdkevitch wrote:
> Considering the above is not going to be such big a
> change can someone just push a change like this on my
> behalf?

There you go:

https://sourceware.org/ml/libc-alpha/2019-02/msg00361.html

Siddhesh
Reply | Threaded
Open this post in threaded view
|

Re: BENCHTESTS: memmove benchtests do not test overlapping memory regions

Anton Youdkevitch
Siddhesh,

On 14/2/2019 05:59, Siddhesh Poyarekar wrote:
> On 13/02/19 8:54 PM, Anton Youdkevitch wrote:
>> Considering the above is not going to be such big a
>> change can someone just push a change like this on my
>> behalf?
>
> There you go:
>
> https://sourceware.org/ml/libc-alpha/2019-02/msg00361.html
Thanks a lot!

Had you had this in your queue already when I posted
the question?

--
   Thanks,
   Anton
Reply | Threaded
Open this post in threaded view
|

Re: BENCHTESTS: memmove benchtests do not test overlapping memory regions

Siddhesh Poyarekar-8
On 14/02/19 12:14 PM, Anton Youdkevitch wrote:
> Thanks a lot!
>
> Had you had this in your queue already when I posted
> the question?

It wasn't really in my queue, although I had grimaced at it once but
forgot to do anything about it ;)

Siddhesh