From patchwork Thu Sep 29 06:24:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pankaj Raghav X-Patchwork-Id: 12993559 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 24D21C07E9D for ; Thu, 29 Sep 2022 06:24:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234630AbiI2GYj (ORCPT ); Thu, 29 Sep 2022 02:24:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35530 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234023AbiI2GYh (ORCPT ); Thu, 29 Sep 2022 02:24:37 -0400 Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D2BEB6F for ; Wed, 28 Sep 2022 23:24:32 -0700 (PDT) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20220929062429euoutp02550af5ff9e2bf519efdd7eacfbb74357~ZQLG7HU3W0561805618euoutp02t for ; Thu, 29 Sep 2022 06:24:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20220929062429euoutp02550af5ff9e2bf519efdd7eacfbb74357~ZQLG7HU3W0561805618euoutp02t DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1664432669; bh=EY7aDZPCgJ331fQZRDcffM+8OQ4Ci2fOSZ40zXQaSSI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=da3ExLPdP2p2AelmHXQ5elqUudaZpv/nKV4/+AIZq3sr0EgLD5KNWf8uILIZprIXT 1XDIQMDogHVuMyyNAoqY6NTRcsTzyJJmZ/9MI1NJSO1iY9YBWGgjw2613GWVKQSGYb 5GJnjZ3Gzc1Pp/ZXqeRzhjJqyQLGHUbMN/MgYKZQ= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20220929062428eucas1p1c15157ec69560ddd2599363648240e9a~ZQLF_xBsc1926419264eucas1p17; Thu, 29 Sep 2022 06:24:28 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id 5C.83.07817.C1A35336; Thu, 29 Sep 2022 07:24:28 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20220929062427eucas1p25a6efd73d6cdf8d481adb42f9d4006c3~ZQLFl3Az32726927269eucas1p2J; Thu, 29 Sep 2022 06:24:27 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20220929062427eusmtrp1b1dae56e523b898535172500db3a2f80~ZQLFkDUEA0651006510eusmtrp1d; Thu, 29 Sep 2022 06:24:27 +0000 (GMT) X-AuditID: cbfec7f4-8abff70000011e89-69-63353a1cdcec Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 80.98.10862.B1A35336; Thu, 29 Sep 2022 07:24:27 +0100 (BST) Received: from localhost (unknown [106.210.248.168]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20220929062427eusmtip148d0a41123ee6271c07549a0daae2f63~ZQLFUTFIX0995809958eusmtip1G; Thu, 29 Sep 2022 06:24:27 +0000 (GMT) From: Pankaj Raghav To: axboe@kernel.dk, hch@lst.de Cc: damien.lemoal@opensource.wdc.com, linux-block@vger.kernel.org, gost.dev@samsung.com, Pankaj Raghav , Christoph Hellwig Subject: [PATCH v2 1/2] block: adapt blk_mq_plug() to not plug for writes that require a zone lock Date: Thu, 29 Sep 2022 08:24:24 +0200 Message-Id: <20220929062425.91254-2-p.raghav@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220929062425.91254-1-p.raghav@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprIKsWRmVeSWpSXmKPExsWy7djP87oyVqbJBv8WC1usvtvPZvH77Hlm i5sHdjJZnJ6wiMli5eqjTBZ7b2lbfF7awu7A7rF5hZbH5bOlHrtvNrB57Gy9z+rRt2UVo8fn TXIBbFFcNimpOZllqUX6dglcGT/Or2EvuCFUsXbZFrYGxjP8XYycHBICJhJdG24xdjFycQgJ rGCUuPbkBDOE84VR4vWG22wgVUICnxklXl1Sh+m4eGEXG0TRckaJ6a/3skI4Lxkl9p75w9LF yMHBJqAl0djJDtIgIiAv8eX2WhaQGmaQFatv/mMCSQgLpEg82X8DrIhFQFXi6oxOsDivgKXE +2d/WSG2yUvMvPQdrIZTwEqi9dg3RogaQYmTM5+wgNjMQDXNW2eDnS0hsIdD4tOS88wgR0gI uEjM+B8DMUdY4tXxLewQtozE6ck9LBB2tcTTG7+helsYJfp3rmeD6LWW6DuTA2IyC2hKrN+l D1HuKLF7z3QWiAo+iRtvBSEu4JOYtG061FJeiY42IYhqJYmdP59ALZWQuNw0B2qph8SSM5sY JzAqzkLyyywkv8xC2LuAkXkVo3hqaXFuemqxUV5quV5xYm5xaV66XnJ+7iZGYKo5/e/4lx2M y1991DvEyMTBeIhRgoNZSYT391HDZCHelMTKqtSi/Pii0pzU4kOM0hwsSuK8bDO0koUE0hNL UrNTUwtSi2CyTBycUg1MbAYtyzTuSrjcStV8E6qwoTZxgQIrg+ez+zz+RUyGX4+cf2TMYaib IztV+nCZJjf7JqUbQarBRsfPzBW9syEje0WucZeSQ5GrRITEm9D7Yd6f/l6cwXdq4f3+NQ8r sjy3mnlPkkiWmVmmvEp3eUPN4wcPzxRbTX/v6/BMy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57tnCk2fvXPikSnPD+5+wZHd f3CngkSw0/aLmyO3dMw74Ctyqdf/9/Kl89NWPjrWtbc9J3hqiPQjH84b9x310l6mXWpd/shV r2beR78jZw8J+Wr6eP+Se5H067uzufzH55pHV8tsq07OneF1e3HzqQQlluKMREMt5qLiRAB4 WjfvFQMAAA== X-CMS-MailID: 20220929062427eucas1p25a6efd73d6cdf8d481adb42f9d4006c3 X-Msg-Generator: CA X-RootMTR: 20220929062427eucas1p25a6efd73d6cdf8d481adb42f9d4006c3 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20220929062427eucas1p25a6efd73d6cdf8d481adb42f9d4006c3 References: <20220929062425.91254-1-p.raghav@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org The current implementation of blk_mq_plug() disables plugging for all operations that involves a transfer to the device as we just check if the last bit in op_is_write() function. Modify blk_mq_plug() to disable plugging only for REQ_OP_WRITE and REQ_OP_WRITE_ZEROS as they might require a zone lock. Suggested-by: Christoph Hellwig Suggested-by: Damien Le Moal Signed-off-by: Pankaj Raghav Reviewed-by: Christoph Hellwig --- block/blk-mq.h | 3 ++- block/blk-zoned.c | 9 +++------ include/linux/blkdev.h | 9 +++++++++ 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/block/blk-mq.h b/block/blk-mq.h index 8ca453ac243d..0b2870839cdd 100644 --- a/block/blk-mq.h +++ b/block/blk-mq.h @@ -312,7 +312,8 @@ static inline void blk_mq_clear_mq_map(struct blk_mq_queue_map *qmap) static inline struct blk_plug *blk_mq_plug( struct bio *bio) { /* Zoned block device write operation case: do not plug the BIO */ - if (bdev_is_zoned(bio->bi_bdev) && op_is_write(bio_op(bio))) + if (IS_ENABLED(CONFIG_BLK_DEV_ZONED) && + bdev_op_is_zoned_write(bio->bi_bdev, bio_op(bio))) return NULL; /* diff --git a/block/blk-zoned.c b/block/blk-zoned.c index a264621d4905..db829401d8d0 100644 --- a/block/blk-zoned.c +++ b/block/blk-zoned.c @@ -63,13 +63,10 @@ bool blk_req_needs_zone_write_lock(struct request *rq) if (!rq->q->disk->seq_zones_wlock) return false; - switch (req_op(rq)) { - case REQ_OP_WRITE_ZEROES: - case REQ_OP_WRITE: + if (bdev_op_is_zoned_write(rq->q->disk->part0, req_op(rq))) return blk_rq_zone_is_seq(rq); - default: - return false; - } + + return false; } EXPORT_SYMBOL_GPL(blk_req_needs_zone_write_lock); diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 8038c5fbde40..74bc30c680d6 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -1300,6 +1300,15 @@ static inline bool bdev_is_zoned(struct block_device *bdev) return false; } +static inline bool bdev_op_is_zoned_write(struct block_device *bdev, + blk_opf_t op) +{ + if (!bdev_is_zoned(bdev)) + return false; + + return op == REQ_OP_WRITE || op == REQ_OP_WRITE_ZEROES; +} + static inline sector_t bdev_zone_sectors(struct block_device *bdev) { struct request_queue *q = bdev_get_queue(bdev); From patchwork Thu Sep 29 06:24:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pankaj Raghav X-Patchwork-Id: 12993560 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 79704C6FA83 for ; Thu, 29 Sep 2022 06:24:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234756AbiI2GYk (ORCPT ); Thu, 29 Sep 2022 02:24:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35534 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234666AbiI2GYh (ORCPT ); Thu, 29 Sep 2022 02:24:37 -0400 Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1065ADA8 for ; Wed, 28 Sep 2022 23:24:33 -0700 (PDT) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20220929062430euoutp010b1bd3dbad0e833899dcb684d682f01d~ZQLH2EK8_2289322893euoutp01c for ; Thu, 29 Sep 2022 06:24:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20220929062430euoutp010b1bd3dbad0e833899dcb684d682f01d~ZQLH2EK8_2289322893euoutp01c DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1664432670; bh=IRlCLrDK6rc31/KK+cmzjEqI+n7MfAyxKsU0+O5vXe4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DYxhaJ6skKadq0CvSYwrpwp0Stkhq4rMCZdCqRD9Nqt5vArRZ4OCD+3sngsIOQT0r Ox6bNaPsoBnItlpEFEe9ZpZNK30vmgsoahdmknjhLIm8IR0McVz1Ikp8aTyDAMNbqH 4ILBf5jsbFMBuA+25uqsa+iuIurCGP7FS5mcqIoI= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20220929062429eucas1p16bc65f775ceb0a86e38b9d41e0500dac~ZQLHEYKui0219102191eucas1p1C; Thu, 29 Sep 2022 06:24:29 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id 0D.83.07817.D1A35336; Thu, 29 Sep 2022 07:24:29 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20220929062429eucas1p24790a979fa780e8bff61d9fd5ec05f8e~ZQLGmbQE80037300373eucas1p2e; Thu, 29 Sep 2022 06:24:29 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20220929062429eusmtrp145528788bf054d3d24b75ef21ded757f~ZQLGltHeI0651006510eusmtrp1f; Thu, 29 Sep 2022 06:24:29 +0000 (GMT) X-AuditID: cbfec7f4-893ff70000011e89-6c-63353a1d6c1f Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 91.98.10862.C1A35336; Thu, 29 Sep 2022 07:24:28 +0100 (BST) Received: from localhost (unknown [106.210.248.168]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20220929062428eusmtip1dabbfca2c2c94472f63e0f8ce4bc1a8d~ZQLGQhzuq1082310823eusmtip1p; Thu, 29 Sep 2022 06:24:28 +0000 (GMT) From: Pankaj Raghav To: axboe@kernel.dk, hch@lst.de Cc: damien.lemoal@opensource.wdc.com, linux-block@vger.kernel.org, gost.dev@samsung.com, Pankaj Raghav Subject: [PATCH v2 2/2] block: use blk_mq_plug() wrapper consistently in the block layer Date: Thu, 29 Sep 2022 08:24:25 +0200 Message-Id: <20220929062425.91254-3-p.raghav@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220929062425.91254-1-p.raghav@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmplleLIzCtJLcpLzFFi42LZduznOV1ZK9NkgyPzpSxW3+1ns/h99jyz xc0DO5ksVq4+ymSx95a2xeelLewObB6Xz5Z67L7ZwOaxs/U+q0ffllWMHp83yQWwRnHZpKTm ZJalFunbJXBlbJm2h73gLFfFtPcf2BsYX3B0MXJySAiYSGy7OJMZxBYSWMEosbw1GcL+wijx 65x6FyMXkP2ZUeLp3HksMA3rj3YwQySWM0osaDrFBOG8ZJR48xBkFAcHm4CWRGMnO0iDiIC8 xJfba8GamQXqJVZe72YEsYUFoiSWPnrCCmKzCKhKtPyZCRbnFbCUOPDgLCPEMnmJmZe+g83h FLCSaD32DapGUOLkzCdQM+UlmrfOBjtI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hEVCVaPkz E2wmr4ClxIEHZ6Hmy0vMvPQdbA6ngJVE67FvYHEhoJqHV3tZIOoFJU7OfAJmMwPVN2+dzTyB UWAWktQsJKkFjEyrGEVSS4tz03OLjfSKE3OLS/PS9ZLzczcxAqNg27GfW3Ywrnz1Ue8QIxMH 4yFGCQ5mJRHe30cNk4V4UxIrq1KL8uOLSnNSiw8xmgLdPZFZSjQ5HxiHeSXxhmYGpoYmZpYG ppZmxkrivJ4FHYlCAumJJanZqakFqUUwfUwcnFINTN52McvOSbuIb/LnTwoKiVl86UNa3lHP j+dYb1dOzb09JXzCGcVzImXr1P2Cax75J12bbr+X5XLrAo1bz7es2eC96mvtlw8TrR+3MC++ Pi10+2aZatEmhdcMG3k7ew3Xva7Sm/vgz/11v2z35ItN7Z7rrTO7qmzHzYcdkb194RvyZ1tr 7n6ta+Z6IPf0ArbJ0vVRaunmMcv9LC7JXmRQKtlkZW3RUHMl4PciG6uCqPNvj5qFGsm5mC64 udTWsq0vzNuvtN85y60xQzD054sOaUPznmPTLr34JarWezTiW3LzCe7sim/ba34sk51keEJx QtTsk3v6dKa4r9838dUhe6kXOVO2elxe05218J5XixJLcUaioRZzUXEiAOm1LMsLAwAA X-CMS-MailID: 20220929062429eucas1p24790a979fa780e8bff61d9fd5ec05f8e X-Msg-Generator: CA X-RootMTR: 20220929062429eucas1p24790a979fa780e8bff61d9fd5ec05f8e X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20220929062429eucas1p24790a979fa780e8bff61d9fd5ec05f8e References: <20220929062425.91254-1-p.raghav@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Use blk_mq_plug() wrapper to get the plug instead of directly accessing it in the block layer. Signed-off-by: Pankaj Raghav --- block/blk-core.c | 2 +- block/blk-mq.c | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/block/blk-core.c b/block/blk-core.c index 203be672da52..d0e97de216db 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -850,7 +850,7 @@ int bio_poll(struct bio *bio, struct io_comp_batch *iob, unsigned int flags) !test_bit(QUEUE_FLAG_POLL, &q->queue_flags)) return 0; - blk_flush_plug(current->plug, false); + blk_flush_plug(blk_mq_plug(bio), false); if (bio_queue_enter(bio)) return 0; diff --git a/block/blk-mq.c b/block/blk-mq.c index c11949d66163..5bf245c4bf0a 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -1209,12 +1209,14 @@ static void blk_add_rq_to_plug(struct blk_plug *plug, struct request *rq) */ void blk_execute_rq_nowait(struct request *rq, bool at_head) { + struct blk_plug *plug = blk_mq_plug(rq->bio); + WARN_ON(irqs_disabled()); WARN_ON(!blk_rq_is_passthrough(rq)); blk_account_io_start(rq); - if (current->plug) - blk_add_rq_to_plug(current->plug, rq); + if (plug) + blk_add_rq_to_plug(plug, rq); else blk_mq_sched_insert_request(rq, at_head, true, false); }