Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3766198pxb; Tue, 26 Jan 2021 04:20:46 -0800 (PST) X-Google-Smtp-Source: ABdhPJwR1Fib/c/kPtzIZJoGOUvZ9Ior3bqBgPbQQTY29k/QrgIf9UmB4U9AMpgrHxSNIhOLaHV/ X-Received: by 2002:a17:906:8609:: with SMTP id o9mr3246994ejx.241.1611663645878; Tue, 26 Jan 2021 04:20:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611663645; cv=none; d=google.com; s=arc-20160816; b=EkXvGf4VWq00VXYt8w+peoUuVfhLOFA+NN+CIFbqMP4dkFMQGWM6MgZO7l6G7F0a9g 3DzCqyPWeNAYqEUWH6PWKoT/GJA2mj+YOf6nyRK1DYot4R0VbsT6E0eRHv8wMqLszZNf xxPelkZzjRkyYk1RmaFVhaOR/yrclhMGpGot2e5koOURUGLkQlyn9G+UKQiyGwC62gmx 8l5rbmlI7DEkMgI4UKsC+WNNKzSCjYQi6sEwr+8yINnmibDf1KjIrcEI/yzLUZB9vNgB Z6QtsYJiXhjoTQ49YYcWiSOo5N3BlcnkqCar1V4ovfn6A+vQy9hleaoJtPjWxd+L2lj8 /r8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:cc :references:to:subject; bh=f04XtlC3hScrzBQmi+UPE7n09Ecyf7osecmq3S7E+Dc=; b=SYRYwwLullxlgqIfRl72PhPK1ipB7DjgIq9FUsjnr7Kf7PX9azl6IVouyWdNjphxu2 8nL2SjdWv6VyuUBTojxLICgmPGX3IV1+PL5CEi9wVqToFxl0JmOKKdEzemy4i36dg4Ke T6KpQ6SlllsGSPDXw6fsd/xwdtltlQUg8hsUjZGq/N3S20/cfL1U66sqQ0Ubq0J3RsKJ qKD8BgePoq7uBzTuIpxUiy1lZZ1RSlZtk6qWkNM4fLZGNcgM1SOkjcpiH/5Oc1tdUzPk VX/jfLVJYtws0+o5L2wN976aIZt2NlKvJxmRSpE1Y0DTNoCAhyWkXMsqi6TZB+hSGBIM ri0w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t11si8588181edv.337.2021.01.26.04.20.22; Tue, 26 Jan 2021 04:20:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404929AbhAZLE6 (ORCPT + 99 others); Tue, 26 Jan 2021 06:04:58 -0500 Received: from mx2.suse.de ([195.135.220.15]:45500 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726822AbhAZEe5 (ORCPT ); Mon, 25 Jan 2021 23:34:57 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 3948AAD78; Tue, 26 Jan 2021 04:34:15 +0000 (UTC) Subject: Re: [PATCH] bcache: dont reset bio opf in bch_data_insert_start To: Dongsheng Yang References: <20210125042942.1087170-1-dongsheng.yang@easystack.cn> <7569abf3-3e54-986e-8307-751fa5e00828@suse.de> <17578d50-4113-8f25-827e-840fafb09d6f@easystack.cn> Cc: linux-bcache@vger.kernel.org, linux-kernel@vger.kernel.org, mchristi@redhat.com From: Coly Li Message-ID: <92c66f2d-22af-abd7-6fcb-ad896185c0c6@suse.de> Date: Tue, 26 Jan 2021 12:34:12 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:78.0) Gecko/20100101 Thunderbird/78.6.1 MIME-Version: 1.0 In-Reply-To: <17578d50-4113-8f25-827e-840fafb09d6f@easystack.cn> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 1/26/21 12:32 PM, Dongsheng Yang wrote: > > 在 2021/1/25 星期一 下午 12:53, Coly Li 写道: >> On 1/25/21 12:29 PM, Dongsheng Yang wrote: >>> commit ad0d9e76(bcache: use bio op accessors) makes the bi_opf >>> modified by bio_set_op_attrs(). But there is a logical >>> problem in this commit: >>> >>>                  trace_bcache_cache_insert(k); >>>                  bch_keylist_push(&op->insert_keys); >>> >>> -               n->bi_rw |= REQ_WRITE; >>> +               bio_set_op_attrs(n, REQ_OP_WRITE, 0); >>>                  bch_submit_bbio(n, op->c, k, 0); >>>          } while (n != bio); >>> >>> The old code add REQ_WRITE into bio n and keep other flags; the >>> new code set REQ_OP_WRITE to bi_opf, but reset all other flags. >>> >>> This problem is discoverd in our performance testing: >>> (1) start a fio with 1M x 128depth for read in /dev/nvme0n1p1 >>> (2) start a fio with 1M x 128depth for write in /dev/escache0 (cache >>> device is /dev/nvme0n1p2) >>> >>> We found the BW of reading is 2000+M/s, but the BW of writing is >>> 0-100M/s. After some debugging, we found the problem is io submit in >>> writting is very slow. >>> >>> bch_data_insert_start() insert a bio to /dev/nvme0n1p1, but as >>> cached_dev submit stack bio will be added into current->bio_list, and >>> return.Then __submit_bio_noacct() will submit the new bio in bio_list >>> into /dev/nvme0n1p1. This operation would be slow in >>> blk_mq_submit_bio() -> rq_qos_throttle(q, bio); >>> >>> The rq_qos_throttle() will call wbt_should_throttle(), >>> static inline bool wbt_should_throttle(struct rq_wb *rwb, struct bio >>> *bio) >>> { >>>          switch (bio_op(bio)) { >>>          case REQ_OP_WRITE: >>>                  /* >>>                   * Don't throttle WRITE_ODIRECT >>>                   */ >>>                  if ((bio->bi_opf & (REQ_SYNC | REQ_IDLE)) == >>>                      (REQ_SYNC | REQ_IDLE)) >>>                          return false; >>> ... ... >>> } >>> >>> As the bio_set_op_attrs() reset the (REQ_SYNC | REQ_IDLE), so this write >>> bio will be considered as non-direct write. >>> >>> After this fix, bio to nvme will flaged as (REQ_SYNC | REQ_IDLE), >>> then fio for writing will get about 1000M/s bandwidth. >>> >>> Fixes: ad0d9e76a4124708dddd00c04fc4b56fc86c02d6 >> It should be, >> Fixes: ad0d9e76a412 ("bcache: use bio op accessors") >> >>> Signed-off-by: Dongsheng Yang >> Please CC the fixed patch author  Mike Christie. > > > Hi Coly, > >     Should I send a V2 for commit message update? > > Or you can help to fix it when you take it from maillist? > Yes, please fix it in v2 version. And let's wait for response from Mike, maybe he has better suggestion to fix. Thanks. Coly Li