Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp4160794pxm; Tue, 1 Mar 2022 12:35:16 -0800 (PST) X-Google-Smtp-Source: ABdhPJz3+9R7gB5VKvqagVEq/MJFDV8xc8MwfkJNFtDA5OiQM9eLyUt0Dl7zdVhTtFcqwv0afHVK X-Received: by 2002:a05:6402:177b:b0:413:2822:1705 with SMTP id da27-20020a056402177b00b0041328221705mr26226483edb.270.1646166915989; Tue, 01 Mar 2022 12:35:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646166915; cv=none; d=google.com; s=arc-20160816; b=z6v64sBjwHMhk1gmTOgXBO3LoAdh/8mDJWvwZ4p8vyOGR4Af/MD0AYQ3xLIJqv5yrv VdDV7a4wWqSz5Uo7RfI0Kktv/vD7sGWAk7RkrDNxCNQhzbGz90eK1g92ELGJfr1n51NY lD/KVvHSGgPGPF+Y3Xry/lrHE3I9llQKys8UNEj8ioB60nZHgq6Bm28stQLPULT6Twyf KN65LHRfPLzYKGn7bSCh7GqNifvZjYYWd3BEfyEOm/fmaPKq/T52oj8VqKH95BfPeQzK A3K8IrYKpbeSTdEq9xggn3/4M1T8KHvS0LFdYwz7VZjnidxRdqWWGO7w0sAyVfabhsJj yL8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:organization:references:in-reply-to:date:cc:to:from :subject:message-id; bh=ATumYkfsy565KjQgHh5EKkXvypaJu1KWI+92TIRm5ek=; b=zWgCMZ+KN6ut9Md84QRzTaL3vnyAqDlPbfLtoyvUOls6t8mD2GSD18cgWqg8YdwJkh GKlp5Za6fffo9BM4KcL/OijdyP8laRVsSRPlksUtNYQ4hVxCaYhPkXPDWny9+USm4Nr/ Od5VZKmLKNpj7GYGcV5K1JIgP0+4ifNf/9OjtOXKAGDSUSfDD4AooE1LQioq2UhRzmDV Ab3G/gfwrZtiEYKI0vRhbS2rcFv/uVXAeWf38m+t16ub9xwk39KTwOK2TLkxYhedbu+G 0cnCtX5rjXLCNU8wJlPKbXlGEjfjM8fx1e7O3Io27Y+ieKVrw01BTI/ZNybLyXyI180f plIg== 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 hq9-20020a1709073f0900b006d5eeea3de5si10700128ejc.889.2022.03.01.12.34.53; Tue, 01 Mar 2022 12:35:15 -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 S237779AbiCAUQD (ORCPT + 99 others); Tue, 1 Mar 2022 15:16:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50848 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237805AbiCAUP6 (ORCPT ); Tue, 1 Mar 2022 15:15:58 -0500 Received: from cloud48395.mywhc.ca (cloud48395.mywhc.ca [173.209.37.211]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DEACD79C6D; Tue, 1 Mar 2022 12:15:01 -0800 (PST) Received: from [45.44.224.220] (port=57050 helo=[192.168.1.179]) by cloud48395.mywhc.ca with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1nP8tg-0006kw-90; Tue, 01 Mar 2022 15:15:00 -0500 Message-ID: <628f7ac96c15b0a3d5f2ddcdf4df79a03950b17e.camel@trillion01.com> Subject: Re: [PATCH v4 2/2] io_uring: Add support for napi_busy_poll From: Olivier Langlois To: Hao Xu , Jens Axboe , Pavel Begunkov Cc: io-uring , linux-kernel Date: Tue, 01 Mar 2022 15:14:58 -0500 In-Reply-To: <4f01857ca757ab4f0995420e6b1a6e3668a40da5.camel@trillion01.com> References: <29bad95d-06f8-ea7c-29fe-81e52823c90a@linux.alibaba.com> <4f01857ca757ab4f0995420e6b1a6e3668a40da5.camel@trillion01.com> Organization: Trillion01 Inc Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.42.4 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 On Tue, 2022-03-01 at 15:06 -0500, Olivier Langlois wrote: > On Wed, 2022-03-02 at 02:31 +0800, Hao Xu wrote: > > > > > > How about: > > > > if (list is singular) { > > > > ???? do something; > > > > ???? return; > > > > } > > > > while (!io_busy_loop_end() && io_napi_busy_loop()) > > > > ???? ; > > > > is there a concern with the current code? > What would be the benefit of your suggestion over current code? > > To me, it seems that if io_blocking_napi_busy_loop() is called, a > reasonable expectation would be that some busy looping is done or > else > you could return the function without doing anything which would, > IMHO, > be misleading. > > By definition, napi_busy_loop() is not blocking and if you desire the > device to be in busy poll mode, you need to do it once in a while or > else, after a certain time, the device will return back to its > interrupt mode. > > IOW, io_blocking_napi_busy_loop() follows the same logic used by > napi_busy_loop() that does not call loop_end() before having perform > 1 > loop iteration. > > > Btw, start_time seems not used in singular branch. > > I know. This is why it is conditionally initialized. > > Greetings, > Another argument for not touching the code the way that it is: io_napi_busy_loop() has another function on top of iterating the napi_list and calling napi_busy_loop() for each of them. The function also check the list entries validity and frees them when they time out. Not calling io_napi_busy_loop() you would bypass this check and that could result in timed out entries to never be disposed.