From patchwork Tue Jun 27 12:08:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chengming Zhou X-Patchwork-Id: 11341 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp8164820vqr; Tue, 27 Jun 2023 05:42:56 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7nbjg64aLzL/xuKUZI/H5SI0wrTi8RADX1kw7EK+gEaxBDr/h+zbQty/8hSmjgbYD+YaJr X-Received: by 2002:aa7:db4c:0:b0:51d:9f41:61eb with SMTP id n12-20020aa7db4c000000b0051d9f4161ebmr2816332edt.40.1687869775934; Tue, 27 Jun 2023 05:42:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687869775; cv=none; d=google.com; s=arc-20160816; b=hQ0/UNy3Bv9g48nGG7xc9H/9pmlyDE8d69nHoj6It0mvEoYaa8z3c8TjCm8kg9sZh9 8O/2rvwqbBnfll1PiD7iXF1jinxqGlCBtn5FrJxKwKm/GnWJQXyI0bB8d8zuaV4UJYfh YJljDiGKl/F3iJxTwdWdSRRyMe0vedmSa7Cjf5LtMVTWrbq0IHRpoP7a+xNMgbAcqB/s MjAcKu+NwIbQpbHZ/bJFT+QEfg5xtbZSuH2k7LCDDK5VJql80pTHV/R1jzliBtFA+izm Y8BuY7SnUb/l15SSdkpHjR21EMOUiYtOy1W5xEuH2pwISJrP0kaWAZrQ4XZ2h6PXOk1I sAhw== 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=AUY6SnNaHoXJwGaybydHxxeS/ugZelzciu5E2l4+EnE=; fh=T4yTOyWmBQqcqsH0AWzH3ZUeoyvhq0SzMP2E10XewIg=; b=lbZtMJGH2sSzabCf1Pf9T5Z6Qd5NWVNI7FiB3hGq0RJGuGeEzq53yo1xJEHYJ1x9es T5Ibpq0jGtWX3spbULK8E9O5CxbhFWikrmUXx97WpNel7TyXzcysVmnKatmHgZtGAICc j42CGHQSKLu7nVaWbcQO2XRWlaStXLPlPBnmRCdyD2Oh9TaXgGS95ToY9JVK+OzlEfIK /fx9obmnVAEGRd04/tjREwbVs4oAqEIuKCqQ7dQ6lbL1GVqRa9a+JYjWXCUVnPmiEUSE MQ6fvwLlVAYYwmZ7qe/g3GpMCBLaoaohGl2zSK1U1z1/mnKbFt8ewDGDGd1ZK/9rFRQj Cifw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=mIS1PRPu; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u5-20020aa7d985000000b0051db006e404si339168eds.168.2023.06.27.05.42.28; Tue, 27 Jun 2023 05:42:55 -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=mIS1PRPu; 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 S231834AbjF0MJ0 (ORCPT + 99 others); Tue, 27 Jun 2023 08:09:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35154 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229977AbjF0MJZ (ORCPT ); Tue, 27 Jun 2023 08:09:25 -0400 Received: from out-33.mta1.migadu.com (out-33.mta1.migadu.com [IPv6:2001:41d0:203:375::21]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 687E51999 for ; Tue, 27 Jun 2023 05:09:24 -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=1687867762; 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=AUY6SnNaHoXJwGaybydHxxeS/ugZelzciu5E2l4+EnE=; b=mIS1PRPuLpdlPbSy2ZIy3CeTs6m2b1Oi9utl3Dm/LwL3H2Cwm3Dvt+I/jfBB0a18vNnzLA MhqkpJ0z10FN2XvImNQsbDhRJt5jTudvxRrAvrqnOf7fU0yy1e0NXX1+WmbiNxCz8EVZYb jNaa3quBF63s70Iz5bP3HnsxVnDYTM8= From: chengming.zhou@linux.dev To: axboe@kernel.dk, tj@kernel.org, hch@lst.de, ming.lei@redhat.com Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, zhouchengming@bytedance.com Subject: [PATCH 0/4] blk-mq: optimize the size of struct request Date: Tue, 27 Jun 2023 20:08:50 +0800 Message-Id: <20230627120854.971475-1-chengming.zhou@linux.dev> MIME-Version: 1.0 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,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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769859738314027071?= X-GMAIL-MSGID: =?utf-8?q?1769859738314027071?= From: Chengming Zhou Hello, After the commit be4c427809b0 ("blk-mq: use the I/O scheduler for writes from the flush state machine"), rq->flush can't reuse rq->elv anymore, since flush_data requests can go into io scheduler now. That increased the size of struct request by 24 bytes, but this patchset can decrease the size by 40 bytes, which is good I think. patch 1 use percpu csd to do remote complete instead of per-rq csd, decrease the size by 24 bytes. patch 2-3 reuse rq->queuelist in flush state machine pending list, and maintain a u64 counter of inflight flush_data requests, decrease the size by 16 bytes. patch 4 is just cleanup by the way. Thanks for comments! Chengming Zhou (4): blk-mq: use percpu csd to remote complete instead of per-rq csd blk-flush: count inflight flush_data requests blk-flush: reuse rq queuelist in flush state machine blk-mq: delete unused completion_data in struct request block/blk-flush.c | 19 +++++++++---------- block/blk-mq.c | 12 ++++++++---- block/blk.h | 5 ++--- include/linux/blk-mq.h | 10 ++-------- 4 files changed, 21 insertions(+), 25 deletions(-)