public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: "Paul A. Clarke" <pc@us.ibm.com>
To: "H.J. Lu" <hjl.tools@gmail.com>
Cc: GNU C Library <libc-alpha@sourceware.org>, rzinsly@linux.ibm.com
Subject: Re: [PATCH 1/4] strncmp: Add a testcase for page boundary [BZ #25933]
Date: Mon, 15 Jun 2020 17:03:39 -0500	[thread overview]
Message-ID: <20200615220339.GB24739@oc3272150783.ibm.com> (raw)
In-Reply-To: <CAMe9rOpLo31bTu4ByYmfCS=XTY4E7zASsR2EY2a+cqe_6Cp=Ow@mail.gmail.com>

On Mon, Jun 15, 2020 at 02:34:13PM -0700, H.J. Lu via Libc-alpha wrote:
> On Mon, Jun 15, 2020 at 1:29 PM Paul A. Clarke <pc@us.ibm.com> wrote:
> >
> > On Fri, Jun 12, 2020 at 01:10:53PM -0700, H.J. Lu via Libc-alpha wrote:
> > > Add a strncmp testcase to cover cases where one of strings ends on the
> > > page boundary.
> > > ---
> > >  string/test-strncmp.c | 25 +++++++++++++++++++++++++
> > >  1 file changed, 25 insertions(+)
> > >
> > > diff --git a/string/test-strncmp.c b/string/test-strncmp.c
> > > index d961ac4493..d0928a2864 100644
> > > --- a/string/test-strncmp.c
> > > +++ b/string/test-strncmp.c
> > > @@ -403,6 +403,30 @@ check2 (void)
> > >    free (s2);
> > >  }
> > >
> > > +static void
> > > +check3 (void)
> > > +{
> > > +  size_t size = 32 * 4;
> > > +  CHAR *s1 = (CHAR *) (buf1 + (BUF1PAGES - 1) * page_size);
> > > +  CHAR *s2 = (CHAR *) (buf2 + (BUF1PAGES - 1) * page_size);
> > > +  int exp_result;
> > > +
> > > +  memset (s1, 'a', page_size);
> > > +  memset (s2, 'a', page_size);
> > > +  s1[(page_size / CHARBYTES) - 1] = (CHAR) 0;
> > > +
> > > +  for (size_t s = 99; s <= size; s++)
> > > +    for (size_t s1a = 31; s1a < 32; s1a++)
> > > +      for (size_t s2a = 30; s2a < 32; s2a++)
> > > +     {
> > > +       CHAR *s1p = s1 + (page_size / CHARBYTES - s) - s1a;
> > > +       CHAR *s2p = s2 + (page_size / CHARBYTES - s) - s2a;
> > > +       exp_result = SIMPLE_STRNCMP (s1p, s2p, s);
> > > +       FOR_EACH_IMPL (impl, 0)
> > > +         check_result (impl, s1p, s2p, s, exp_result);
> > > +     }
> > > +}
> >
> > There are lots of magic numbers here.
> >
> > Could you add some context around those number
> 
> My commit log says
> 
> ---
> Add a strncmp testcase to cover cases where one of strings ends on the
> page boundary.
> ---

Which says nothing about why you need to test over 90000 different
cases of a string ending on a page boundary, nor what any of the
magic numbers represent.

> > If they are meant to reflect a cache line length, then it's
> 
> No.  My testcase is for correctness, not for performance.

I made no reference to performance.

> > appropriate to support different cache line sizes.
> > Rafael Zinsly just did this with strncasecmp in the
> > last week or so.

PC

  reply	other threads:[~2020-06-15 22:03 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-12 20:10 H.J. Lu
2020-06-12 20:10 ` [PATCH 2/4] strcmp: Add a testcase for page boundary H.J. Lu
2020-09-24  0:46   ` Carlos O'Donell
2020-09-24 14:29     ` H.J. Lu
2020-06-12 20:10 ` [PATCH 3/4] bench-strncmp.c: Add workloads on " H.J. Lu
2020-09-24  0:46   ` Carlos O'Donell
2020-09-24 15:13     ` V2 [PATCH] " H.J. Lu
2020-09-24 17:30       ` Carlos O'Donell
2020-06-12 20:10 ` [PATCH 4/4] bench-strcmp.c: " H.J. Lu
2020-09-24  0:52   ` Carlos O'Donell
2020-09-24 15:22     ` V2 [PATCH] " H.J. Lu
2020-09-24 17:31       ` Carlos O'Donell
2020-06-15 20:29 ` [PATCH 1/4] strncmp: Add a testcase for page boundary [BZ #25933] Paul A. Clarke
2020-06-15 21:34   ` H.J. Lu
2020-06-15 22:03     ` Paul A. Clarke [this message]
2020-09-23 19:01 ` Carlos O'Donell
2020-09-24 14:05   ` H.J. Lu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200615220339.GB24739@oc3272150783.ibm.com \
    --to=pc@us.ibm.com \
    --cc=hjl.tools@gmail.com \
    --cc=libc-alpha@sourceware.org \
    --cc=rzinsly@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).