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=-1.0 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 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 D5C6FC43381 for ; Fri, 15 Feb 2019 19:18:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9897D21900 for ; Fri, 15 Feb 2019 19:18:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="aV8ynxcv" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729030AbfBOTSm (ORCPT ); Fri, 15 Feb 2019 14:18:42 -0500 Received: from mail-pg1-f196.google.com ([209.85.215.196]:43525 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726038AbfBOTSm (ORCPT ); Fri, 15 Feb 2019 14:18:42 -0500 Received: by mail-pg1-f196.google.com with SMTP id v28so5230743pgk.10 for ; Fri, 15 Feb 2019 11:18:41 -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=LUz/lX4KMSyVd3kIupiPq2zV8vz3Hn7/Wxl0uCT2qLQ=; b=aV8ynxcveyfGNMjr571EhQmIHnfkGbogqx7x0LMs67yF7c4bBUq36+5onyOJqeYGhI MBXw/fJjgP2Ni4BS+Q+FB7JL34L7GlFgPxYzk4sdVWzD8Joch4UQ6csVdSWXPb6fJ3Rz dqR+KNqmRTkgRXjU5XBFqjLyTXCwVUBHpPPP/nMK67azedCY0sV8yARDvGK6jMOy2ElH IZkHe/IWU6PJKO+3Y/4nJVpas1ejeE1l2EGUA0aQVm9oO1UIZ+4nAKiLTXJsmTODk6mc YoYWY2riCOxPmF6kCISSyzljtvs5HAhZ/31j5Z27WJdpxpd51/4PF2UH1sVY7wlEnUMS L5eg== 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=LUz/lX4KMSyVd3kIupiPq2zV8vz3Hn7/Wxl0uCT2qLQ=; b=kTpnDFpnDFX/KPMsNxalkimsfZFr8y41IEHdB4MTS60Qcw83Cq4OByRSlCprMBJZ53 g/BJZNQbNum8laUQB3J8sOf1ZmcrjHM86OuzFVWTva4mkElWf761zjYmVVgYfrEqzomV eDuXsnuHjwBVpS5sGyAN8d2+RUVURH1sSlnUGzjZn0W0Wr/QwOeyWH14mVjBih4byE6A LuWu8Zt2jjnDKB5lpjY4sVqijPX5LeZ4EkLg7vtwKQXvvWouPqvrYmWFVQ56exPEfBas 34p/zGF86FRItC1S1uNz0aV9pMBgqfdk+reqyH/wS0mimCI/YScnl05+gsJSAKVJIW3l wMxg== X-Gm-Message-State: AHQUAuaDbMGPJzIagq/PYfLdfzncIw0rgN2qXPuGDzfValPjlFu2ihgl 129ukNRZEleqMDXSJDyAKeyP44pcF1oo/+hc0NI= X-Google-Smtp-Source: AHgI3IYy+qY1HVf8R6sthGHLlVdo9JW5gziLJFobEj9Txdo2BZ/qxJojiMDFJVNt0b4ttb57JyhdYfjGzxxP2hFZ6II= X-Received: by 2002:a62:e716:: with SMTP id s22mr11175083pfh.35.1550258321095; Fri, 15 Feb 2019 11:18:41 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Cong Wang Date: Fri, 15 Feb 2019 11:18:29 -0800 Message-ID: Subject: Re: Three questions about busy poll To: "Samudrala, Sridhar" Cc: Alexander Duyck , Eric Dumazet , Linux Kernel Network Developers 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 Thu, Feb 14, 2019 at 4:43 PM Samudrala, Sridhar wrote: > > > On 2/14/2019 12:15 PM, Cong Wang wrote: > > Hello, > > While looking into the busy polling in Linux kernel, three questions > come into my mind: > > 1. In the document[1], it claims sysctl.net.busy_poll depends on > either SO_BUSY_POLL or sysctl.net.busy_read. However, from the code in > ep_set_busy_poll_napi_id(), I don't see such a dependency. It simply > checks sysctl_net_busy_poll and sk->sk_napi_id, but sk->sk_napi_id is > always set as long as we enable CONFIG_NET_RX_BUSY_POLL. So what I am > missing here? > > epoll based busypoll is only based on global sysctl_net_busy_poll. > busy_poll value is used with poll()/select()/epoll and and busy_read is used > with socket recvmsg Right, I was confused by what the term "poll" refers to. > > 2. Why there is no socket option for sysctl.net.busy_poll? Clearly > sysctl_net_busy_poll is global and SO_BUSY_POLL only works for > sysctl.net.busy_read. > > > Not sure if it is useful to make it a per socket option. I think it could > be a per poll/epoll fd option It is useful, however, from Willem's reply it looks like hard to push it down from epoll() interface to each socket. > > 3. How is SO_INCOMING_NAPI_ID supposed to be used? I can't find any > useful documents online. Any example or more detailed doc? > > > A app can create one worker thread per device queue and a worker thread > for an incoming connection can be selected based on SO_INCOMING_NAPI_ID so that > all connections coming on a queue are processed by the same thread. This will > allow epoll from a thread to be associated with sockets that receive packets > from a single queue allowing busy polling. > This information is very useful. It also requires each thread pinning to each CPU/RX queue, right? Anyway, I will add this information to socket.7 man page. Thanks!