From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oa1-x2f.google.com (mail-oa1-x2f.google.com [IPv6:2001:4860:4864:20::2f]) by sourceware.org (Postfix) with ESMTPS id A31343858429 for ; Mon, 18 Mar 2024 19:29:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A31343858429 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org A31343858429 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2001:4860:4864:20::2f ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1710790174; cv=none; b=QmLxtOU7kg5kVsMOoVa3KSTNjA2ImxRxwCD6T0jgFYctYCgUjsBOGCRpHzLA7tQQrvZkmNyfraNT2YQzyzFVSAQdB+KH8/20H7mAB7dXXdmyFdacWr4T4RtrtiukC/2bLHCwONbKrewh1FpsEZNgUmCa5dSxgRjJWdGx3ahXygs= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1710790174; c=relaxed/simple; bh=gciak2vU+ACrUOktAqlqnpUOfrHOkNvLtTFhMtJvrZQ=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=tr/3EuelAzaA+v/93I1QIw3OQBG2ofGx5KJyDqkxDdoyrZ2NnzODy/0ZSVpCtYKk8M2MFayI51heKdNnN19yyp5bQ5pkX4H5HyY/Zf1vLQ5otnh+8/ua+Hcf3CXWHSZGDlgQr/TtAvjwe/7ddAxgs+qEkkEK6l4+Q+E/2Scdb8A= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-oa1-x2f.google.com with SMTP id 586e51a60fabf-221ce6cac3aso2784561fac.2 for ; Mon, 18 Mar 2024 12:29:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710790170; x=1711394970; darn=sourceware.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=eNNTvya8pscp+W0+f0oQ7fVU0TY6ehlz/K6tZc86qBM=; b=BDY9XaQdiXpGwMu9LYn33FaxkL86nJtnN/D2d5VCxcyo5kfzP75YPbalITajqTenb7 Dlmw+VaF/Zj+B8IOybPJEctQz83VGjFIdAaWX17+utPGd1da1Mf+OQXySAX2vIbZZr9y kYQuRHP19EIhEHlNLGulitSPXqp9LHd4ox0f/TVWf8s1aiJwTo9qLTVMWHfObUn/8KDg ok7ZJFzOdymXJvUQitZ79LiKsRL8nkGT3WXe9NmFSLdm2KIySY8RXJxDWpnsI3rMavf5 YGM5Kg9bxxZDXEMzSuYJcKwxM77p5yjPiYi0tU2q6L6gJp5RFGMWbfm3kVtSMxTi5q/+ UcGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710790170; x=1711394970; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=eNNTvya8pscp+W0+f0oQ7fVU0TY6ehlz/K6tZc86qBM=; b=pxyg/YIcFM0cRZybK/QvIFHU53+c787Dqy1vgXKbQ6st9KyGDIRzjLt6fBJ36BOaRI ODVWqVw7qKxZnTuqC+em/ZIIRokPEGce5vGtBFeSCGqRyIr46j3Ld9jndIsI8P/0n5eF Nq0/flYFiyQuULiWNuq7U0mbzA3Fkr4daK4P5tThIng6DEefpE1V+e98i4K14VJM2ttS B++JlSZFWzLg8D7dL0JEWXSwmMFa7q2M453pDdkFTzlt0ehHKDJpHeju+NAu9wxDJsfM pwRLYPvVFQOin1vskm2cVxuodYO2HXsx9RFoaK3g06lwPXQOVev+d7E8ATT1WfEDkwzy zJ8Q== X-Gm-Message-State: AOJu0YxlZLI9HKTFXpS6e1mlQ7jDoo488vgklefl6zRr1OgV5KpUPwVG /w2cDSioH0oIgw0J2EUjEsSu0C1TI530yTcdFihmgBH2JYGsbjIMUxg3R9XBHZeVLhUXwI/AKHx ++87W7l21cxFz1rEtFdNeB2vPXBA= X-Google-Smtp-Source: AGHT+IEB9GUKfcYUOnTXLoojnvNh3iTjQ05nPiTItjkffobXhwgLlDywn2Yf2KMXWaN6uxZQYLam6avkClajKWWXcXI= X-Received: by 2002:a05:6871:522c:b0:220:873d:dbcc with SMTP id ht44-20020a056871522c00b00220873ddbccmr597385oac.49.1710790169619; Mon, 18 Mar 2024 12:29:29 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Noah Goldstein Date: Mon, 18 Mar 2024 14:29:18 -0500 Message-ID: Subject: Re: [PATCH] Benchtests: Improve large memcpy/memset benchmarks To: Wilco Dijkstra Cc: GNU C Library Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-9.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,KAM_LOTSOFHASH,KAM_SHORT,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Mon, Mar 18, 2024 at 10:08=E2=80=AFAM Wilco Dijkstra wrote: > > Adjust sizes between 64KB and 16MB and iterations based on length. > Remove incorrect uses of alloc_bufs (since we're not interested in measur= ing > Linux clear_page time). > > OK for commit? > > --- > > diff --git a/benchtests/bench-bzero-large.c b/benchtests/bench-bzero-larg= e.c > index 7076c0a17b00d76c26aa6adb4c3cc0aedcf69955..dea414ec8d1bb160409725996= 244178ee4fa93fd 100644 > --- a/benchtests/bench-bzero-large.c > +++ b/benchtests/bench-bzero-large.c > @@ -22,9 +22,8 @@ > #else > # define TEST_NAME "bzero" > #endif > -#define START_SIZE (128 * 1024) > -#define MIN_PAGE_SIZE (getpagesize () + 64 * 1024 * 1024) > -#define TIMEOUT (20 * 60) > +#define START_SIZE (64 * 1024) > +#define MIN_PAGE_SIZE (getpagesize () + 16 * 1024 * 1024) > #include "bench-string.h" > > #include "json-lib.h" > @@ -52,7 +51,7 @@ IMPL (memset_zero, 0) > static void > do_one_test (json_ctx_t *json_ctx, impl_t *impl, CHAR *s, size_t n) > { > - size_t i, iters =3D 16; > + size_t i, iters =3D (MIN_PAGE_SIZE * 64) / n; > timing_t start, stop, cur; > > TIMING_NOW (start); > @@ -74,20 +73,13 @@ do_one_test (json_ctx_t *json_ctx, impl_t *impl, CHAR= *s, size_t n) > static void > do_test (json_ctx_t *json_ctx, size_t align, size_t len) > { > - align &=3D 63; > - if ((align + len) * sizeof (CHAR) > page_size) > - return; > - > json_element_object_begin (json_ctx); > json_attr_uint (json_ctx, "length", len); > json_attr_uint (json_ctx, "alignment", align); > json_array_begin (json_ctx, "timings"); > > FOR_EACH_IMPL (impl, 0) > - { > - do_one_test (json_ctx, impl, (CHAR *) (buf1) + align, len); > - alloc_bufs (); > - } > + do_one_test (json_ctx, impl, (CHAR *) (buf1) + align, len); > > json_array_end (json_ctx); > json_element_object_end (json_ctx); > diff --git a/benchtests/bench-memcpy-large.c b/benchtests/bench-memcpy-la= rge.c > index 7b2c5530af3883acc4b3895cb11667e6ff1a55ff..9e544a4729197f886f6cb092e= c225004b586d197 100644 > --- a/benchtests/bench-memcpy-large.c > +++ b/benchtests/bench-memcpy-large.c > @@ -19,10 +19,9 @@ > #ifndef MEMCPY_RESULT > # define MEMCPY_RESULT(dst, len) dst > # define START_SIZE (64 * 1024) > -# define MIN_PAGE_SIZE (getpagesize () + 32 * 1024 * 1024) > +# define MIN_PAGE_SIZE (getpagesize () + 16 * 1024 * 1024) > # define TEST_MAIN > # define TEST_NAME "memcpy" > -# define TIMEOUT (20 * 60) > # include "bench-string.h" > > IMPL (memcpy, 1) > @@ -36,7 +35,7 @@ static void > do_one_test (json_ctx_t *json_ctx, impl_t *impl, char *dst, const char *= src, > size_t len) > { > - size_t i, iters =3D 16; > + size_t i, iters =3D (MIN_PAGE_SIZE * 8) / len; > timing_t start, stop, cur; > > TIMING_NOW (start); > @@ -59,12 +58,7 @@ do_test (json_ctx_t *json_ctx, size_t align1, size_t a= lign2, size_t len, > char *s1, *s2; > size_t repeats; > align1 &=3D 4095; > - if (align1 + len >=3D page_size) > - return; > - > align2 &=3D 4095; > - if (align2 + len >=3D page_size) > - return; > > s1 =3D (char *) (buf1 + align1); > s2 =3D (char *) (buf2 + align2); > diff --git a/benchtests/bench-memmove-large.c b/benchtests/bench-memmove-= large.c > index a09dd3678848a3bf8612732439700eb8ef5d82ea..fd504653f681b172800cc34e0= 54cc745180aa4fa 100644 > --- a/benchtests/bench-memmove-large.c > +++ b/benchtests/bench-memmove-large.c > @@ -16,12 +16,10 @@ > License along with the GNU C Library; if not, see > . */ > > -#define BASE_PAGE_SIZE (1024 * 1024) > -#define START_SIZE (4 * 1024) > +#define START_SIZE (64 * 1024) > #define MIN_PAGE_SIZE (getpagesize () + 16 * 1024 * 1024) > #define TEST_MAIN > #define TEST_NAME "memmove" > -#define TIMEOUT (20 * 60) > #include "bench-string.h" > #include "json-lib.h" > > @@ -33,7 +31,7 @@ static void > do_one_test (json_ctx_t *json_ctx, impl_t *impl, char *dst, char *src, > size_t len) > { > - size_t i, iters =3D 16; > + size_t i, iters =3D (MIN_PAGE_SIZE * 8) / len; maybe MAX(16, (MIN_PAGE_SIZE * )/ len). Likewise above. > timing_t start, stop, cur; > > TIMING_NOW (start); > @@ -54,13 +52,8 @@ do_test (json_ctx_t *json_ctx, size_t align1, size_t a= lign2, size_t len) > size_t i, j; > char *s1, *s2; > > - align1 &=3D 127; > - if (align1 + len >=3D page_size) > - return; > - > - align2 &=3D 127; > - if (align2 + len >=3D page_size) > - return; > + align1 &=3D 4095; > + align2 &=3D 4095; > > s1 =3D (char *) (buf2 + align1); > s2 =3D (char *) (buf2 + align2); > diff --git a/benchtests/bench-memset-large.c b/benchtests/bench-memset-la= rge.c > index a1f33245d4960c1e82fc441b5faf322204035202..c3f9ee0cd75d3cb30f8b3df15= 672f895c111fc28 100644 > --- a/benchtests/bench-memset-large.c > +++ b/benchtests/bench-memset-large.c > @@ -18,9 +18,8 @@ > > #define TEST_MAIN > #define TEST_NAME "memset" > -#define START_SIZE (128 * 1024) > -#define MIN_PAGE_SIZE (getpagesize () + 64 * 1024 * 1024) > -#define TIMEOUT (20 * 60) > +#define START_SIZE (64 * 1024) > +#define MIN_PAGE_SIZE (getpagesize () + 16 * 1024 * 1024) > #include "bench-string.h" > > #include "json-lib.h" > @@ -35,7 +34,7 @@ static void > do_one_test (json_ctx_t *json_ctx, impl_t *impl, CHAR *s, > int c __attribute ((unused)), size_t n) > { > - size_t i, iters =3D 16; > + size_t i, iters =3D (MIN_PAGE_SIZE * 64) / n; > timing_t start, stop, cur; > > TIMING_NOW (start); > @@ -53,10 +52,6 @@ do_one_test (json_ctx_t *json_ctx, impl_t *impl, CHAR = *s, > static void > do_test (json_ctx_t *json_ctx, size_t align, int c, size_t len) > { > - align &=3D 63; > - if ((align + len) * sizeof (CHAR) > page_size) > - return; > - > json_element_object_begin (json_ctx); > json_attr_uint (json_ctx, "length", len); > json_attr_uint (json_ctx, "alignment", align); > @@ -64,10 +59,7 @@ do_test (json_ctx_t *json_ctx, size_t align, int c, si= ze_t len) > json_array_begin (json_ctx, "timings"); > > FOR_EACH_IMPL (impl, 0) > - { > - do_one_test (json_ctx, impl, (CHAR *) (buf1) + align, c, len); > - alloc_bufs (); > - } > + do_one_test (json_ctx, impl, (CHAR *) (buf1) + align, c, len); > > json_array_end (json_ctx); > json_element_object_end (json_ctx); >