From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.9 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AB728C43381 for ; Wed, 20 Feb 2019 22:43:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 71A3B20880 for ; Wed, 20 Feb 2019 22:43:35 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="BgsGn+vq" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726172AbfBTWne (ORCPT ); Wed, 20 Feb 2019 17:43:34 -0500 Received: from mail-pf1-f195.google.com ([209.85.210.195]:42491 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725939AbfBTWnd (ORCPT ); Wed, 20 Feb 2019 17:43:33 -0500 Received: by mail-pf1-f195.google.com with SMTP id n74so12664291pfi.9 for ; Wed, 20 Feb 2019 14:43:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=XQ3gln6bKM4/ZAwGxcOzCJ72RFxWRXWRCdrClIO7PH4=; b=BgsGn+vqMKHaLmffa7RAeQVsPrABG5nR3ahfxW9V1iWq+/TWNIGG70Lg3vShnGAsjh EYDWTAjnmeoI1PqkRiCRWFc0j9roMlAhaMmtyHjWON/lyHev57MTJvAlOcqhiEXut+W8 9KBMGOjmEw3wxAaLav8CsFoMepGONln9+cxu25n9xZqX3YRXBqzv7T+tHa/Zcls5YbG1 3H10RA/Zv6x3ce/Ht3NLYPUD9skbsHQcAI99vXwWWKcvQx7FJt82NR6FJbKA8lC58Cty XTy57WUtj7zsROfJbMknzo5VUtCDT7V5hVrHdTlLjHhO0fiflC+yBIhGi19pUEbFCFXI XVXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=XQ3gln6bKM4/ZAwGxcOzCJ72RFxWRXWRCdrClIO7PH4=; b=OB2Jx6/v3YRKZdsmnCNNE8d0kIXzxpJr+SzXxu/RehhlayCXI+JBeXBRmLc4Fuj2uQ ytYQRX24D/2UMuPQ1J/59gO/tKtzJX9vISsrxHvIhYun/F1cL3ISIixcE8/WyEZYcX4Q rO2ouEGToNf6sVkDCxjg9v1vPN+8vgOzr7acvrX3V8T2Ow3Yb1YxTJAJzyDB8sn+x/T0 K5KBGBClG7jMjqXIkqq/NGda39WR6BwY8twcbuVFA9OpaJ50bOQGqd4YeE0Y1JX24sN0 EcRmA+DMl2HxnwOc3H4fs3GGAGIRDY/4u5xqIEuCkI1CRnidPALKY+3Be6npZrfpXTwO Cnqw== X-Gm-Message-State: AHQUAuZNwTZSJeAFnpbBIWeOOnnGsoVLa8LB37+p7lKmgVbF+NXD4c1p //jgPfqyCuVbdFXgE6JMgXCNTLRO8IAGnH63hBI= X-Google-Smtp-Source: AHgI3IZGAuZqvOsSOdQu1hNUlNZMQ++l/XA7fsRdFnPDE4WKTorF2O8jsUS9H7wmDdhLB7DLf/G96HoyZqp2WfGzric= X-Received: by 2002:a65:500c:: with SMTP id f12mr30872883pgo.226.1550702612887; Wed, 20 Feb 2019 14:43:32 -0800 (PST) MIME-Version: 1.0 References: <20190211085548.7190-1-vladbu@mellanox.com> <20190211085548.7190-8-vladbu@mellanox.com> <20190214182442.GA19269@splinter> <20190215113041.GA10511@splinter> In-Reply-To: From: Cong Wang Date: Wed, 20 Feb 2019 14:43:21 -0800 Message-ID: Subject: Re: [PATCH net-next v4 07/17] net: sched: protect filter_chain list with filter_chain_lock mutex To: Vlad Buslov Cc: Ido Schimmel , "netdev@vger.kernel.org" , "jhs@mojatatu.com" , "jiri@resnulli.us" , "davem@davemloft.net" , "ast@kernel.org" , "daniel@iogearbox.net" Content-Type: text/plain; charset="UTF-8" Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Tue, Feb 19, 2019 at 4:31 AM Vlad Buslov wrote: > > > On Tue 19 Feb 2019 at 05:26, Cong Wang wrote: > > On Fri, Feb 15, 2019 at 7:35 AM Vlad Buslov wrote: > >> > >> Another problem that I found in cls_fw and cls_route is that they set > >> arg->stop when empty. Both of them have code unchanged since it was > >> committed initially in 2005 so I assume this convention is no longer > >> relevant because all other classifiers don't do that (they only set > >> arg->stop when arg->fn returns negative value). > >> > > > > The question is why do you want to use arg->stop==0 as > > an indication for emptiness? Isn't what arg->count==0 > > supposed to be? > > Good question! I initially wanted to implement it like that, but > reconsidered because iterating through all filters on classifier to > count them is O(N), and terminating on first filter and relying on > arg->stop==1 is constant time. Making function that is called > "tcf_proto_is_empty" linear on number of filters seemed sloppy to me... Good point, however arg->stop _was_ supposed to set only when error happens. Probably you want a new arg here to stop on the first entry.