From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id D9B7BA0352; Sat, 5 Feb 2022 17:49:02 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 232A64069D; Sat, 5 Feb 2022 17:49:02 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id E316940143 for ; Sat, 5 Feb 2022 17:48:59 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1644079739; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HdQYXmUAxyO6ldQulhnQ+8rHDN+I9dGrIg4vJ5AWoS0=; b=ClYkM4Vy53QUHtX7ykaL6RX4GSlHa3HD45bPehEZm9Z6pzvf3yKuCHE9+RqBCOj+JU9AGd 4RVkMOL5Z+EYThE/AbAxz0M8XvwbaMf2zD1I57GArzTKfsWwzFjXP981z3sicxRDvhy1V9 K+rjqmauJaWiyrkAn8gp0uFVxI4PHKM= Received: from mail-lj1-f198.google.com (mail-lj1-f198.google.com [209.85.208.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-650-oS9JVrp5P_mV3v8UyZ3GLA-1; Sat, 05 Feb 2022 11:48:56 -0500 X-MC-Unique: oS9JVrp5P_mV3v8UyZ3GLA-1 Received: by mail-lj1-f198.google.com with SMTP id m13-20020a2e97cd000000b0023e09d49ce4so2348251ljj.6 for ; Sat, 05 Feb 2022 08:48:55 -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:content-transfer-encoding; bh=HdQYXmUAxyO6ldQulhnQ+8rHDN+I9dGrIg4vJ5AWoS0=; b=UN1FiOvqLt92d4eFP78domzUVfEpZusEiUIZrc44Sjaj/Hk5+WpzwDLlEUMB+wtZ9q XUjbxpkzoy3h2VhrBHvfJQCCLAH7MkQbZ+zj6RjlWfKLH5i3tYSVzumakJKkjRXe2HyU 20EsMZUo+9itzDU8kLZMUf6cHd2q9dTRszMVNrUiGHrsqx2o0z6Pw0KW/oDn5O5E+S2i pMITXHFV/09YMwKvNeU0msPoRKkBNV9VH7XZLOMRT60OmMmymZsh8wub+UyYvz/m7gpL 8WoUYrX6XAzE/TpxHLs7lTbNloEDPRNCwHKd6KVeV7iQRR75P3ZCIHS33QbaVYecj3IP MyrQ== X-Gm-Message-State: AOAM532al2AtFmuRdDxtp3MeWrpbkymUcqNPtPSr4qdB3q/ZEOrm8TFQ SihW/UCOnF9d1MXXNzXzDzgUSNPHoIUeb5F/ZU73+FuYvvEZFZSp/dirfElzOrS95mhZ0j0G0uC DdKw2Su0rYh2Jw69XEGg= X-Received: by 2002:a05:651c:1a0a:: with SMTP id by10mr3231656ljb.333.1644079734615; Sat, 05 Feb 2022 08:48:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJxmOSgM/apmyuU0USiqbsw0lhbXW33VwTpcrjlZRAQREBd86N4YyWq8k2Pq9pTR4ZR1cmTqxVLOY35pfgPtIeU= X-Received: by 2002:a05:651c:1a0a:: with SMTP id by10mr3231642ljb.333.1644079734380; Sat, 05 Feb 2022 08:48:54 -0800 (PST) MIME-Version: 1.0 References: <20220103142201.475552-2-amo@semihalf.com> <20220111113739.1104058-1-amo@semihalf.com> In-Reply-To: <20220111113739.1104058-1-amo@semihalf.com> From: David Marchand Date: Sat, 5 Feb 2022 17:48:43 +0100 Message-ID: Subject: Re: [PATCH] ring: optimize corner case for enqueue/dequeue To: Andrzej Ostruszka Cc: dev , Olivier Matz , Konstantin Ananyev Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dmarchan@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Tue, Jan 11, 2022 at 12:38 PM Andrzej Ostruszka wrote= : > When enqueueing/dequeueing to/from the ring we try to optimize by manual > loop unrolling. The check for this optimization looks like: > > if (likely(idx + n < size)) { > > where 'idx' points to the first usable element (empty slot for enqueue, > data for dequeue). The correct comparison here should be '<=3D' instead > of '<'. > > This is not a functional error since we fall back to the loop with > correct checks on indexes. Just a minor suboptimal behaviour for the > case when we want to enqueue/dequeue exactly the number of elements that > we have in the ring before wrapping to its beginning. > > Fixes: cc4b218790f6 ("ring: support configurable element size") > Fixes: 286bd05bf70d ("ring: optimisations") > > Signed-off-by: Andrzej Ostruszka > Reviewed-by: Olivier Matz > Acked-by: Konstantin Ananyev Reviewed-by: Morten Br=C3=B8rup Applied, thanks. --=20 David Marchand