Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp5000733yba; Wed, 8 May 2019 06:27:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqz7uxTR7XRL1mkRp6LhP4pwzx5AVnxANsXJtG1Pdjdk7/boBLH54hFdGtaTqiqOaJTTK+c3 X-Received: by 2002:a17:902:6f17:: with SMTP id w23mr45812014plk.29.1557322046668; Wed, 08 May 2019 06:27:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557322046; cv=none; d=google.com; s=arc-20160816; b=K/1Vv6FXkxAnKs7/B5EDHC37wrHNMlMMMPlGngABBV2E4sE9cTXbtAFVXQ55MQ8+E+ sVW67cm669X9zO/cSXj/fpzgye8KbP0a7GYsLaZgU+Eq71Vn42VJK6dcsozMQx2tgFgu j0JsgR2Dx6BHdhIg8Cm1udKorYYqW/21kqLkNe6ssSUZ4dEstudLhuiB1ALhethlB07U +Cl5AyHxWJkfEh9AC43tVhsx/9jPcsNFvESOR3jcbVI9S6QmY7kgfiR5Nz19RtCEZ51H fDSqXvMc9ixUbrH6mSPwlCvmD9MHl4lRz0kvm8WF5QnK4a5pNooXCr/UnnPjVcvAdkzq Ey7Q== 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; bh=1oy681w87X0gAmbeXPJJbADwvjxu72wvqaRYZcjtGI8=; b=Y8jnaGo7QjicKaSX2dcPtDAyAo9Gwj3elOVNteclBniBhQQm7I8EywTkem3ga9lbCA WyBHmGag+WeYBGrlM1ozVYiSNejcD9vg8NxHoP3MQAbrQUR8KsLqdS4Bp/B93Yx/XgWv MZ3nRWAh/S//q2bguEinpsyyLq8Vsi9buze8DB/rWvz77Ajui2t1/WBwzgMscU77HgdZ Ofn2QuuNPnKG/Xeu3whEzhJg9V2Kb3iHBvJnletwMMCelBhBgZAJ9kiZgnKIkcSgnO// 2VoASVsJ8lFZcelQZd4urmv5Hx2W4xUdB6RGL2sGnCskrB0btze2dKcTCHJ42uhuVOH7 WqRg== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f10si22616887pln.239.2019.05.08.06.27.10; Wed, 08 May 2019 06:27:26 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726980AbfEHMl5 (ORCPT + 99 others); Wed, 8 May 2019 08:41:57 -0400 Received: from foss.arm.com ([217.140.101.70]:33116 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726527AbfEHMl4 (ORCPT ); Wed, 8 May 2019 08:41:56 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 127FB80D; Wed, 8 May 2019 05:41:56 -0700 (PDT) Received: from queper01-lin (queper01-lin.cambridge.arm.com [10.1.195.48]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id AA5703F575; Wed, 8 May 2019 05:41:53 -0700 (PDT) Date: Wed, 8 May 2019 13:41:52 +0100 From: Quentin Perret To: Thara Gopinath Cc: Vincent Guittot , Ingo Molnar , Peter Zijlstra , Zhang Rui , linux-kernel , Amit Kachhap , viresh kumar , Javi Merino , Eduardo Valentin , Daniel Lezcano , Nicolas Dechesne , Bjorn Andersson , Dietmar Eggemann Subject: Re: [PATCH V2 1/3] Calculate Thermal Pressure Message-ID: <20190508090547.4glnypolmiw3cun4@queper01-lin> References: <1555443521-579-1-git-send-email-thara.gopinath@linaro.org> <1555443521-579-2-git-send-email-thara.gopinath@linaro.org> <20190425105658.q45cmfogrt6wwtih@queper01-ThinkPad-T460s> <5CC31314.3070700@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5CC31314.3070700@linaro.org> User-Agent: NeoMutt/20171215 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Thara, Sorry for the delayed response. On Friday 26 Apr 2019 at 10:17:56 (-0400), Thara Gopinath wrote: > On 04/25/2019 08:45 AM, Vincent Guittot wrote: > > Do you mean calling a variant of sched_update_thermal_pressure() in > > update_cpu_capacity() instead of periodic update ? > > Yes , that should be enough > > Hi, > > I do have some concerns in doing this. > 1. Updating thermal pressure does involve some calculations for > accumulating, averaging, decaying etc which in turn could have some > finite and measurable time spent in the function. I am not sure if this > delay will be acceptable for all systems during load balancing (I have > not measured the time involved). We need to decide if this is something > we can live with. > > 2. More importantly, since update can happen from at least two paths ( > thermal fw and periodic timer in case of this patch series)to ensure > mutual exclusion, the update is done under a spin lock. Again calling > from update_cpu_capacity will involve holding the lock in the load > balance path which is possible not for the best. > For me, updating out of load balance minimizes the disruption to > scheduler on the whole. > > But if there is an over whelming support for updating the statistics > from the LB , I can move the code. If I try to clarify my point a little bit, my observation is really that it's a shame to update the thermal stats often, but to not reflect that in capacity_of(). So in fact there are two alternatives: 1) do the update only during LB (which is what I suggested first) to avoid 'useless' work; or 2) reflect the thermal pressure in the CPU capacity every time the thermal stats are updated. And thinking more about it, perhaps 2) is actually a better option? With this we could try smaller decay periods than the LB interval (which is most likely useless otherwise) and make sure the capacity considered during wake-up is up-to-date. This should be a good thing for latency sensitive tasks I think. (If you consider a task in the Android display pipeline for example, it needs to run within 16ms or the frame is missed. So, on wake-up, we'd like to know where the task can run fast _now_, not according to the capacities the CPUs had 200ms ago or so). Thoughts ? Quentin