From patchwork Mon May 30 00:41:48 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 9140027 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7EA0A60755 for ; Mon, 30 May 2016 00:41:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6EA5021BED for ; Mon, 30 May 2016 00:41:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6303528185; Mon, 30 May 2016 00:41:56 +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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CF8F021BED for ; Mon, 30 May 2016 00:41:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161040AbcE3Alz (ORCPT ); Sun, 29 May 2016 20:41:55 -0400 Received: from relmlor3.renesas.com ([210.160.252.173]:29815 "EHLO relmlie2.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1161015AbcE3Alx (ORCPT ); Sun, 29 May 2016 20:41:53 -0400 Received: from unknown (HELO relmlir4.idc.renesas.com) ([10.200.68.154]) by relmlie2.idc.renesas.com with ESMTP; 30 May 2016 09:41:51 +0900 Received: from relmlac3.idc.renesas.com (relmlac3.idc.renesas.com [10.200.69.23]) by relmlir4.idc.renesas.com (Postfix) with ESMTP id 87B0F4C793; Mon, 30 May 2016 09:41:51 +0900 (JST) Received: by relmlac3.idc.renesas.com (Postfix, from userid 0) id 687CC1806F; Mon, 30 May 2016 09:41:51 +0900 (JST) Received: from relmlac3.idc.renesas.com (localhost [127.0.0.1]) by relmlac3.idc.renesas.com (Postfix) with ESMTP id 54EBA1800A; Mon, 30 May 2016 09:41:51 +0900 (JST) Received: from relmlii2.idc.renesas.com [10.200.68.66] by relmlac3.idc.renesas.com with ESMTP id KAD03746; Mon, 30 May 2016 09:41:51 +0900 X-IronPort-AV: E=Sophos;i="5.22,559,1449500400"; d="scan'";a="212318293" Received: from mail-hk2apc01lp0215.outbound.protection.outlook.com (HELO APC01-HK2-obe.outbound.protection.outlook.com) ([65.55.88.215]) by relmlii2.idc.renesas.com with ESMTP/TLS/AES256-SHA; 30 May 2016 09:41:50 +0900 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=renesasgroup.onmicrosoft.com; s=selector1-renesas-com; h=From:To:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=6Fkg7sUC3vHNAht54WXrnzfDvSMI2P01KGIbbrnXuTQ=; b=V/UMHTtu209+brG3iy4UxEh6eWiOCI9mdOtlz9+wfLtNTErb0Zy9voW92FfGwVIdtU0JMVDnBaBPG73k64NvJbGNJfZ2U1ABDIzfZUilGJJD3TODL5LJ2kz2aNkeclOZ0i/1xdujW0LhBmnmq2Rjp0eGSF1H72q3+78pGL+l3ok= Authentication-Results: intel.com; dkim=none (message not signed) header.d=none; intel.com; dmarc=none action=none header.from=renesas.com; Received: from morimoto-PC.renesas.com (211.11.155.144) by KL1PR06MB1701.apcprd06.prod.outlook.com (10.167.63.15) with Microsoft SMTP Server (TLS) id 15.1.501.7; Mon, 30 May 2016 00:41:48 +0000 Message-ID: <877fecbcxh.wl%kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v2] dma: rcar-dmac: use list_add() on rcar_dmac_desc_put() User-Agent: Wanderlust/2.15.9 Emacs/24.3 Mule/6.0 To: Vinod Koul , Geert Uytterhoeven , Laurent Pinchart CC: , sakato , , OSD2 ML In-Reply-To: <1645988.6VIRltF7C5@avalon> References: <8760w7xq3n.wl%kuninori.morimoto.gx@renesas.com> <874mbrxnft.wl%kuninori.morimoto.gx@renesas.com> <1645988.6VIRltF7C5@avalon> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Date: Mon, 30 May 2016 00:41:48 +0000 X-Originating-IP: [211.11.155.144] X-ClientProxiedBy: OS1PR01CA0004.jpnprd01.prod.outlook.com (10.161.225.142) To KL1PR06MB1701.apcprd06.prod.outlook.com (10.167.63.15) X-MS-Office365-Filtering-Correlation-Id: 3f9f1217-42b5-4f8b-3cdd-08d388232f89 X-Microsoft-Exchange-Diagnostics: 1; KL1PR06MB1701; 2:bGWzI6GMwtz6rQh3ur4UqfCUAOPrqY+zwKIJjpIY/DSXF/DZFQx8h1svp3GauYVZATu39bhxVll7KtONOq+jG3+B4s9PHL67Mj/rCEfohCbFSdgMNu/qRyrestp3kV0QCrLy6+M1OSbmtvLf+3Urg0JuRNAGsX3yEBPVYKu4jERr+Ye+IMTGNKBKz8z5zEir; 3:FwSr8LbGEH5xV1jy7k1TYGQyKMLBq05rUA9/OHp5nNBbeb2+YQylBWcjooIr2qjAiBCdwmfbvS401MPkGbgxlVndqP7jlBvrnSIiqHrWT2cYs/kf37urP6k//tbtZxRB; 25:ySUXi74r9mm5Rmn/7C6cPW2Q1jCjtPh7LkkCEDd4yNyzVyCsJCRfuwb9pbrfU+ie8Ju67DiyHHGiwPWU90ZJgU893XguFv0sMAZ1yAxZYYzK/mHnQtkLM9ou8bIrsXcv/oSxTIEOTl6kt3EMpCZqsN1np3T7++H5UMRDf2PsUH0MXdhUCoF7GDQ+22pTYxUjZ68Lc0SU1DYfZYA72GNLmnTFkx2jdNA+4R1e7+F+VAJQNEfH1u1Auu6OFQFkUSsP8UJ89RDpEVj+6K5ZRsCZqFIN29FxGgtknCgjt4OCW28rsP0CoXggehpwDjL5PMBhIVT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KakR8iFdQJuaLoj+a24c9gudj7rCATRHy6syWpD0Djsll2tODQ== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001)(6055026); SRVR:KL1PR06MB1701; BCL:0; PCL:0; RULEID:; SRVR:KL1PR06MB1701; X-Forefront-PRVS: 09583628E0 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6009001)(19580405001)(6116002)(5008740100001)(92566002)(19580395003)(3846002)(47776003)(586003)(5001770100001)(4001350100001)(93886004)(42186005)(23726003)(77096005)(81166006)(8676002)(107886002)(66066001)(4326007)(46406003)(2906002)(5004730100002)(86362001)(189998001)(83506001)(4001430100002)(50986999)(54356999)(76176999)(53416004)(33646002)(2950100001)(36756003)(229853001); DIR:OUT; SFP:1102; SCL:1; SRVR:KL1PR06MB1701; H:morimoto-PC.renesas.com; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; KL1PR06MB1701; 23:B5TG379AKmZClksN65sEl9eNBWLM8kjugSVt738Ko?= =?us-ascii?Q?GMkq5KFbY0mt4vakozkmx/P9g+4s5Xdl9BoExY8id5uBC9x/rbpPKkAzWGa3?= =?us-ascii?Q?724AenOmrX8QL+avf64qdBPfSWNfVbKvqcC53n+8wK5zr0rApBSicub2ioYn?= =?us-ascii?Q?96wV5jrnTg+UdQ+RhiseWxIlxB/7EnQ/+JPEXe8bi1QS6cuPqe2e9MQW9Rn7?= =?us-ascii?Q?5jw/GpTN/K0I+HMeIts2USUyBPlFcEXE4XgE1tcEvWtYb6SMO5Z+5d/E05UT?= =?us-ascii?Q?qRVYrHIg6j9zMm6hZBTlygjur2iTmQoyBLoBAzlalHIVmRxwnO1LPjDD2NJF?= =?us-ascii?Q?MP2XRNromuomoR9jeSJaKvzvBk1y5gD9O6BpcOBjQomAi5WYRgh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TSZ9ZwDDfhIxRTgMWz9Sex27cohhMzx+oQosCBBhTZ/RvKC/NH3Ki16ymlwLzKKEagr7r0GrGvLwCsjHshBzyog84fnPtEKf2d4vD69dJ+pE9MRQn+R6RXs7O1L+NKQbFRg4ex5cGCNY5HfAF1dy0MBBPJ2BMGQIKZbMWYcpQgA9IjYb6oYwuiLI/; 20:qECscHYSIOoSH6dkKkSeR09oPcqqZOGlbym128iu6hCSxn/+HUU7o+6XH5dR3gveTP3hGgAwCuzkKOuJ6n6ix6CfgybPg5zk1NkYlZP5MqlMpmgHwWUOvoMvEeu07VVzBWLBSyXOdyVZFn6hr2PC4DtPU8HzxPU9OduezLPzLTM= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 May 2016 00:41:48.1180 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: KL1PR06MB1701 Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Kuninori Morimoto For each descriptor, in addition to the memory used by the descriptors structure itself, the driver allocates a list of chunks as well as a buffer for hardware descriptors. Descriptors themselves are preallocated, and allocation of the chunks and buffer is performed the first time the descriptor is used. The memory isn't freed when the transfer is completed, as the chunks and buffer will be needed again when the descriptor is reused internally, so the driver keeps the memory around. If only a few descriptors are used concurrently, the current list_add_tail() implementation will result in all preallocated descriptors being used before going back to the first one, and will thus allocate chunks and a buffer for all preallocated descriptors. Using list_add() will put the complete descriptor at the head of the list of available descriptors, so the next transfer will be more likely to reuse a descriptor that already has associated memory instead of one that has never been used before. Signed-off-by: Kuninori Morimoto --- v1 -> v2 - used Laurent's explain on log drivers/dma/sh/rcar-dmac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/dma/sh/rcar-dmac.c b/drivers/dma/sh/rcar-dmac.c index 02b86c6..616c63a 100644 --- a/drivers/dma/sh/rcar-dmac.c +++ b/drivers/dma/sh/rcar-dmac.c @@ -519,7 +519,7 @@ static void rcar_dmac_desc_put(struct rcar_dmac_chan *chan, spin_lock_irqsave(&chan->lock, flags); list_splice_tail_init(&desc->chunks, &chan->desc.chunks_free); - list_add_tail(&desc->node, &chan->desc.free); + list_add(&desc->node, &chan->desc.free); spin_unlock_irqrestore(&chan->lock, flags); }