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=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 6403DC43381 for ; Fri, 22 Feb 2019 20:00:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 290E12070B for ; Fri, 22 Feb 2019 20:00:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726241AbfBVUAV (ORCPT ); Fri, 22 Feb 2019 15:00:21 -0500 Received: from mga17.intel.com ([192.55.52.151]:24980 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725892AbfBVUAU (ORCPT ); Fri, 22 Feb 2019 15:00:20 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 Feb 2019 12:00:20 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,400,1544515200"; d="scan'208";a="321313033" Received: from samudral-mobl1.amr.corp.intel.com (HELO [134.134.177.76]) ([134.134.177.76]) by fmsmga006.fm.intel.com with ESMTP; 22 Feb 2019 12:00:20 -0800 Subject: Re: Three questions about busy poll To: Cong Wang Cc: Alexander Duyck , Eric Dumazet , Linux Kernel Network Developers References: From: "Samudrala, Sridhar" Message-ID: Date: Fri, 22 Feb 2019 12:00:19 -0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On 2/15/2019 11:18 AM, Cong Wang wrote: > 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? Thread pinning will not be required if XPS is setup to use xps-rxqs that allows configuring symmetric queues so that tx-queue is selected based on rx-queue. See XPS using receive queues map in Documentation/networking/scaling.txt > > Anyway, I will add this information to socket.7 man page. > > Thanks!