From patchwork Thu Jun 29 12:13:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chengming Zhou X-Patchwork-Id: 11431 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp9595041vqr; Thu, 29 Jun 2023 05:20:17 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ77rcRGtajfwMf0PWoR/Aeu3tJ42Las/2VjIG7aPqgAz6oL4FmzTJjKN3SmtMiGK/0RK1sq X-Received: by 2002:a17:902:ca91:b0:1b8:35fa:cdcc with SMTP id v17-20020a170902ca9100b001b835facdccmr5602467pld.5.1688041216696; Thu, 29 Jun 2023 05:20:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688041216; cv=none; d=google.com; s=arc-20160816; b=XEqxf5NJxAfbRKQSZctCS1SeKbs3e3JulLDHTVGT04ZvDVQjoTCd2V1u76gBuV7uXD iw3RaPbkm6A5X6A//xmrv8wMLBTIz3sTwmQpmzXm+qQWCVfsyGpfWai1Fsf2wUaZ62F6 uYsMwusuNmdZJD7MtKs2SGjfTTeDsAdNguQ1ieCdL9MDb1r/GTlnjN3nZez5BQdjX3n7 Fwv+Rt0zOyq97rvIHaNFEnEJR/l4cYL5e6aTDM4KblDEeA6Nvy//Tc2QDWaU2EHC4doA /RF7lIqRbCBQwAIoh0AfkBwfc/E9lzo+/AekP9q++sLCNuRvrGqJ1KeDWIegJxZTI6Jb xmgg== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ji10-20020a170903324a00b001b23e9f586asi10100760plb.121.2023.06.29.05.20.00; Thu, 29 Jun 2023 05:20:16 -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 S231835AbjF2MNw (ORCPT + 99 others); Thu, 29 Jun 2023 08:13:52 -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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769951928397701391?= X-GMAIL-MSGID: =?utf-8?q?1770039506662253411?= 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(-)