Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp30584852rwd; Thu, 6 Jul 2023 07:59:04 -0700 (PDT) X-Google-Smtp-Source: APBJJlGChBe5O3zG9Y5SwNueQam4mP4gsarF8zi4/tGAyUvBt/t+gtybhSMfM3FtXOxwUSpVtR6/ X-Received: by 2002:a05:6a00:1782:b0:666:8403:9f4 with SMTP id s2-20020a056a00178200b00666840309f4mr2336842pfg.16.1688655543840; Thu, 06 Jul 2023 07:59:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688655543; cv=none; d=google.com; s=arc-20160816; b=Ruo2g4hip6VNo1cOV2zFEUgvcFY1bb/vo4hyYewXKpKFnA6lz5CWdz3d6TQW2MAsLt fWwp7Do41Br99h7RnDPqP1OoATrZ2jf/4Lc2O4Bp33ItGrO0ZiO9p5J8b06MOAf3fYEB hSqLhPJH0A82bCD9prxm9Rx4KjeLtDA+AVZhz+UZIbkfS1gQQgUt0p9gNQQcP43GJBVY htz8ChQs4QLYSwH86xdsFIogy9OtfR6ntd69rCzTO4RckLk9xPWXQtRmd1wOewXTXv9q aTdPQ49BCRKoXeBfnj7aXeml7sZEzJipfCXmlgxHQFLnA6MLyblkbV5NekyeVHNrBCkc JUkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=zTE0V5t98zZ4trz2YTIGnE5FyV0uyyUCDbqLKzMextQ=; fh=SSZ+nOIomj7LTe5tNWupYx+/slFG7OqqAhtGN4ji4pI=; b=Bm/V3eUyEdTmpD9L+yKqdYQZwDAnocwwI1raU1U9oim2uch/v89ZzCvcp+5fGc36/j /hzlBKZoAmOXkEv2EgJuDXOLgUOMVGCwPdaiNbqvg9AmYeqMlzX1vYCNMGePqoRa13rd 0vkZI6lj+ik5ld+HS9EdcNxRDGkMwNX4sw4+7BlvPjLEc3Fb7OlCrxfpMlIW4NQ/xWlM CdkDNOlnPdOPj6MJi/Hku0lNiYNyKNHQrDibqZ+6H9YsJCD8wRSN70JAVObkH6TTCTX/ /oN+GCiqHzdayUyDG24xbzLQujfjUwoUfq3271UWZQqtc7xGfaSe+A6xarEMaWgzr0jW W8cw== 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 x37-20020a056a0018a500b006687ed7b4a5si1678787pfh.140.2023.07.06.07.58.49; Thu, 06 Jul 2023 07:59:03 -0700 (PDT) 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 S233203AbjGFOjx (ORCPT + 99 others); Thu, 6 Jul 2023 10:39:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233206AbjGFOjw (ORCPT ); Thu, 6 Jul 2023 10:39:52 -0400 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5B96010F5; Thu, 6 Jul 2023 07:39:50 -0700 (PDT) Received: by verein.lst.de (Postfix, from userid 2407) id B43B667373; Thu, 6 Jul 2023 16:39:46 +0200 (CEST) Date: Thu, 6 Jul 2023 16:39:46 +0200 From: Christoph Hellwig To: Chengming Zhou Cc: Christoph Hellwig , axboe@kernel.dk, ming.lei@redhat.com, tj@kernel.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Chengming Zhou Subject: Re: [PATCH v2 1/4] blk-mq: use percpu csd to remote complete instead of per-rq csd Message-ID: <20230706143946.GA15131@lst.de> References: <20230629110359.1111832-1-chengming.zhou@linux.dev> <20230629110359.1111832-2-chengming.zhou@linux.dev> <20230706130735.GA13089@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17 (2007-11-01) X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE,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 Thu, Jul 06, 2023 at 10:23:49PM +0800, Chengming Zhou wrote: > Yes, should I change like below? Looks like much long code. :-) > > if (llist_add(&rq->ipi_list, &per_cpu(blk_cpu_done, cpu))) > smp_call_function_single_async(cpu, &per_cpu(blk_cpu_csd, cpu)); Doesn't look bad too me. > > > > > > But I think this code has a rpboem when it is preemptd between > > the llist_add and smp_call_function_single_async. We either need a > > get_cpu/put_cpu around them, or instroduce a structure with the list > > and csd, and then you can use one pointer from per_cpu and still ensure > > the list and csd are for the same CPU. > > > > cpu = rq->mq_ctx->cpu; So it's certainly the same CPU, right? You're right of couse - cpu is the submitting cpu and not the current one and thus not affected by preemption. Sorry for the noise.