Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp31700834rwd; Fri, 7 Jul 2023 03:14:10 -0700 (PDT) X-Google-Smtp-Source: APBJJlF8RrPbjSBVazOg5EnswABUIXCK5nvrZoLHNJy9NsW4WQ4G74XUmDvkpmF1QN3QFNdo/40J X-Received: by 2002:a17:902:ea0c:b0:1ad:f407:37d1 with SMTP id s12-20020a170902ea0c00b001adf40737d1mr3191564plg.52.1688724850297; Fri, 07 Jul 2023 03:14:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688724850; cv=none; d=google.com; s=arc-20160816; b=ESLR/WTcA5EzxcEKY+Fcw7p3S132+k7DQ9ZWNoIAASolOPPdhh+Bq2Ad2CwX/2BhWG wTMPw4ywN2aby/FqhDsH6OTPSuOV59uf5GXYIVbXxvlFrnHF5lXDCcNF/SD5wpQCmQmw ITaJdT8DH9dmr1X/2D/VfC+LJpy0Urje3hkFr/zu9zgtG5gfBEFaCKjxuRnyTFFLcGWf rlz8Gd8Q0ycf6b8oGwlezpx1j3UaaXKwyG3SOwZ4B4F0jpdSxDmgy8Ah/TppeyT2JQcd 4NMZ7fI9KmHOEVKc7p28uEZv3SYs/6djvRqH0mjOC2ANa6X6GAgK7VV7NVPXw9V9m6HJ 7X9w== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j3-20020a170903028300b001a97a54c3a2si3903091plr.197.2023.07.07.03.13.55; Fri, 07 Jul 2023 03:14:10 -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 S231421AbjGGJjF (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 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,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 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(-) -- 2.41.0