[PATCH] Improve random memcpy benchmark

Wilco Dijkstra Wilco.Dijkstra@arm.com
Wed Feb 12 15:43:00 GMT 2020


Hi Paul,

> At least some of the tests do attempt to align to a page boundary, like in
> benchtests/bench-strcmp.c:

  /* Put them close to the end of page.  */
  i = align1 + CHARBYTES * (len + 2); 
  s1 = (CHAR *) (buf1 + ((page_size - i) / 16 * 16) + align1);
  i = align2 + CHARBYTES * (len + 2); 
  s2 = (CHAR *) (buf2 + ((page_size - i) / 16 * 16)  + align2);

Those tests won't do anything useful given the way page_size is used.

> So modifying MIN_PAGE_SIZE so that it's definitely not a multiple of any page size
> except 4096 might have some unexpected impact.

Not on that test, it's broken now and remains broken after my change (which
is in a different benchmark, unrelated to other tests).

> If the +4096 isn't needed, why add it?

It's the correct size to allocate - the 4096 isn't related to the page size but to the
maximum memcpy size used.

> Or, do page size correctly. There are operations which are sensitive to page 
> boundaries that need to be tested.

Yes, fixing that would require cleaning up the way page_size is used.

> I understand the current code may not do page size correctly.  It doesn't. 
> But, I think we should keep the implementation close to the original intent
> until it is cleaned up properly.

Yes that's why I just modified the define - the current meaning is unrelated
to page size and just indicates how much memory to allocate.

Cheers,
Wilco


More information about the Libc-alpha mailing list