Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp2331794rwp; Fri, 14 Jul 2023 04:44:32 -0700 (PDT) X-Google-Smtp-Source: APBJJlExVG7FjAC7R3U/0M7TXj7Cy4zzVQ4+l9x2YMiEzt0ZTrQbKPzbx8bOn9lZPVftEmCFW6Sf X-Received: by 2002:a05:6a20:970b:b0:131:bcaf:9b with SMTP id hr11-20020a056a20970b00b00131bcaf009bmr2817722pzc.30.1689335072440; Fri, 14 Jul 2023 04:44:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689335072; cv=none; d=google.com; s=arc-20160816; b=c9BIde9EgVuV7Vk9fIFtC+LRWK2ACo4kvd45Wle+Q/DLqqYMeWrXt1Z+46mOdw+3oH Y+/L4W07DBT7KCCyFYx8qOwAT5JUQn6Qp3HYMrcGVeDRqFBGu1gv8kL88qc0qiMYlZSY fX5YpnO/rU+bHhEvd6dfxNp/yncf5nCapzNKOP8dvIJbvo/3i8PuhbjGheWFWaAHd6r4 rT+enMs9rMVlE0cjax9t/cPgOCsAZU1jf8oY2U16V2q3uJtc/7THIDkAZ+0WZZmmPcCE 2fl1rBdZrclQxvoYShEbMQ5RW2VIAQHROJIfGgZBKAPpCPrPHiKmaBUAqSpLbeLhG/cI eD4w== 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=yzKVNwZNxaI52yuCAvsu56J+T8LUM0KJrHtb7CNMHf4=; fh=+shTRcP2afYPB3T8LAeHMgymHxamHxMZM0SWeNTwu5o=; b=M3QOwmi3Cfsluo71oIZLO1i7Qkr83ENWlwdHf9zRxf0Nwipw9CNd5kCEdBK0ZV7j/x 6uOeKyjfJX+VSzGkbyDi1ryQQXCwtixeTVTn8vb8ocHAwV31AZrJAM9wfsx6a7+/WpDq doxfPnsbicKLzbwxlB054ujbmh8HQZ+fbiEWcwnE0XRYgBNUgd/BAM8PvMppHOW3YWaK OfMYmjzUyTsnTkv0G7oLXbd+1hW7l+C6RpZ2qn7MFaJPFuAOwWJXaFRhRyBOqJamOcMX VkdAOq0SpkVy7FbUI4OGl1SJiw6a0EkeAUfwXs/Z5yeDszOTPR788Fqkhij6Fe20axs/ u9Ng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=hL0IlyNn; 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 jg19-20020a17090326d300b001b9c3daaf1fsi7027340plb.272.2023.07.14.04.44.19; Fri, 14 Jul 2023 04:44:32 -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=hL0IlyNn; 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 S235459AbjGNLb4 (ORCPT + 99 others); Fri, 14 Jul 2023 07:31:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235382AbjGNLbz (ORCPT ); Fri, 14 Jul 2023 07:31:55 -0400 Received: from out-51.mta0.migadu.com (out-51.mta0.migadu.com [IPv6:2001:41d0:1004:224b::33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A767E44 for ; Fri, 14 Jul 2023 04:31:53 -0700 (PDT) Message-ID: <5be1cba6-b141-3a05-f801-3af7d2092674@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1689334311; 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=yzKVNwZNxaI52yuCAvsu56J+T8LUM0KJrHtb7CNMHf4=; b=hL0IlyNnmhRFaS86E4RhtXpP13YJlunFBnIf5LEOMoX4TxgzMdChUhaHfqn/yVa5RpAoU6 J59laa9+loeEh5LOQXrm90ihtcTtDyInNg9QomjcE72a4QTsvzX6uAQr6a6DUsZHrshL+y Sv8BwhS80obxrLS8N6sIFwE2/hX2xq0= Date: Fri, 14 Jul 2023 19:31:46 +0800 MIME-Version: 1.0 Subject: Re: [PATCH v5] blk-mq: fix start_time_ns and alloc_time_ns for pre-allocated rq Content-Language: en-US To: Tejun Heo Cc: Jens Axboe , hch@lst.de, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, ming.lei@redhat.com, zhouchengming@bytedance.com References: <20230710105516.2053478-1-chengming.zhou@linux.dev> <63f93f1c-98da-4c09-b3d8-711f6953d8b7@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,RCVD_IN_DNSWL_BLOCKED, 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/7/14 01:58, Tejun Heo wrote: > Hello, > > On Thu, Jul 13, 2023 at 08:25:50PM +0800, Chengming Zhou wrote: >> Ok, this version will only get time stamp once for one request, it's actually >> not worse than the current code, which will get start time stamp once for each >> request even in the batch allocation. >> >> But yes, maybe we can also set the start time stamp in the batch mode, and only >> update the time stamp in the block case, like you said, has better performance. >> >> The first version [1] I posted actually just did this, in which use a nr_flush counter >> in plug to indicate that we blocked & flushed plug. Tejun and I think it seems fragile. >> So go to this way that only set time stamp once when the request actually used. >> >> [1] https://lore.kernel.org/all/20230601053919.3639954-1-chengming.zhou@linux.dev/ >> >> Another way I can think of is to make rq_qos_throttle() return a bool to indicate >> if it blocked. Tejun and Jens, how do you think about this way? >> >> Although it's better performance, in case of preemption, the time stamp maybe not accurate. > > Trying to manually optimized timestamp reads seems like a bit of fool's > errand to me. I don't think anyone cares about nanosec accuracy, so there > are ample opportunities for generically caching timestamp so that we don't > have to contort code to optimzie timestamp calls. > > It's a bit out of scope for this patchset but I think it might make sense to > build a timestamp caching infrastructure. The cached timestamp can be > invalidated on context switches (block layer already hooks into them) and > issue and other path boundaries (e.g. at the end of plug flush). > Yes, this is a really great idea. It has better performance and is more generic. Thanks.