From patchwork Fri Jul 10 10:51:43 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Nie X-Patchwork-Id: 6765031 Return-Path: X-Original-To: patchwork-dmaengine@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 1A819C05AC for ; Fri, 10 Jul 2015 10:52:05 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2E1A0207AD for ; Fri, 10 Jul 2015 10:52:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 45A31207A8 for ; Fri, 10 Jul 2015 10:52:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753637AbbGJKwC (ORCPT ); Fri, 10 Jul 2015 06:52:02 -0400 Received: from mail-pa0-f51.google.com ([209.85.220.51]:36545 "EHLO mail-pa0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753380AbbGJKwB (ORCPT ); Fri, 10 Jul 2015 06:52:01 -0400 Received: by pacgz10 with SMTP id gz10so93446245pac.3 for ; Fri, 10 Jul 2015 03:52:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=Y1NOUb49QVXd2WwkIsne9A02y2zTm2mgdmM1g0kvtiA=; b=ZeROJcUxNsV834W7Du4UfyRm4ue3Q9CFzQymVyihUgtOpjG+L5NRJqRskUNEVySmBH 2eissDnirYfuP+Ow4nGTlrl1aJhmLTF7HkTvTQyVyv4+DM3ftPbPZYbtbq8hvITQ0AtW gnFiM2Or2u57ny7qAHFfguS+rlosd3mGyLDGSS/ZstUg3iF0attWI3Z5ZxfbNj2+zdQb K64Oi6yU8Eb6n2vnIife3JxZXdTVLbUGXPHMS47GdStjMlnq41A6+8qpQO2ZiMDTRGtx aUnySlWz5ws90ff70tI0Fn8k08PH/UUV5rkpP3P/3F1jYmafjrJT/J8RjIqtw0NnZ65N i2bQ== X-Gm-Message-State: ALoCoQm4xvD+5+t65etfXq37tZeSS/l4UyvytQTD4bLFTw8JQzB+8/6cV+bx55V7TXcD7hXjZCDQ X-Received: by 10.68.142.42 with SMTP id rt10mr40697889pbb.27.1436525520957; Fri, 10 Jul 2015 03:52:00 -0700 (PDT) Received: from localhost.localdomain ([107.6.117.179]) by smtp.gmail.com with ESMTPSA id k9sm9122437pdp.60.2015.07.10.03.51.53 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 10 Jul 2015 03:51:59 -0700 (PDT) From: Jun Nie To: robert.jarzmik@free.fr, vinod.koul@intel.com, dmaengine@vger.kernel.org Cc: shawn.guo@linaro.org, wan.zhijun@zte.com.cn, Jun Nie Subject: [PATCH] dmaengine: free descriptor when free chan resource Date: Fri, 10 Jul 2015 18:51:43 +0800 Message-Id: <1436525503-26091-1-git-send-email-jun.nie@linaro.org> X-Mailer: git-send-email 1.9.1 Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 Free descriptor when free chan resource as some device, such as soc soc-generic-dmaengine-pcm.c in audio side, may not release channel. This cause too much memory is cached for descriptor is not released. Signed-off-by: Jun Nie --- drivers/dma/virt-dma.c | 11 ++++------- drivers/dma/virt-dma.h | 3 --- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/drivers/dma/virt-dma.c b/drivers/dma/virt-dma.c index 7d2c17d..71bc1e4 100644 --- a/drivers/dma/virt-dma.c +++ b/drivers/dma/virt-dma.c @@ -98,13 +98,10 @@ void vchan_dma_desc_free_list(struct virt_dma_chan *vc, struct list_head *head) while (!list_empty(head)) { struct virt_dma_desc *vd = list_first_entry(head, struct virt_dma_desc, node); - if (async_tx_test_ack(&vd->tx)) { - list_move_tail(&vd->node, &vc->desc_allocated); - } else { - dev_dbg(vc->chan.device->dev, "txd %p: freeing\n", vd); - list_del(&vd->node); - vc->desc_free(vd); - } + list_move_tail(&vd->node, &vc->desc_allocated); + dev_dbg(vc->chan.device->dev, "txd %p: freeing\n", vd); + list_del(&vd->node); + vc->desc_free(vd); } } EXPORT_SYMBOL_GPL(vchan_dma_desc_free_list); diff --git a/drivers/dma/virt-dma.h b/drivers/dma/virt-dma.h index 189e75d..e8b54f7 100644 --- a/drivers/dma/virt-dma.h +++ b/drivers/dma/virt-dma.h @@ -149,14 +149,11 @@ static inline void vchan_get_all_descriptors(struct virt_dma_chan *vc, static inline void vchan_free_chan_resources(struct virt_dma_chan *vc) { - struct virt_dma_desc *vd; unsigned long flags; LIST_HEAD(head); spin_lock_irqsave(&vc->lock, flags); vchan_get_all_descriptors(vc, &head); - list_for_each_entry(vd, &head, node) - async_tx_clear_ack(&vd->tx); spin_unlock_irqrestore(&vc->lock, flags); vchan_dma_desc_free_list(vc, &head);