Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3890496pxb; Mon, 1 Feb 2021 07:16:34 -0800 (PST) X-Google-Smtp-Source: ABdhPJwndY+3Q81uEJC0kj6SC1J/jKygnySLG0jQiP9BFp6m3tb1n4d4iMMDJ3vXwG9n5XuRRgxr X-Received: by 2002:aa7:d995:: with SMTP id u21mr3268318eds.282.1612192593691; Mon, 01 Feb 2021 07:16:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612192593; cv=none; d=google.com; s=arc-20160816; b=btOSmllEM4fUy18o2f1KUzZdJH2EF4cbxoNOmXuXWk0x10+w3MhUFsC+3V39sUGGBM b4x+c5rO9TZtJnwQZeyYVjR7QxT+D2LqyK6iAWbrCJWuKyWbz2Lz6AbZ0Cfvu66Fi3SE aOcKk2ic9ojwX8PQlNFDOYIuUUoVtdHtwub9A3sl75MTdsfiIDhpPK6GkpDdCPoT9TW1 GMfYFAkhBxlchuaOyOd6Tdo8gl/4zy0K67WNnl3KkPKOZlaYxX4BUVcfCtTzb2U3CGlz vhxlyU+LlGox/Yvzq1namTajL/oMDob116Li64lJqOl7xW1sY+X719JXeox/LVhyyQ4I a5Gw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=FgslTxds/ErDnP5BxjhdWc4Y/zI1rQSLsCH8OSVs/js=; b=jd+7/LGpnXYEE2ltb/CRQNShsSYG2U4XuTylOzywKdlNG2Um5inFL9niX1c6gHc1/P ud0tNXoaTdruZpwFdYvA3WvnCRhaT82Ju8GlzD/CzVqelQssY5Y9GcsPRdAeTG0+tzOu G4B2hwAnlf9GvzH1rh/dd0kgi2IJpQG7MgQkHwbBlAjRvG+pJJhHW3ae/FXJuNERGWxr xmjT2xOV1FxWguI5hfqaZsUSpcym7qnoh9uWIp2z+exLD0GFvGii8rZ8TGuIRGMQY84A BwDcOVQdv3tll/V8AhjkH5xjUko1yYAN5Z2CE4W5beXV991rGDVoQjL+hI0aP99hBjeQ IK/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=F8+Wzz2g; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bf17si11727076edb.76.2021.02.01.07.16.04; Mon, 01 Feb 2021 07:16:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=F8+Wzz2g; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231499AbhBAPPY (ORCPT + 99 others); Mon, 1 Feb 2021 10:15:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231376AbhBAPPB (ORCPT ); Mon, 1 Feb 2021 10:15:01 -0500 Received: from mail-io1-xd2c.google.com (mail-io1-xd2c.google.com [IPv6:2607:f8b0:4864:20::d2c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1CBACC0617A9 for ; Mon, 1 Feb 2021 07:14:06 -0800 (PST) Received: by mail-io1-xd2c.google.com with SMTP id e133so6851033iof.8 for ; Mon, 01 Feb 2021 07:14:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=FgslTxds/ErDnP5BxjhdWc4Y/zI1rQSLsCH8OSVs/js=; b=F8+Wzz2g4PiiLG9HpRjoBGzi6RD+31RRCKLXg5wsXlRjLRH9SDlEJjhOCvUBEPgwNm ZsrX7dXY6q3OI4q0hCgK1XP7AbxsI4R2VYVEBv6QIU7NbvTjkFiKkNm3xnURKunLh15q IGPfavdag/+USzEzZ48NUSigqDqQvCt9DBOmw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=FgslTxds/ErDnP5BxjhdWc4Y/zI1rQSLsCH8OSVs/js=; b=M3xv03zaFavMMPO5cvxp3ENUemB8/Rmg8mv4pbl7SzKXqH5GM/fVoNmWx3gLvP57XE LIqkjU+E0sMvdkOhaZO7+5SGciO2uAU/4+NuV7tcfUJJWG4G70A2dHdCNrMRONGmqLSr TI4zh84jEyBd6epIfPk39T+2t9jxdml+EfqIhjz74nMfsvFhbspMKTGsonwvNcoFd3vA CMOjU35YOfM/Ktj+GPHg1cGl1oVJQUpMsIzujUKworWjU2BsAJgidP5ilJnkTLipQ57a D2sOCM6z9jYRhHMxk64ChrIdGQpB9qpLgEEGqCpFqRq5BBPb9M462lebtnxv/OT8pkjm /PqQ== X-Gm-Message-State: AOAM530pchBo/RGIDKvgE5yHMy1xLOXGXNyXSRmtv4ooJUMKwBqf798Q 5VdsI0vQucDjEpdY7s3KZNWwlGGdN20BFV1+K9oQlg== X-Received: by 2002:a05:6638:12d3:: with SMTP id v19mr15354182jas.42.1612192445458; Mon, 01 Feb 2021 07:14:05 -0800 (PST) MIME-Version: 1.0 References: <20210122154600.1722680-1-joel@joelfernandes.org> In-Reply-To: From: Joel Fernandes Date: Mon, 1 Feb 2021 10:13:54 -0500 Message-ID: Subject: Re: [PATCH] sched/fair: Rate limit calls to update_blocked_averages() for NOHZ To: Vincent Guittot Cc: linux-kernel , Paul McKenney , Frederic Weisbecker , Dietmar Eggeman , Qais Yousef , Ben Segall , Daniel Bristot de Oliveira , Ingo Molnar , Juri Lelli , Mel Gorman , Peter Zijlstra , Steven Rostedt , "Uladzislau Rezki (Sony)" , Neeraj upadhyay Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 29, 2021 at 5:33 AM Vincent Guittot wrote: [...] > > > > > So why is it a problem for you ? You are mentioning newly idle load > > > > > balance so I assume that your root problem is the scheduling delay > > > > > generated by the newly idle load balance which then calls > > > > > update_blocked_averages > > > > > > > > Yes, the new idle balance is when I see it happen quite often. I do see it > > > > happen with other load balance as well, but it not that often as those LB > > > > don't run as often as new idle balance. > > > > > > The update of average blocked load has been added in newidle_balance > > > to take advantage of the cpu becoming idle but it seems to create a > > > long preempt off sequence. I 'm going to prepare a patch to move it > > > out the schedule path. > > > > Ok thanks, that would really help! > > > > > > > rate limiting the call to update_blocked_averages() will only reduce > > > > > the number of time it happens but it will not prevent it to happen. > > > > > > > > Sure, but soft real-time issue can tolerate if the issue does not happen very > > > > often. In this case though, it is frequent. > > > > > > Could you provide details of the problem that you are facing ? It's > > > not clear for me what happens in your case at the end. Have you got an > > > audio glitch as an example? > > > > > > "Not often" doesn't really give any clue. > > > > I believe from my side I have provided details. I shared output from a > > function graph tracer and schbench micro benchmark clearly showing the > > issue and improvements. Sorry, I don't have a real-world reproducer > > In fact I disagree and I'm not sure that your results show the right > problem but just a side effect related to your system. > > With schbench -t 2 -m 2 -r 5, the test runs 1 task per CPU and newidle > balance should never be triggered because tasks will get an idle cpus > everytime. When I run schbench -t 3 -m 2 -r 5 (in order to get 8 > threads on my 8 cpus system), all threads directly wake up on an idle > cpu and newidle balance is never involved. > As a result, the schbench > results are not impacted by newidle_balance whatever its duration. I disagree. Here you are assuming that schbench is the only task running on the system. There are other processes, daemons as well. I see a strong correlation between commenting out update_blocked_averages() and not seeing the latency hit at the higher percentiles. > This means that a problem in newidle_balance doesn't impact schbench > results with a correct task placement. This also means that in your > case, some threads are placed on the same cpu and wait to be scheduled > and finally a lot of things can generate the increased delay.... If > you look at your results for schbench -t 2 -m 2 -r 5: The *99.0th: > 12656 (8 samples) shows a delayed of around 12ms which is the typical > running time slice of a task when several tasks are fighting for the > same cpu and one has to wait. So this results does not reflect the > duration of newidle balance but instead that the task placement was > wrong and one task has to wait before running. Your RFC patch probably > changes the dynamic and as a result the task placement but it does not > save 12ms and is irrelevant regarding the problem that you raised > about the duration of update_blocked_load. > If I run schbench -t 3 -m 2 -r 5 on a dragonboard 845 (4 little, 4 > big) with schedutil and EAS enabled: > /home/linaro/Bin/schbench -t 3 -m 2 -r 5 > Latency percentiles (usec) runtime 5 (s) (318 total samples) > 50.0th: 315 (159 samples) > 75.0th: 735 (80 samples) > 90.0th: 773 (48 samples) > 95.0th: 845 (16 samples) > *99.0th: 12336 (12 samples) > 99.5th: 15408 (2 samples) > 99.9th: 17504 (1 samples) > min=4, max=17473 Sure, there could be a different problem causing these higher percentile latencies on your device. I still think 12ms is awful. > I have similar results and a quick look at the trace shows that 2 > tasks are fighting for the same cpu whereas there are idle cpus. Then > If I use another cpufreq governor than schedutil like ondemand as an > example, the EAS is disabled and the results becomes: > /home/linaro/Bin/schbench -t 3 -m 2 -r 5 > Latency percentiles (usec) runtime 5 (s) (318 total samples) > 50.0th: 232 (159 samples) > 75.0th: 268 (80 samples) > 90.0th: 292 (49 samples) > 95.0th: 307 (15 samples) > *99.0th: 394 (12 samples) > 99.5th: 397 (2 samples) > 99.9th: 400 (1 samples) > min=114, max=400 Yes, definitely changing the governor also solves the problem (like for example if performance governor is used). The problem happens at low frequencies. > So a quick and wrong conclusion could be to say that you should disable EAS ;-) Sure, except the power management guys may come after me ;-) [..] > The only point that I agree with, is that running > update_blocked_averages with preempt and irq off is not a good thing > because we don't manage the number of csf_rq to update and I'm going > to provide a patchset for this That's fine, as long as we agree on this problem ;-) Thanks for providing the patches and I will try them once they are ready. > > for this. > > > > > Also update_blocked_averages was supposed called in newlyidle_balance > > > when the coming idle duration is expected to be long enough > > > > No, we do not want the schedule loop to take half a millisecond. > > keep in mind that you are scaling frequency so everything takes time > at lowest frequency/capacity ... Agreed, I was also thinking the same. But that doesn't change the fact that there is room for improvement and I'm grateful to you for trying to improve it! thanks, - Joel