Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1720756imm; Mon, 3 Sep 2018 07:47:03 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbgKlbKFGJpDhnnITfz9t8azJBjqyLe6XhhPj4UMtEs54Xi4uOW/uARLyxNjTjedoon/qF9 X-Received: by 2002:a17:902:290a:: with SMTP id g10-v6mr28888701plb.110.1535986023016; Mon, 03 Sep 2018 07:47:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535986022; cv=none; d=google.com; s=arc-20160816; b=EuLMQwqAEFV46Y1Hz6Te/ovKqqbRwqKeIP09LYzK4J92upNu/ekCJcg7Wz9Uv4WHVx UAOexdZNZL5+sRiF/H6zs1czjFOWkaVYtluST/Ad5awXkVejGQtDhXEHOGVk+fFha0DA PfZyycbhVlLzQDvU3RZVGkNgqQv0CXrOd9Q6xfLPHmMqfGM9lP0zvyOopwQTPzy6lCyW huHnInoShN/hrfZ5MabP5cm1ubJaf+GV2A7or0fkS013nsQLEoNxhJ/J6zBbENFFut7E PRXHYcrGZ3bp66q+HpeAi/oJYwrt1BWmtTLsQ/dwlXiuUXWzMkTkELgquPR7aR30CHtw h+5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=gCd9cUGKWZvAKnayX9l07EzTQeLYDlu/cujmPKvYSjA=; b=DGdKetI+BPYXjLKg6blNAfgR2CqVRmQ2/isH66DoB9l+CKqshRD/I16QfYXM8ymBCx ABUKV/HCTCjaEhPXuv171m32d6euYRFvwcR/rX1nv9sHQAw0tEiYlNk90LCb/kdyrOtT osi9AKgW59LkZsLSkWwhQBrCS6RZBOBsoBdK1BGNXp0MHTFTU+Kl3CSo/YPmsVrOvvm4 CJscGO+Q5Zq/h5M9vjZPwETql8/T6YZJ2+Z+UiehNbO3SIxSXeeUnQlIYZhnNqwXh/Te PihTCVFAJVSAelDKI9LEaeMmC71EesfGxkvPUseqq+vNex776WSzqdeWsCXsM13lTXtv hISA== 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=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 194-v6si16805734pge.693.2018.09.03.07.46.47; Mon, 03 Sep 2018 07:47:02 -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=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727024AbeICTGL (ORCPT + 99 others); Mon, 3 Sep 2018 15:06:11 -0400 Received: from hqemgate16.nvidia.com ([216.228.121.65]:6526 "EHLO hqemgate16.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725949AbeICTGL (ORCPT ); Mon, 3 Sep 2018 15:06:11 -0400 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqemgate16.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Mon, 03 Sep 2018 07:45:43 -0700 Received: from HQMAIL101.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Mon, 03 Sep 2018 07:45:42 -0700 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Mon, 03 Sep 2018 07:45:42 -0700 Received: from [10.26.11.205] (172.20.13.39) by HQMAIL101.nvidia.com (172.20.187.10) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Mon, 3 Sep 2018 14:45:39 +0000 Subject: Re: [alsa-devel] [PATCH] ASoC: core: Don't schedule DAPM work if already in target state To: Charles Keepax CC: Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , , , References: <1534520143-29266-1-git-send-email-jonathanh@nvidia.com> <20180828103911.GX32322@imbe.wolfsonmicro.main> From: Jon Hunter Message-ID: <7cb856ee-c9e6-b54b-6d12-37bf4005e5c3@nvidia.com> Date: Mon, 3 Sep 2018 15:45:36 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20180828103911.GX32322@imbe.wolfsonmicro.main> X-Originating-IP: [172.20.13.39] X-ClientProxiedBy: HQMAIL103.nvidia.com (172.20.187.11) To HQMAIL101.nvidia.com (172.20.187.10) Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 28/08/18 11:39, Charles Keepax wrote: > 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. If you can enable the function graph tracer, then you should be again to profile the dapm_power_widgets() function with it as it will give you a time for how long the function took [0]. Cheers Jon [0] https://lwn.net/Articles/370423/ -- nvpublic