Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp20645293rwd; Thu, 29 Jun 2023 05:20:35 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6aHvPT+KuQBK5HVM5ajGcjaxOhz7217saxv580MQA8meqzVZes8ggpXHH4q+xcrqPx3eiY X-Received: by 2002:a05:6a00:1a51:b0:67c:5c21:b430 with SMTP id h17-20020a056a001a5100b0067c5c21b430mr10439571pfv.33.1688041235336; Thu, 29 Jun 2023 05:20:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688041235; cv=none; d=google.com; s=arc-20160816; b=JMvGyFzKrBj/bNDyXYpsFFj89+op2VqsPfFSypQD/x5fkTtaO8hUzUzmP2BpgVXrJj 4QoERhpkMxAgAbWISIBOTXJUzY6FtauwvKvQ8zqcLQENAgl1Vb1ugoNzLNvmOiYzr4p/ 2iS+/QNiR9bJoeHJw03gaG7Pq7Jp4WhyjJIHXUaRlC2Bzj5lezd4XWu7BLDrmTAcC/sa gkpxc1eh9AYCJryjyRmzIrvBLNLRMgF/sQfhKPENQfvuNrT/yDSJtjaEXPaPIlOaT4Z+ FsghGAg4QikewRaT3gmO6pawjfLrcHr9hn4I8aWkntm5RPaMztZ6hzXzpH3CxHJ0PB0q zzIQ== 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 :message-id:date:subject:cc:to:from; bh=gwWFfiK0U3bk8zCrD3ZClP1qr0CWT3rJgZttN2wbo0M=; fh=jVO2EC1fXvr6Bl8+7yHtFIrYqo7iQ9dvd55sFdmq7po=; b=c6dVljSlY+XVbqygrHnV7ZgnsUReAxHfRf1uCsJ+IKKewuVli6ib3j0QKlSKAINLyL Owba2iaSd59S05YsXna7ZVCfNJbPeUCGkb/BPUmJwnaTTK6YHdjAnsQeyK2vzxgP09rt 2taVOCWF905PJ0xuuOYTDymajKvMqNVvwMX0I8e4Ej9zWrkibHT83k8gmNzxL+soQqRx unwvLlf1aAz9q4IT0fF80cHyhVCxbeKT4Pcnp/6k1dKKfir5KXSjI8SVXmJx0pYDONW1 lcdeF9XeGKNL7xIvLOlA6sPlJuXaUDWPSVxtweIccZ2v/+oWDokOP/aD5+BGepk4N1ae /7FQ== 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; dmarc=fail (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 u134-20020a62798c000000b0067f03c85d73si3662028pfc.115.2023.06.29.05.20.20; Thu, 29 Jun 2023 05:20:35 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231543AbjF2MNv (ORCPT + 99 others); Thu, 29 Jun 2023 08:13:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50222 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229794AbjF2MNt (ORCPT ); Thu, 29 Jun 2023 08:13:49 -0400 Received: from out-20.mta1.migadu.com (out-20.mta1.migadu.com [IPv6:2001:41d0:203:375::14]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 19BF7E6C for ; Thu, 29 Jun 2023 05:13:47 -0700 (PDT) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: chengming.zhou@linux.dev To: axboe@kernel.dk, ming.lei@redhat.com, hch@lst.de, tj@kernel.org Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Chengming Zhou Subject: [PATCH v4 0/2] blk-mq: fix start_time_ns and alloc_time_ns for pre-allocated rq Date: Thu, 29 Jun 2023 20:13:00 +0800 Message-Id: <20230629121302.1124851-1-chengming.zhou@linux.dev> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT 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 From: Chengming Zhou Hello, This patchset fix start_time_ns and alloc_time_ns for pre-allocated rq. patch 1 is preparation that we move data->rq_flags initialization code outside blk_mq_rq_ctx_init() to its caller, since we will need it to tell if we need to get start_time_ns. patch 2 is the fix patch that we set alloc_time_ns and start_time_ns to now when the pre-allocated rq is actually used and we skip setting during pre-allocation. v4: - Combine the last two patches into one patch for clearer review. - Use blk_mq_alloc_data to pass start_time_ns instead of passing down yet another parameter. Thanks Christoph Hellwig. - [v3] https://lore.kernel.org/all/20230628124546.1056698-1-chengming.zhou@linux.dev/ v3: - Skip setting the alloc_time_ns and start_time_ns during pre-allocation, which is clearer, as suggested by Tejun. - [v2] https://lore.kernel.org/all/20230626050405.781253-1-chengming.zhou@linux.dev/ v2: - Let blk_mq_rq_ctx_init() receive start_time_ns for batched time setting. - Set alloc_time_ns and start_time_ns when the pre-allocated rq is actually used, as suggested by Tejun. - [v1] https://lore.kernel.org/all/20230601053919.3639954-1-chengming.zhou@linux.dev/ Chengming Zhou (2): blk-mq: move data->rq_flags initialization code blk-mq: fix start_time_ns and alloc_time_ns for pre-allocated rq block/blk-mq.c | 87 ++++++++++++++++++++++++------------------ block/blk-mq.h | 1 + include/linux/blk-mq.h | 6 +-- 3 files changed, 53 insertions(+), 41 deletions(-) -- 2.39.2