Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp6931736imm; Tue, 28 Aug 2018 03:41:19 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYSmkhdlv4u2VfLRzuzDvzB2qIOdNAneGbOOwd+5VPepfkn/9FCQuGoWE5hkCva9LA/9mU7 X-Received: by 2002:a62:858c:: with SMTP id m12-v6mr936106pfk.173.1535452879624; Tue, 28 Aug 2018 03:41:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535452879; cv=none; d=google.com; s=arc-20160816; b=do79ooKTOc50wVzDwhfhyBMqtL4RvmRtHI0/4pMk6VDyymo0OIZVWlq/l5VqICUkg1 rUg0ziiraPNHnVwXeGQiUB8joGjyos0gPlN36p+qasUEIDmukZFYKYnbwm3BEElPTvfk R1IRk/rAcZtAwfZhVdC3TjsWsRTba+QAxr6Fn6iNkyYp0T+HL6SPI+hFsn2NO+vTCpwo TVXnEC5Qt/Xrtn1i6fuuRw4WjxWGKuT7JLjxK65yQOfmZ+eCgCWOJUof8tV0VkLk3Fab MX8c/ucc3C9lrOqTbotXCxJmEVWc4u4K8tuGsWI6Va4M9ODL461/zyaIiY0bJCmy27eN E1oQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=c3P0nQEN/uRihpWQ6gHe0VA5sCYadeifU3cvL3kNXnM=; b=JGcrH1vEZPdkBRh5dm20uVr7neaUIoDoXXhQMs2NH0R/3vHivXk8JIpMkBJRL/phPF ehgrepRepk7GBEjIiog7bCtt9sjjtOPoojrOiflKIboUxmEPrX+bwvkEbXO8zC2Hmki0 MY9yW4sCoA8HlKpUlqjaBfO/smHOJcsHU9jhdr76yjvE5u3HAJPhtZ6UZDPAPyTXe8EY lMh9n58HX3z2fOFH/CXnObJq2knRw10VTohpyIyTboDqLGE13wAXrKLy3ymZJ1s3lURR mmfg42qgPGi8pZFZo4/iu1tEn/eHo1jCfm7eSO42CGzDHjLctBUJMlIN1CIgi3UOfedA DbNQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cirrus.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y13-v6si625119pgl.555.2018.08.28.03.41.04; Tue, 28 Aug 2018 03:41:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cirrus.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727800AbeH1Oac (ORCPT + 99 others); Tue, 28 Aug 2018 10:30:32 -0400 Received: from mx0a-001ae601.pphosted.com ([67.231.149.25]:53602 "EHLO mx0b-001ae601.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727172AbeH1Oab (ORCPT ); Tue, 28 Aug 2018 10:30:31 -0400 Received: from pps.filterd (m0077473.ppops.net [127.0.0.1]) by mx0a-001ae601.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w7SAcfaN020001; Tue, 28 Aug 2018 05:39:14 -0500 Authentication-Results: ppops.net; spf=none smtp.mailfrom=ckeepax@opensource.cirrus.com Received: from mail4.cirrus.com ([87.246.98.35]) by mx0a-001ae601.pphosted.com with ESMTP id 2m34h1ukwp-1; Tue, 28 Aug 2018 05:39:14 -0500 Received: from EX17.ad.cirrus.com (unknown [172.20.9.81]) by mail4.cirrus.com (Postfix) with ESMTP id 055E9611C8B3; Tue, 28 Aug 2018 05:41:15 -0500 (CDT) Received: from imbe.wolfsonmicro.main (198.61.95.81) by EX17.ad.cirrus.com (172.20.9.81) with Microsoft SMTP Server id 14.3.408.0; Tue, 28 Aug 2018 11:39:13 +0100 Received: from imbe.wolfsonmicro.main (imbe.wolfsonmicro.main [198.61.95.81]) by imbe.wolfsonmicro.main (8.14.4/8.14.4) with ESMTP id w7SAdBfw012289; Tue, 28 Aug 2018 11:39:11 +0100 Date: Tue, 28 Aug 2018 11:39:11 +0100 From: Charles Keepax To: Jon Hunter CC: Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , , , Subject: Re: [alsa-devel] [PATCH] ASoC: core: Don't schedule DAPM work if already in target state Message-ID: <20180828103911.GX32322@imbe.wolfsonmicro.main> References: <1534520143-29266-1-git-send-email-jonathanh@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <1534520143-29266-1-git-send-email-jonathanh@nvidia.com> User-Agent: Mutt/1.5.20 (2009-12-10) X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1808280110 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 17, 2018 at 04:35:43PM +0100, Jon Hunter wrote: > When dapm_power_widgets() is called, the dapm_pre_sequence_async() and > dapm_post_sequence_async() functions are scheduled for all DAPM contexts > (apart from the card DAPM context) regardless of whether the DAPM > context is already in the desired state. The overhead of this is not > insignificant and the more DAPM contexts there are the more overhead > there is. > > For example, on the Tegra124 Jetson TK1, when profiling the time taken > to execute the dapm_power_widgets() the following times were observed. > > Times for function dapm_power_widgets() are (us): > Min 23, Ave 190, Max 434, Count 39 > > Here 'Count' is the number of times that dapm_power_widgets() has been > called. Please note that the above time were measured using ktime_get() > to log the time on entry and exit from dapm_power_widgets(). So it > should be noted that these times may not be purely the time take to > execute this function if it is preempted. However, after applying this > patch and measuring the time taken to execute dapm_power_widgets() again > a significant improvement is seen as shown below. > > Times for function dapm_power_widgets() are (us): > Min 4, Ave 16, Max 82, Count 39 > > Therefore, optimise the dapm_power_widgets() function by only scheduling > the dapm_pre/post_sequence_async() work if the DAPM context is not in > the desired state. > > Signed-off-by: Jon Hunter > --- Looks ok to me: Reviewed-by: Charles Keepax Although that said the performance increase is pretty hard to measure on my systems. Thanks, Charles