Received: by 2002:a05:6358:701b:b0:131:369:b2a3 with SMTP id 27csp4477624rwo; Tue, 25 Jul 2023 06:45:53 -0700 (PDT) X-Google-Smtp-Source: APBJJlEEG1vblIJaIy/op7sm1M/+k7mF84lLJDve2rJUG2sxPavODpbdODIe71soxgxUWBwc2OHA X-Received: by 2002:a05:6a20:918a:b0:134:dc23:1377 with SMTP id v10-20020a056a20918a00b00134dc231377mr11158247pzd.56.1690292752911; Tue, 25 Jul 2023 06:45:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690292752; cv=none; d=google.com; s=arc-20160816; b=sA9N6HCwtCwZPHq7oQ4wXGMsWTCaxSI5lsiiGV7UosDK0dfqwyj0n+5zKX281Hyr5/ CsCFpe4wje9bcKLTn0NBTXMyPsyk8QWS55yJ/NyhcYnBZPDXG5JsJeocm+XJhVirrZLD 95LQbQ86oCNFxuPV0+tf4ti0r0r6NMkUNGQv1ocQRrfqm1vTVtsf9Y1uQ1WrYiS210Wa 7aDXggkfwcHzTo9427SE3LsCGWOfgzv2zHRLfSF+A3TchF7zV9WkU8Ok5oNzAze1Tiy4 7fCPH0nB2aiTqoViUKbuyPPhrV0a2h5AQx8dJE4D64vAOghfRctUFMehVXsWM55XX7a3 XiQA== 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:dkim-signature; bh=o1A965Rmyit4V/K6hD1sBav9uLDra+3bpcOqxUt5eIs=; fh=4fzGWvE2LW7K10hgePOrl39slR3lbqz4nggQweyfPdc=; b=edS0JJWQPerV2M3lUh1ylUqGD1iYvIfFrvkKlFOBf9o1MYTFrNntcSr8FgGCAq1Tie P4+NxBRx7nlUseC3Ttt3ISjGCxUT/m159vJatE9XzRJ4RHaTB8iDKekn93+sR5/6KT6x Wfj5X2D2Fl1IAdf3nLCoV9fWNpibDO404oiGYjouRFqy9awjvAc7zCAY5ppVIc8SRudi oCX5L3MHmGMkl6gRp8hbuNekP+NiE3zJR586F9hA/Q329udLr1BNQQj9t725o4tlH2gx GRLlaHZGgEphIYuziDLxojfnesIMhI9ltqDM0KDtYihmBwvYNVtvJGgFwqDxJXC9kRAF 6KZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=dPQBmSow; 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 37-20020a631365000000b0055bc4075c1dsi11118945pgt.317.2023.07.25.06.45.38; Tue, 25 Jul 2023 06:45:52 -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=dPQBmSow; 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 S229834AbjGYNTB (ORCPT + 99 others); Tue, 25 Jul 2023 09:19:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229830AbjGYNTA (ORCPT ); Tue, 25 Jul 2023 09:19:00 -0400 Received: from out-20.mta0.migadu.com (out-20.mta0.migadu.com [IPv6:2001:41d0:1004:224b::14]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 266E310F6 for ; Tue, 25 Jul 2023 06:18:55 -0700 (PDT) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1690291134; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=o1A965Rmyit4V/K6hD1sBav9uLDra+3bpcOqxUt5eIs=; b=dPQBmSow5zQ4A2h2IYNoiNHUFfJmLfcnSv2nvtsExxlV4Q65g4JsN5MjLbRrK4f7Lt9qcI jwZUEhIvQq1paurJo4WxrU2RJFmxmdOjfv78KRNXDJliXJ5WmWjidD283EKIHlbKA9oJNm pUaFguEEtnzYC5DAAeoQIrxTrTbgfB4= From: chengming.zhou@linux.dev To: axboe@kernel.dk, hch@lst.de, ming.lei@redhat.com Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, zhouchengming@bytedance.com Subject: [PATCH v2 0/4] blk-flush: optimize non-postflush requests Date: Tue, 25 Jul 2023 21:00:58 +0800 Message-ID: <20230725130102.3030032-1-chengming.zhou@linux.dev> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 From: Chengming Zhou Hello, This series optimize flush handling for non-postflush requests. Now we unconditionally replace rq->end_io to make rq return twice back to the flush state machine for post-flush. Obviously, non-postflush requests don't need it, they don't need to end request twice, so they don't need to replace rq->end_io callback. And the same for requests with the FUA bit on hardware with FUA support. The previous approach [1] we take is to move blk_rq_init_flush() to REQ_FSEQ_DATA stage and only replace rq->end_io if it needs post-flush. But this way add more magic to the already way too magic flush sequence. Christoph suggested that we can kill the flush sequence entirely, and just split the flush_queue into a preflush and a postflush queue. So this series implement the suggested approach that use two queues: preflush and postflush requests have separate pending list and running list, so we know what to do for each request in flush_end_io(), and we don't need the flush sequence entirely. Thanks for comments! [1] https://lore.kernel.org/lkml/20230710133308.GB23157@lst.de/ Chengming Zhou (4): blk-flush: flush_rq should inherit first_rq's cmd_flags blk-flush: split queues for preflush and postflush requests blk-flush: kill the flush state machine blk-flush: don't need to end rq twice for non postflush block/blk-flush.c | 181 +++++++++++++++++++++-------------------- block/blk.h | 3 +- include/linux/blk-mq.h | 1 - 3 files changed, 96 insertions(+), 89 deletions(-) -- 2.41.0