From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751636AbeAZAMM (ORCPT ); Thu, 25 Jan 2018 19:12:12 -0500 Received: from mail-pg0-f66.google.com ([74.125.83.66]:32812 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751336AbeAZAMK (ORCPT ); Thu, 25 Jan 2018 19:12:10 -0500 X-Google-Smtp-Source: AH8x227g9S1KcKNGLQuqijFSRlMA0cBRguoDl9VmP/i31Vg/Cbznkrm6NuxyEOedThHh2Dyqv3BAOQ== Subject: Re: [PATCH net-next 01/12] ptr_ring: keep consumer_head valid at all times To: "Michael S. Tsirkin" , linux-kernel@vger.kernel.org Cc: netdev@vger.kernel.org, Jason Wang , David Miller References: <1516923320-16959-1-git-send-email-mst@redhat.com> <1516923320-16959-2-git-send-email-mst@redhat.com> From: John Fastabend Message-ID: <839791ca-8b20-f351-4ba1-bc2a071e4a3d@gmail.com> Date: Thu, 25 Jan 2018 16:11:54 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <1516923320-16959-2-git-send-email-mst@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 01/25/2018 03:36 PM, Michael S. Tsirkin wrote: > The comment near __ptr_ring_peek says: > > * If ring is never resized, and if the pointer is merely > * tested, there's no need to take the lock - see e.g. __ptr_ring_empty. > > but this was in fact never possible since consumer_head would sometimes > point outside the ring. Refactor the code so that it's always > pointing within a ring. > > Fixes: c5ad119fb6c09 ("net: sched: pfifo_fast use skb_array") > Signed-off-by: Michael S. Tsirkin > --- > include/linux/ptr_ring.h | 25 ++++++++++++++++--------- > 1 file changed, 16 insertions(+), 9 deletions(-) > Thanks for fixing this up. Acked-by: John Fastabend