Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp498242pxb; Tue, 29 Mar 2022 06:57:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxJYtocLNUxCZ2UjGfb8ixXIzxfA7uV77dzI0d1wirfcHe2tNGg1A4Nrg+hgB/bgOi7WD2E X-Received: by 2002:a17:907:7b86:b0:6e0:5c28:4f5f with SMTP id ne6-20020a1709077b8600b006e05c284f5fmr33292992ejc.675.1648562238991; Tue, 29 Mar 2022 06:57:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648562238; cv=none; d=google.com; s=arc-20160816; b=V6ARSJlomVzfK6f0lu2S5r07giQxZ+N25da2aDyqPsYEBdRNQJgqmiPB0va4UG59yo urslEkbk/+leJLzbH+WdKSapHToZqkHFrCxG3JyR/3WW8hqoACt8NxsTFKVgKxihYv/l PN/x3tAS7kK2RY2zmujn/fwcVBj82+DSjN+MOYWKrpzYt16c0pirdSgqZfROvJT6HGME bhMh2xl/sx+7lLQtfZmDOzoZzz62ETouuo5jLJfvUMIw0j37Xvc33l1eXIjr38/vFeXt EudP27MEArJ6XzrDl2/0/aghKe7h9rsDAc6/pAaKzm0+W40zlMWqQFrbbj6qFpoUg5u8 mhlA== 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; bh=0pyJsqVNteJRVvriOhWLv+dwIGfl2SgpXXDx+ZgI19g=; b=wKEQjjQjb0j34Ug8f4q2ozVpAS3xOP+5yidtj8A/6Xedk1nTF+X3EZquQIreyMRyY2 jehGpbTmrNMZU79nfMs543LkYKGEcd7T3EsnBmKPGBSl2jsHRjhqQ3cd1zYU+cL8AbLP 42LJ7qO9v0w5jDm+gj8bBEcdakyEhFUaSr1IzaP2KbGcTFT8CdWFXly9rsnrTCzbJ9FR FtFYS/pkqLMG6AZ33BOTLLt5brqVJee8RTmZR1/5uJFiSlFtgaxyX9oC4psvYHF+VT9u JniLrfwTERFNt3inf3AdW64AP/gfpJss+2JDPvVXR+jdd6reiU81lgd5mBvtJrCUtfpo LFyg== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b21-20020aa7c915000000b00419d1d03074si11037909edt.503.2022.03.29.06.56.42; Tue, 29 Mar 2022 06:57:18 -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; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234674AbiC2J1m (ORCPT + 99 others); Tue, 29 Mar 2022 05:27:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232769AbiC2J1k (ORCPT ); Tue, 29 Mar 2022 05:27:40 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C756972D2; Tue, 29 Mar 2022 02:25:58 -0700 (PDT) Received: from kwepemi500003.china.huawei.com (unknown [172.30.72.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4KSPJy2JB2zfZcm; Tue, 29 Mar 2022 17:24:18 +0800 (CST) Received: from kwepemm600009.china.huawei.com (7.193.23.164) by kwepemi500003.china.huawei.com (7.221.188.51) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Tue, 29 Mar 2022 17:25:56 +0800 Received: from huawei.com (10.175.127.227) by kwepemm600009.china.huawei.com (7.193.23.164) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Tue, 29 Mar 2022 17:25:55 +0800 From: Yu Kuai To: , , , CC: , , , Subject: [PATCH -next RFC 0/6] improve large random io for HDD Date: Tue, 29 Mar 2022 17:40:42 +0800 Message-ID: <20220329094048.2107094-1-yukuai3@huawei.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.127.227] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To kwepemm600009.china.huawei.com (7.193.23.164) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE 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 There is a defect for blk-mq compare to blk-sq, specifically split io will end up discontinuous if the device is under high io pressure, while split io will still be continuous in sq, this is because: 1) split bio is issued one by one, if one bio can't get tag, it will go to wail. - patch 2 2) each time 8(or wake batch) requests is done, 8 waiters will be woken up. Thus if a thread is woken up, it will unlikey to get multiple tags. - patch 3,4 3) new io can preempt tag even if there are lots of threads waiting for tags. - patch 5 Test environment: x86 vm, nr_requests is set to 64, queue_depth is set to 32 and max_sectors_kb is set to 128. I haven't tested this patchset on physical machine yet, I'll try later if anyone thinks this approch is meaningful. Fio test cmd: [global] filename=/dev/sda ioengine=libaio direct=1 offset_increment=100m [test] rw=randwrite bs=512k numjobs=256 iodepth=2 Result: raito of sequential io(calculated from log by blktrace) original: 21% patched: split io thoroughly and wake up based on required tags. 40% patched and set flag: disable tag preemption. 69% Yu Kuai (6): blk-mq: add a new flag 'BLK_MQ_F_NO_TAG_PREEMPTION' block: refactor to split bio thoroughly blk-mq: record how many tags are needed for splited bio sbitmap: wake up the number of threads based on required tags blk-mq: don't preempt tag expect for split bios sbitmap: force tag preemption if free tags are sufficient block/bio.c | 2 + block/blk-merge.c | 95 ++++++++++++++++++++++++++++----------- block/blk-mq-debugfs.c | 1 + block/blk-mq-tag.c | 39 +++++++++++----- block/blk-mq.c | 14 +++++- block/blk-mq.h | 7 +++ block/blk.h | 3 +- include/linux/blk-mq.h | 7 ++- include/linux/blk_types.h | 6 +++ include/linux/sbitmap.h | 8 ++++ lib/sbitmap.c | 33 +++++++++++++- 11 files changed, 173 insertions(+), 42 deletions(-) -- 2.31.1