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=-3.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=no 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 6B740C606CF for ; Tue, 9 Jul 2019 02:38:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 382042086D for ; Tue, 9 Jul 2019 02:38:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726322AbfGICiU (ORCPT ); Mon, 8 Jul 2019 22:38:20 -0400 Received: from shards.monkeyblade.net ([23.128.96.9]:33912 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725941AbfGICiU (ORCPT ); Mon, 8 Jul 2019 22:38:20 -0400 Received: from localhost (unknown [IPv6:2601:601:9f80:35cd::d71]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) (Authenticated sender: davem-davemloft) by shards.monkeyblade.net (Postfix) with ESMTPSA id 89DB1133E976D; Mon, 8 Jul 2019 19:38:19 -0700 (PDT) Date: Mon, 08 Jul 2019 19:38:18 -0700 (PDT) Message-Id: <20190708.193818.869894082642387542.davem@davemloft.net> To: willemdebruijn.kernel@gmail.com Cc: netdev@vger.kernel.org, willemb@google.com Subject: Re: [PATCH net-next] ipv6: elide flowlabel check if no exclusive leases exist From: David Miller In-Reply-To: <20190707093445.15121-1-willemdebruijn.kernel@gmail.com> References: <20190707093445.15121-1-willemdebruijn.kernel@gmail.com> X-Mailer: Mew version 6.8 on Emacs 26.1 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Mon, 08 Jul 2019 19:38:19 -0700 (PDT) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Willem de Bruijn Date: Sun, 7 Jul 2019 05:34:45 -0400 > From: Willem de Bruijn > > Processes can request ipv6 flowlabels with cmsg IPV6_FLOWINFO. > If not set, by default an autogenerated flowlabel is selected. > > Explicit flowlabels require a control operation per label plus a > datapath check on every connection (every datagram if unconnected). > This is particularly expensive on unconnected sockets multiplexing > many flows, such as QUIC. > > In the common case, where no lease is exclusive, the check can be > safely elided, as both lease request and check trivially succeed. > Indeed, autoflowlabel does the same even with exclusive leases. > > Elide the check if no process has requested an exclusive lease. > > fl6_sock_lookup previously returns either a reference to a lease or > NULL to denote failure. Modify to return a real error and update > all callers. On return NULL, they can use the label and will elide > the atomic_dec in fl6_sock_release. > > This is an optimization. Robust applications still have to revert to > requesting leases if the fast path fails due to an exclusive lease. > > Changes RFC->v1: > - use static_key_false_deferred to rate limit jump label operations > - call static_key_deferred_flush to stop timers on exit > - move decrement out of RCU context > - defer optimization also if opt data is associated with a lease > - updated all fp6_sock_lookup callers, not just udp > > Signed-off-by: Willem de Bruijn Looks good, applied, thanks Willem.