From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf1-x435.google.com (mail-pf1-x435.google.com [IPv6:2607:f8b0:4864:20::435]) by sourceware.org (Postfix) with ESMTPS id 51F853858D1E for ; Wed, 9 Feb 2022 20:48:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 51F853858D1E Received: by mail-pf1-x435.google.com with SMTP id r19so6480112pfh.6 for ; Wed, 09 Feb 2022 12:48:31 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=xUHtU+Z8v0cl9tMtXqLO+UqUX4S3TNpK78qRxcuZPYc=; b=PlYHApzyyHp1twOGZkrKb+Sowhx7k0PBsqOHmWp/VJBW3dYpV1uPJKQT8XdT1EtGd0 Su/muSHkDY4WFmPMKkHtg++mZIkx1fO5ke/btJhpIKXcR+MZFeY33Ivt/x3FCiLLE3Ej FQ+LESi4dqad1iQDu7WkINs4Ww5S7JA/eG+XFx/ywQNHjtY3NQSBIBka+XSXpokwTa/k 3CIw4FQeYIlWlhF6NpHR42eq6R73Zi+WZ7obcpHJnLbtKk+qON0UFwhWBl9YpY2BEMUN PZqmmlp5y6i1lb3cSsvU5B6tdfZ/d2vcvnAchmgC2GU2u/reAwUlU8UPXHE+jjGXifrx y10w== X-Gm-Message-State: AOAM532wz1NUlOPI3mstkKSUQlxWLHI1AOw4qkwp20IGcWqn8nAEAGLL 0S6ZWEBLWZOk13/Pa7ezFzq8klOgWSaw2vUjKLEVN6yl X-Google-Smtp-Source: ABdhPJy8rzRyhtuuhvXxhgRfvGxRPOOj5nMQOCj7cJ4oc+Z7fpTBxy9m/d+mptZ3/pGKWN9erMDjUxEb7miGSztFBnE= X-Received: by 2002:a62:b40e:: with SMTP id h14mr4046820pfn.79.1644439710401; Wed, 09 Feb 2022 12:48:30 -0800 (PST) MIME-Version: 1.0 References: <20220207201624.601598-1-goldstein.w.n@gmail.com> <20220208212459.3526397-1-goldstein.w.n@gmail.com> <87zgn0ta63.fsf@linux.ibm.com> In-Reply-To: <87zgn0ta63.fsf@linux.ibm.com> From: Noah Goldstein Date: Wed, 9 Feb 2022 14:48:19 -0600 Message-ID: Subject: Re: [PATCH v3] String: Ensure 'MIN_PAGE_SIZE' is multiple of 'getpagesize' To: Tulio Magno Quites Machado Filho Cc: GNU C Library Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, 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.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Feb 2022 20:48:33 -0000 On Wed, Feb 9, 2022 at 7:57 AM Tulio Magno Quites Machado Filho wrote: > > Noah Goldstein via Libc-alpha writes: > > > When 'TEST_LEN' was defined as (4096 * 3) the allocation size Would > > not be a multiple of system page size if system page size > 4096. > > --- > > string/test-strcmp.c | 14 +++++++------- > > string/test-strncmp.c | 18 +++++++++--------- > > 2 files changed, 16 insertions(+), 16 deletions(-) > > > > diff --git a/string/test-strcmp.c b/string/test-strcmp.c > > index eacbdc8857..0abce769d0 100644 > > --- a/string/test-strcmp.c > > +++ b/string/test-strcmp.c > > @@ -16,7 +16,7 @@ > > License along with the GNU C Library; if not, see > > . */ > > > > -#define TEST_LEN (4096 * 3) > > +#define TEST_LEN (getpagesize () * 3) > > #define MIN_PAGE_SIZE (TEST_LEN + 2 * getpagesize ()) > > > > #define TEST_MAIN > > @@ -393,7 +393,7 @@ int > > test_main (void) > > { > > size_t i, j; > > - > > + const size_t test_len = MIN(TEST_LEN, 3 * 4096); > > I didn't understand this part. > Is the intention here to protect against platforms with a page size less than > 4096? Both to protect against platforms with smaller page size and keep test duration manageable for systems with larger page size. > > -- > Tulio Magno