From patchwork Fri Jul 7 09:37:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chengming Zhou X-Patchwork-Id: 11732 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp3158890vqx; Fri, 7 Jul 2023 03:19:52 -0700 (PDT) X-Google-Smtp-Source: APBJJlEaH4xd/6OxzdKNMKMO2Mozz6yj8hd1EjBOi+EY6vyVmMx8kDyWJDwR76OT3qgmUQdHYPh5 X-Received: by 2002:a05:6808:244:b0:3a3:2fad:695e with SMTP id m4-20020a056808024400b003a32fad695emr4615169oie.46.1688725192477; Fri, 07 Jul 2023 03:19:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688725192; cv=none; d=google.com; s=arc-20160816; b=gs/v41Glv9+3b/HMHP27vzwq8RYXvO8deeD+VfjDp+9epmRjR+fj293VsbtAtntrFD SdQBRCwjPl2MyyXYi9yy7aNt02TtNw8CGGtkxY3lxL1z0o6Ssid/kft13vwi58uo6UPz rzIenSiw3ZPxQP3iVT2xNDO8+CDrzcWEvMfWGFzpc8QlcftD887eNXoHDxRHAOtH3cyc wy5uAsWmsspMDcxRBOdZyW4P0MdOG6CAICcgfXblUCbfkU6BOPd56iVoXM5nMG/WydfE WR6V394ZxDNF2Ess0WbOZXU1PK9VonVvmwtqNHVI01FLlzrP/zSft7zRtGGm6N3suEaU injg== 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=H8lodFl56b2KExC0gt827b28JNOFi4rlCN2zLgYnfQM=; fh=btCu08YPIkaMnzl/TLHoNK175CbmOVbtuBRLd+sKXQY=; b=hcn7G00T2gLY4FHdkGR7iUJU0StCeAFtpAcBNZtdJOo2bY9ycleY/R9RO8aUcxemf6 cdMO8ZP2pVfpNIH2ULK/eovbQpqgu8Sd0OKijbtzBF9lIi27aIE9WI/8U5k9xfkLhc3y jZfnHa90C0KgebpZlmumxggpPlENe4yS8Kpsm1AdoBYlZxallgfRmy+S9GcTmvvf2zKq r/2i5RICS/rgRC9bGPXzYaKBPLinAjMqbxzCjzNthZVIif3mPff8Fd0m9WWNRZlNJcm/ 5bP52qXfxRoqK076cOtDZV+2q7A/hcjoLOVCdKS7c9VlpSiq/gYLs9f8ZpZR+C8iGvwS /2+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=LChLQBDK; 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 j10-20020a17090aeb0a00b0025bf86c41absi1702681pjz.151.2023.07.07.03.19.39; Fri, 07 Jul 2023 03:19: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=LChLQBDK; 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 S232478AbjGGJjF (ORCPT + 99 others); Fri, 7 Jul 2023 05:39:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53194 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231779AbjGGJjC (ORCPT ); Fri, 7 Jul 2023 05:39:02 -0400 Received: from out-3.mta0.migadu.com (out-3.mta0.migadu.com [91.218.175.3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CD40B2105 for ; Fri, 7 Jul 2023 02:39:01 -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=1688722740; 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=H8lodFl56b2KExC0gt827b28JNOFi4rlCN2zLgYnfQM=; b=LChLQBDKrnKjm1wTuC5RsNjieLetgMS+bReOjGftTGZVrxI3/fBDORG0ipWCNknYLe8Vqp IXwX7MzO51p62ijVzcl4oMlw2g2QPZAUz/MtYU+xnlaIdA8JFNl75LYjjMBVfo1zRnaev8 yulxGymtWYRWQ973u3VprI6V3cr3psg= 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, zhouchengming@bytedance.com Subject: [PATCH v3 0/4] blk-mq: optimize the size of struct request Date: Fri, 7 Jul 2023 17:37:18 +0800 Message-ID: <20230707093722.1338589-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?1770756707364912255?= X-GMAIL-MSGID: =?utf-8?q?1770756707364912255?= From: Chengming Zhou v3: - Collect Reviewed-by tags from Ming and Christoph. Thanks! - Remove the list and csd variables which are only used once. - Fix a bug report of blktests nvme/012 by re-initialization of rq->queuelist, which maybe corrupted by rq->rq_next reuse. - [v2] https://lore.kernel.org/all/20230629110359.1111832-1-chengming.zhou@linux.dev/ v2: - Change to use call_single_data_t, which use __aligned() to avoid to use 2 cache lines for 1 csd. Thanks Ming Lei. - [v1] https://lore.kernel.org/all/20230627120854.971475-1-chengming.zhou@linux.dev/ 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 is just cleanup by the way. patch 2 use percpu csd to do remote complete instead of per-rq csd, decrease the size by 24 bytes. patch 3-4 reuse rq->queuelist in flush state machine pending list, and maintain unsigned long counter of inflight flush_data requests, decrease the size by 16 bytes. Thanks for comments! Chengming Zhou (4): blk-mq: delete unused completion_data in struct request 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 block/blk-flush.c | 24 ++++++++++++++---------- block/blk-mq.c | 12 ++++++------ block/blk.h | 5 ++--- include/linux/blk-mq.h | 10 ++-------- 4 files changed, 24 insertions(+), 27 deletions(-)