Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp243092pxm; Tue, 1 Mar 2022 19:43:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJyPDsyZ8v8scsRukop5i7IkpMoE+yR4N/Z/CcIoT3vk0oeMim1IhvSJ8bdD7ffOoSMDm481 X-Received: by 2002:a05:6402:26d0:b0:413:bfbc:8343 with SMTP id x16-20020a05640226d000b00413bfbc8343mr11211861edd.211.1646192594158; Tue, 01 Mar 2022 19:43:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646192594; cv=none; d=google.com; s=arc-20160816; b=WH72pR7h9mZjDkExSl7cNMCQZi1eR77ohCMZuoqs4xDxba0CMtYnv8vcbgdS0X4NK5 vYphRBdRerjTwJZ/CnZEknXOOws9NJPsJ+fJJjY//cTC5ZOF2DU1arI896aakLDE6E4H 2NhkoMWkQXoJClzGuCkzW0hJ9reod37tS4XdeMvPdEBOx+o3Bw7uSy06sWM4XMOAQPGD sv+qxgBF9WvDtevpEIDepyOhmkKYu0DSHc2cJn6Wd7ySQ/flTdMrjL43sVqxV/gLsNll x1ZWfLCKedVUGHPa6e3MuNupS2GRuCA/Ewthj+2KffDtObEIu+say1T7IOT15qtK/s6r tqKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:cc:to:from:message-id:date; bh=PPpIY0iTKTpuQOC8VodklxfDNByR8FNVJ+L0IlD0Jfo=; b=euU+J6Hh79ASB7OpLmQXPqifDUGtOJE9+96scxzPplJC1UQAgp6anusDfRB4c/14ir GkG2loAi9JP8oAVViklv9qlUzUFfzXbZxdPEGzED4ivjRA9n+6VCpr9ei0PeNSUBkBnT rr1SVz32D1IxXhKZ9qkUd9v2TwMcjIiYujmnes+VPHnuvmE8lG3upyucV7Sd6HnWQXqn 3P7/VZRxphsAlRDk1aYGBcueU+25D2p4LDtnrDyxtk+lO7eAhbrk/tdvXhGPaUKQIXZd +ZRwASeaGGbCj6VEWdCz6jEFQOitGPAfHM9xeNq4NEgftU1i11RXaEhBWG2KT9vPyUDH ZZsw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 10-20020a170906318a00b006d1ddb409bdsi8914870ejy.32.2022.03.01.19.42.47; Tue, 01 Mar 2022 19:43:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232055AbiCANjO (ORCPT + 99 others); Tue, 1 Mar 2022 08:39:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50670 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232955AbiCANjM (ORCPT ); Tue, 1 Mar 2022 08:39:12 -0500 Received: from cloud48395.mywhc.ca (cloud48395.mywhc.ca [173.209.37.211]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BDBA326101; Tue, 1 Mar 2022 05:38:31 -0800 (PST) Received: from [45.44.224.220] (port=56374 helo=localhost) by cloud48395.mywhc.ca with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1nP2hy-0001ms-B1; Tue, 01 Mar 2022 08:38:30 -0500 Date: Tue, 01 Mar 2022 08:38:29 -0500 Message-Id: From: Olivier Langlois To: Jens Axboe , Pavel Begunkov Cc: Hao Xu , io-uring , linux-kernel Subject: [PATCH v3 0/2] io_uring: Add support for napi_busy_poll X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - cloud48395.mywhc.ca X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - trillion01.com X-Get-Message-Sender-Via: cloud48395.mywhc.ca: authenticated_id: olivier@trillion01.com X-Authenticated-Sender: cloud48395.mywhc.ca: olivier@trillion01.com X-Source: X-Source-Args: X-Source-Dir: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The sqpoll thread can be used for performing the napi busy poll in a similar way that it does io polling for file systems supporting direct access bypassing the page cache. The other way that io_uring can be used for napi busy poll is by calling io_uring_enter() to get events. If the user specify a timeout value, it is distributed between polling and sleeping by using the systemwide setting /proc/sys/net/core/busy_poll. v2: * Evaluate list_empty(&ctx->napi_list) outside io_napi_busy_loop() to keep __io_sq_thread() execution as fast as possible * In io_cqring_wait(), move up the sig block to avoid needless computation if the block exits the function * In io_cqring_wait(), protect ctx->napi_list from race condition by splicing it into a local list * In io_cqring_wait(), allow busy polling when uts is missing * Fix kernel test robot issues v3: * Fix do_div() type mismatch warning * Reduce uring_lock contention by creating a spinlock for protecting napi_list * Support correctly MULTISHOT poll requests Co-developed-by: Hao Xu Signed-off-by: Hao Xu Signed-off-by: Olivier Langlois Olivier Langlois (2): io_uring: minor io_cqring_wait() optimization io_uring: Add support for napi_busy_poll fs/io_uring.c | 246 ++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 237 insertions(+), 9 deletions(-) base-commit: 719fce7539cd3e186598e2aed36325fe892150cf -- 2.35.1