From patchwork Fri Apr 12 06:47:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li RongQing X-Patchwork-Id: 10897307 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B60601669 for ; Fri, 12 Apr 2019 06:47:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5FBD228E3D for ; Fri, 12 Apr 2019 06:47:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5367F28E49; Fri, 12 Apr 2019 06:47:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B46EE28E3D for ; Fri, 12 Apr 2019 06:47:43 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 6F05A2120ADD4; Thu, 11 Apr 2019 23:47:43 -0700 (PDT) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=61.135.168.56; helo=tc-sys-mailedm05.tc.baidu.com; envelope-from=lirongqing@baidu.com; receiver=linux-nvdimm@lists.01.org Received: from tc-sys-mailedm05.tc.baidu.com (mx56.baidu.com [61.135.168.56]) by ml01.01.org (Postfix) with ESMTP id 9FD7E2120ADCA for ; Thu, 11 Apr 2019 23:47:20 -0700 (PDT) Received: from localhost (cp01-cos-dev01.cp01.baidu.com [10.92.119.46]) by tc-sys-mailedm05.tc.baidu.com (Postfix) with ESMTP id 4396B1EBA008 for ; Fri, 12 Apr 2019 14:47:18 +0800 (CST) From: Li RongQing To: linux-nvdimm@lists.01.org Subject: [PATCH][RFC] nvdimm: pmem: always flush nvdimm for write request Date: Fri, 12 Apr 2019 14:47:18 +0800 Message-Id: <1555051638-32354-1-git-send-email-lirongqing@baidu.com> X-Mailer: git-send-email 1.7.1 X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Virus-Scanned: ClamAV using ClamSMTP flush nvdimm for write request can speed the random write, give about 20% performance The below is result of fio 4k random write nvdimm as /dev/pmem0 Before: Jobs: 32 (f=32): [W(32)][14.2%][w=1884MiB/s][w=482k IOPS][eta 01m:43s] After: Jobs: 32 (f=32): [W(32)][8.3%][w=2378MiB/s][w=609k IOPS][eta 01m:50s] This makes sure that the newly written data is durable too Co-developed-by: Liang ZhiCheng Signed-off-by: Liang ZhiCheng Signed-off-by: Li RongQing --- This test is done on intel AEP drivers/nvdimm/pmem.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/nvdimm/pmem.c b/drivers/nvdimm/pmem.c index 1d432c5ed..9f8f25880 100644 --- a/drivers/nvdimm/pmem.c +++ b/drivers/nvdimm/pmem.c @@ -197,6 +197,7 @@ static blk_qc_t pmem_make_request(struct request_queue *q, struct bio *bio) unsigned long start; struct bio_vec bvec; struct bvec_iter iter; + unsigned int op = bio_op(bio); struct pmem_device *pmem = q->queuedata; struct nd_region *nd_region = to_region(pmem); @@ -206,7 +207,7 @@ static blk_qc_t pmem_make_request(struct request_queue *q, struct bio *bio) do_acct = nd_iostat_start(bio, &start); bio_for_each_segment(bvec, bio, iter) { rc = pmem_do_bvec(pmem, bvec.bv_page, bvec.bv_len, - bvec.bv_offset, bio_op(bio), iter.bi_sector); + bvec.bv_offset, op, iter.bi_sector); if (rc) { bio->bi_status = rc; break; @@ -215,7 +216,7 @@ static blk_qc_t pmem_make_request(struct request_queue *q, struct bio *bio) if (do_acct) nd_iostat_end(bio, start); - if (bio->bi_opf & REQ_FUA) + if (bio->bi_opf & REQ_FUA || op_is_write(op)) nvdimm_flush(nd_region); bio_endio(bio);