From owner-freebsd-transport@freebsd.org Wed Jul 20 20:41:20 2016 Return-Path: Delivered-To: freebsd-transport@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5AE13B9FECE for ; Wed, 20 Jul 2016 20:41:20 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-io0-x230.google.com (mail-io0-x230.google.com [IPv6:2607:f8b0:4001:c06::230]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2272F143F for ; Wed, 20 Jul 2016 20:41:20 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: by mail-io0-x230.google.com with SMTP id m101so58305865ioi.2 for ; Wed, 20 Jul 2016 13:41:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=D1g+WhcgJAeqr4pWX5Co/+Hk22vFlC+SphVgHG8sanE=; b=iVZrZhEYy9H8JjTHhW+xrgZ+/EA52WUxTTJFR7S1WBI7oKntLsA9qeNL8DaQa7io6T MyoSdGzTAaCj17kkykPCQp9+QWvURLfJz8KraSW7O81RxZxQ0Ja5+PopK7g5I4L7xfQR 1crCLJXXIMO9maFD4e0b3My6pCS0b+cHQ76x4xBV1lQduxO/8eZeMOPcd5Db3HXGVl1j swI+ofNeDlYc0Gkb+0jeiaMBeamZUm+ZUJ1OH3qTCeiEkC+yP8UFJAzqwz9N+teivsSB VHApAkM1iatSJzsFF1VehsLcc74uHvog8jbe66FNl8HRBwOd6p93cWgYefKtfvk4tTJz FjNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=D1g+WhcgJAeqr4pWX5Co/+Hk22vFlC+SphVgHG8sanE=; b=USAStYkcHwjqvVy2LxQiJBHN3rd0j4Yzpyf7YE5oShEpkTAerYqbBYKS2waonPWK66 5zNx7B8IIS02p4mmV9g+dL9PghMJb1Ec1I1EI2waMOXpvb91cu4h6EbsFf6E3HfC95Ua WQLFhS+pinfytI7SEWdR7TtaT9T3Nsr/x4doxZsPc5SMoRjshWaNgWe3RduAihc+Z5gO kByRAEUuh7jL3NuNrjl+DyJ51S/JN4Ilur3AYJbmOfZMd4AcJDlPECMrReC7UxASJ5yD fAk/JPBA/EOo6AbRzfzQMLB7k1lpQyG4oJG4NW1z1j8UXxLx47kFkUZvD1Ru6NJB7GyZ QoTg== X-Gm-Message-State: ALyK8tK5QbJGYIYAZ0SKVugvJEkmQraQlrGFRWroTlynt+kxe1bUjztEZxRD6UIaq5xvfrPkbn5JyBf+/eyXSw== X-Received: by 10.107.15.157 with SMTP id 29mr28091403iop.123.1469047279491; Wed, 20 Jul 2016 13:41:19 -0700 (PDT) MIME-Version: 1.0 Received: by 10.36.141.129 with HTTP; Wed, 20 Jul 2016 13:41:18 -0700 (PDT) In-Reply-To: References: <559f1d0e-9d35-f458-bff5-b69a03297cf0@netflix.com> From: Adrian Chadd Date: Wed, 20 Jul 2016 13:41:18 -0700 Message-ID: Subject: Re: in_broadcast() called for almost every packet in ip_output() To: Ryan Stone Cc: Andrew Gallatin , "" Content-Type: text/plain; charset=UTF-8 X-Mailman-Approved-At: Wed, 20 Jul 2016 20:58:39 +0000 X-BeenThere: freebsd-transport@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: Discussions of transport level network protocols in FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jul 2016 20:41:20 -0000 Hi, I care about the performance of unconnected UDP; it's how a lot of UDP network services work to arbitrary clients. It works fine and parallelises fine in the RSS case (as in, linear scaling to num-queues; so I've done millions of pps through that path.) The in_broadcast() overhead sucked; I found that out when using IP aliases on an interface and discovered the in_broadcast() check sucked time if you didn't bind the local address (forcing it to an address lookup/determination each time, for reasons I forgot.) So, ideally we'd just do some two-stage caching mechanism using atomics, rcu, generation count, etc where we'd do a cheap hash lookup to see if we have to do the slow broadcast check, and then the broadcast check itself would be a hash rather than a linear O(n) list walk. -adrian