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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E58A7C433F5 for ; Fri, 18 Feb 2022 07:21:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231135AbiBRHWC (ORCPT ); Fri, 18 Feb 2022 02:22:02 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:58158 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230168AbiBRHWA (ORCPT ); Fri, 18 Feb 2022 02:22:00 -0500 Received: from out30-130.freemail.mail.aliyun.com (out30-130.freemail.mail.aliyun.com [115.124.30.130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 698161CFF4 for ; Thu, 17 Feb 2022 23:21:43 -0800 (PST) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R511e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04407;MF=haoxu@linux.alibaba.com;NM=1;PH=DS;RN=3;SR=0;TI=SMTPD_---0V4oPDUV_1645168900; Received: from 192.168.31.208(mailfrom:haoxu@linux.alibaba.com fp:SMTPD_---0V4oPDUV_1645168900) by smtp.aliyun-inc.com(127.0.0.1); Fri, 18 Feb 2022 15:21:40 +0800 Message-ID: <499e8183-aa64-1dbd-ca6c-0ba413777589@linux.alibaba.com> Date: Fri, 18 Feb 2022 15:21:39 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: napi_busy_poll Content-Language: en-US To: Olivier Langlois , Jens Axboe , io-uring@vger.kernel.org References: <21bfe359aa45123b36ee823076a036146d1d9518.camel@trillion01.com> <0446f39d-f926-0ae4-7ea4-00aff9236322@linux.alibaba.com> <995e65ce3d353cacea4d426c9876b2a5e88faa99.camel@trillion01.com> <0a9c1bdcedac611518e4a90c1921d1f7657c2248.camel@trillion01.com> From: Hao Xu In-Reply-To: <0a9c1bdcedac611518e4a90c1921d1f7657c2248.camel@trillion01.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: io-uring@vger.kernel.org On 2/18/22 07:18, Olivier Langlois wrote: > On Wed, 2022-02-16 at 20:14 +0800, Hao Xu wrote: >> Hi Olivier, >> I've write something to express my idea, it would be great if you can >> try it. >> It's totally untested and only does polling in sqthread, won't be >> hard >> to expand it to cqring_wait. My original idea is to poll all the napi >> device but seems that may be not efficient. so for a request, just >> do napi polling for one napi. >> There is still one problem: when to delete the polled NAPIs. >> > I think that I have found an elegant solution to the remaining problem! > > Are you ok if I send out a patch to Jens that contains your code if I > put your name as a co-author? No problem, go ahead. >> >> +       ne = kmalloc(sizeof(*ne), GFP_KERNEL); >> +       if (!ne) >> +               return; >> + >> +       list_add_tail(&ne->list, &ctx->napi_list); >> +} > ne->napi_id is not initialized before returning from the function! Yes, feel free to enhance this code and fix bugs. >