From patchwork Fri Nov 6 15:12:26 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Porzio X-Patchwork-Id: 7569511 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 00A3B9F4F5 for ; Fri, 6 Nov 2015 15:12:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1B1D020721 for ; Fri, 6 Nov 2015 15:12:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1EE5F20715 for ; Fri, 6 Nov 2015 15:12:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752991AbbKFPMi (ORCPT ); Fri, 6 Nov 2015 10:12:38 -0500 Received: from mailout.micron.com ([137.201.242.129]:40028 "EHLO mailout.micron.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752343AbbKFPMi convert rfc822-to-8bit (ORCPT ); Fri, 6 Nov 2015 10:12:38 -0500 Received: from mail.micron.com (bowex36-c.micron.com [137.201.85.143]) by mailout.micron.com (8.14.4/8.14.6) with ESMTP id tA6FCQl6014394 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=FAIL); Fri, 6 Nov 2015 08:12:26 -0700 Received: from BOWEX36-D.micron.com (137.201.85.144) by BOWEX36-C.micron.com (137.201.85.143) with Microsoft SMTP Server (TLS) id 15.0.1104.5; Fri, 6 Nov 2015 08:12:26 -0700 Received: from BOWEX36-D.micron.com ([fe80::4de9:f597:e11f:a945]) by BOWEX36-D.micron.com ([fe80::4de9:f597:e11f:a945%17]) with mapi id 15.00.1104.000; Fri, 6 Nov 2015 08:12:26 -0700 From: "Luca Porzio (lporzio)" To: "linux-mmc@vger.kernel.org" , "Ulf Hansson (ulf.hansson@linaro.org)" CC: "Bruce Ford (bford)" , Alex Lemberg , "jaegeuk@kernel.org" , "anton@tuxera.com" Subject: [RFC PATCH v2] mmc: remove bondage between REQ_META and reliable write Thread-Topic: [RFC PATCH v2] mmc: remove bondage between REQ_META and reliable write Thread-Index: AdEYpIbJCh5J6y+mR8CL2bNNzKpKJw== Date: Fri, 6 Nov 2015 15:12:26 +0000 Message-ID: <02bfbc87a60a46a9a5bc68b96c71ad03@BOWEX36-D.micron.com> Accept-Language: it-IT, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [137.201.90.247] x-mt-checkinternalsenderrule: True MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.73 on 137.201.82.105 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP mmc: remove bondage between REQ_META and reliable write Anytime a write operation is performed with Reliable Write flag enabled, the eMMC device is enforced to bypass the cache and do a write to the underling NVM device by Jedec specification; this causes a performance penalty since write operations cannot be optimized by the device cache. In our tests, we replayed a typical mobile daily trace pattern and found ~9% overall time reduction in trace replay by using this patch. Also the write ops within 4KB~64KB chunk size range get a 40~60% performance improvement by using the patch (as this range of write chunks are the one affected by REQ_META). This patch has been discussed in the Mobile & Embedded Linux Storage Forum and it is the results of feedbacks from many people. We also checked with fsdevl and f2fs mailing list developers that this change in the usage of REQ_META is not affecting FS behavior and we got positive feedbacks on applying this patch. Reporting here the feedbacks: - http://comments.gmane.org/gmane.linux.file-systems/97219 - http://thread.gmane.org/gmane.linux.file-systems.f2fs/3178/focus=3183 Signed-off-by: Bruce Ford Signed-off-by: Luca Porzio --- drivers/mmc/card/block.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c index 4409d79..cba6d5e 100644 --- a/drivers/mmc/card/block.c +++ b/drivers/mmc/card/block.c @@ -62,8 +62,7 @@ MODULE_ALIAS("mmc:block"); #define MMC_SANITIZE_REQ_TIMEOUT 240000 #define MMC_EXTRACT_INDEX_FROM_ARG(x) ((x & 0x00FF0000) >> 16) -#define mmc_req_rel_wr(req) (((req->cmd_flags & REQ_FUA) || \ - (req->cmd_flags & REQ_META)) && \ +#define mmc_req_rel_wr(req) ((req->cmd_flags & REQ_FUA) && \ (rq_data_dir(req) == WRITE)) #define PACKED_CMD_VER 0x01 #define PACKED_CMD_WR 0x02 @@ -1353,13 +1352,9 @@ static void mmc_blk_rw_rq_prep(struct mmc_queue_req *mqrq, /* * Reliable writes are used to implement Forced Unit Access and - * REQ_META accesses, and are supported only on MMCs. - * - * XXX: this really needs a good explanation of why REQ_META - * is treated special. + * are supported only on MMCs. */ - bool do_rel_wr = ((req->cmd_flags & REQ_FUA) || - (req->cmd_flags & REQ_META)) && + bool do_rel_wr = (req->cmd_flags & REQ_FUA) && (rq_data_dir(req) == WRITE) && (md->flags & MMC_BLK_REL_WR);