Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp17592891rwd; Tue, 27 Jun 2023 05:19:56 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5Audj4qVeB/NFUZMwJAKuUqkk6pJvMDQGzQSpMQplygKc1nN6JG1QfNcJiGdFJA6RziC0k X-Received: by 2002:a17:90a:1a03:b0:262:ce8f:a3e with SMTP id 3-20020a17090a1a0300b00262ce8f0a3emr4243635pjk.42.1687868395282; Tue, 27 Jun 2023 05:19:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687868395; cv=none; d=google.com; s=arc-20160816; b=UP6CD8bJOTYT8ZH4Ytbez2L+j9tNubMacp0OU02iac5SWHKGJdPq1B9UIpgS7z9Esa K4MkVrgp0CO+/hOkNli6AjX4GkUk9Uy3KYWKjOtmCIXHYvewFbNKZVgmNPXuaBFnoNWj y69zHwYAVFfVqHWT2S5RpFr+aOtB7ntr7aOm3e5r/0YMFXvfZMYzdjcpUdXKovkAfc2S W1n+Is7j5n9fgNLKUrIAmeb/tXtacRtWAJdymLUqw3bSSd9LeyqYAIjjxqQPH/1xeV6z DKe0DffZPe1SV467RDyC9ETeXe3fJSCLZuyDmu1poEcpyV8JL0oI8lXEqZ6S+E03wagk uwhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:mime-version:date :dkim-signature:message-id; bh=5AAMGnil1vus66xTAIuI1lIxfQX8aaFDX8sQDFraqX0=; fh=Fu6xXsYCbG0u0LP41wyHxhITuTxe18FlDnybSH49ZmA=; b=eaoV9zIyBGxrMjUTLMKizNMhfl+Yf6cxwJfLrjnz/QBoAvF9ae/j9pRl07rWFozl6a iOyJkJEZdzIqWLuLvW0K4BPxQmpNjdD+cZUkxlv0XhLevLfw6Lbfr/I+e69A/Oyh9fzz jBxfsBTKfb9/MCPSSRPWiHhodSo/mcsuBPrT+MciTqkGddTsyhP7K0sxVKW559pe4Zte BN8HsN7WJnLbHOykrUtVoQv2lCf3R7NAZX5E4EHzASTTwHjySCBw11LEIouiDQA++z3a PxSWyTmn3gZZL1XNuCALjljGfVe9G9CS6qg99F1oBAeh0z1XwLRvD0r0cvyfxkyCqWCG 1QmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=eS1vGYD3; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l186-20020a6391c3000000b005573bd5add3si7215580pge.214.2023.06.27.05.19.43; Tue, 27 Jun 2023 05:19:55 -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; dkim=pass header.i=@linux.dev header.s=key1 header.b=eS1vGYD3; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231433AbjF0Lcz (ORCPT + 99 others); Tue, 27 Jun 2023 07:32:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46366 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231438AbjF0Lcy (ORCPT ); Tue, 27 Jun 2023 07:32:54 -0400 Received: from out-33.mta1.migadu.com (out-33.mta1.migadu.com [IPv6:2001:41d0:203:375::21]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 27A9626B7 for ; Tue, 27 Jun 2023 04:32:52 -0700 (PDT) Message-ID: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1687865568; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5AAMGnil1vus66xTAIuI1lIxfQX8aaFDX8sQDFraqX0=; b=eS1vGYD3pvIWNwfllqk4fByrGt+RqENGbMduaSfT6deiKtjk2Gw54VnY/s0C1RbCfKcq9Q phktX+iq9LmCjNOB1IPbCB18N4sM/abS27c7xSewD0hTrHMjZO356eNtdhAUx2jKMYkZgS dbDkSVh8MSGCTEWSYtSznAzZdPh9pDs= Date: Tue, 27 Jun 2023 19:32:42 +0800 MIME-Version: 1.0 Subject: Re: [PATCH v2 3/3] blk-mq: fix start_time_ns and alloc_time_ns for pre-allocated rq Content-Language: en-US To: Tejun Heo Cc: axboe@kernel.dk, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, zhouchengming@bytedance.com References: <20230626050405.781253-1-chengming.zhou@linux.dev> <20230626050405.781253-4-chengming.zhou@linux.dev> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Chengming Zhou In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 2023/6/27 04:46, Tejun Heo wrote: > Hello, > > I only glanced the blk-mq core part but in general this looks a lot better > than the previous one. Thanks for your review! > > On Mon, Jun 26, 2023 at 01:04:05PM +0800, chengming.zhou@linux.dev wrote: >> Note we don't skip setting alloc_time_ns and start_time_ns for all >> pre-allocated rq, since the first returned rq still need to be set. > > This part is a bit curious for me tho. Why do we need to set it at batch > allocation time and then at actual dispensing from the bat later? Who uses > the alloc time stamp inbetween? > Yes, this part should need more explanation, and my explanation is not clear. Now the batched pre-allocation code looks like this: ``` if (!rq_list_empty(plug->cached_rq)) get pre-allocated rq from plug cache // we set alloc and start time here return rq else rq = __blk_mq_alloc_requests_batch() do batched allocation (1) (2) return rq ``` In (1) we alloc some requests and push them in plug list, and pop one request to return to use. So this popped one request need to be set time at batch allocation time. Yes, we can also set this popped request time in (2), just before return it to use. Since all requests in batch allocation use the same alloc and start time, so this patch just leave it as it is, and reset it at actual used time. I think both way is ok, do you think it's better to just set the popped one request, leave other requests time to 0 ? If so, I can update to do it. Thanks.