Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp697979yba; Fri, 26 Apr 2019 07:20:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqxA12O+uBoehHgv+YRopCQi1IhKlIqbLorKmDtwl22QfFHdjQaXQpBkLeb+OsKgc4E9/V88 X-Received: by 2002:a17:902:581:: with SMTP id f1mr46508676plf.304.1556288446783; Fri, 26 Apr 2019 07:20:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556288446; cv=none; d=google.com; s=arc-20160816; b=s7QKv6heWHze41Xv3uS1lNYvwMjySrYTqKCckvyfYBhseJqhjeybc+ifgZ+0tscs0p k6Kwj7f1vHFLoY1+Uv9+abfGu849SQSTHi/0zKq1yWqeGO7JSPWaTIVAnPLByJld1xCV 7EtvmMZTgh6f70bXFHd9IzZNd0u3fp46HOlnKa3IWEIHir17HWZUR8j68yfM9LFb2HD8 /zO96qyV6IbihNT2Y3X13L0g6Lf5WAa3n27QinZRh9+nJHKoMuEs5jvsCNa/bvnBZcZ0 rgOqGdTrriYWuc/toAZRTRHdQlHQvq+Ege3DvehHIAHEioXVRTLqYFZTkmYZbfKcWQBQ ZulQ== 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:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject:dkim-signature; bh=/hDwCGeeSguyBKj4Fp15XEiI0c2OmnUXshUEZiKjvic=; b=1LLE1DDC3pGSnrWWuHrcTbVAfAhQXn+PKZu7uGbvfmjm+9Sb3f34uNDcWlWsp1Oen5 nWGi5upcloySmaQTxXrXQPdMOOLT3UyYQ8pV1HKVVFIAyM/RI4FHOdzdoDBNzjOjptxs Df5vWadz60cyKr4WkQ1XI5ZUXHjVoyZzcfh/mrumnJNkIK2qR4jw/0fG3ZgL0xOp+mBn IX5MCj0kHpAmK9WIBbEYHLb8itTK3PdgdUPYTJwvWOzFg9OoePlguwdR42RoAq4MytYj Xw0OsVP9fZZpj9lICUkbNhXmdZrVqoC/zP3XC/GNUh8OPpRAIpV8tQleHS4yXH5Fl6j6 CizA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nOcUFrVm; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b9si26219943pla.275.2019.04.26.07.20.30; Fri, 26 Apr 2019 07:20:46 -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; dkim=pass header.i=@linaro.org header.s=google header.b=nOcUFrVm; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726380AbfDZOSC (ORCPT + 99 others); Fri, 26 Apr 2019 10:18:02 -0400 Received: from mail-qk1-f194.google.com ([209.85.222.194]:46882 "EHLO mail-qk1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726060AbfDZOSB (ORCPT ); Fri, 26 Apr 2019 10:18:01 -0400 Received: by mail-qk1-f194.google.com with SMTP id w73so1923659qkb.13 for ; Fri, 26 Apr 2019 07:18:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=/hDwCGeeSguyBKj4Fp15XEiI0c2OmnUXshUEZiKjvic=; b=nOcUFrVmoBLtELYzn19gqpgdL6lqd8/zxeKcMCG1KnyGpuT0cc7bXXIJRFvat5kLO9 f82RD08wKFZLqnVZAhZejfooWAFVin8j4WGV+5qyQWjuTFmG/xOJbeYaY2oez7wIoe/N FlJjk5fB/VglDc0MuP2dB2iNLcq5OPJ3umIOgiG4ogTAStjwNmaDwwxJsUH9Gq/MUbVk vF0OVgTSaKpbztlK3BCtfACRcBoxJi/cZuhLJw5yAZyGIyb+tRItws7/6kLOZxpPAQZ2 cDXwP06ulnFNJmvkbwnNPC3v0BgROCJM+ouPNzyMqA/WI+DpmsHLZRYW+1JmsvuyqrVa 7nRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=/hDwCGeeSguyBKj4Fp15XEiI0c2OmnUXshUEZiKjvic=; b=Vt0iZjgJ4ldYcpyHSRjNbj/Sl1TDQvRQ2D2pRUhsBLzOeAYM2gipKpx55iGZRIPqZC 0sD5hADSzYUgSpGhpZ7fGCu9zQToIYSeeLHgo2JVlbMsvZfY1bbQTVyqw8hmEO/paZN6 zioWvJIhw27s/HzheKG/Eg//c1/Vtj73vkwcnkPSOW1PzHcyQf7jSABC7uRcC8I1a8IR RTC8YMDrolob8afzVWOvhqgT8tEqXacHksLZreNlsCyrGW07HwUT8puUSLsCtdjeTQHu 3j1frfQuJTkOWVEvMo07O2hFqQ7NJhpT4/35Lxdi0B0GUMDTnEgdhkKnxdEtmnK/VytF SYRg== X-Gm-Message-State: APjAAAVbRHPGe9PA232YYoc0jFReHJzMu70MNEc64SsdCKU/6jjc2Jf+ YK8o+mBM/ZvPheWjB5xrpLmZhA== X-Received: by 2002:a37:4388:: with SMTP id q130mr34675157qka.62.1556288280358; Fri, 26 Apr 2019 07:18:00 -0700 (PDT) Received: from [192.168.1.169] (pool-71-255-245-97.washdc.fios.verizon.net. [71.255.245.97]) by smtp.gmail.com with ESMTPSA id s66sm12591776qkd.90.2019.04.26.07.17.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Apr 2019 07:17:58 -0700 (PDT) Subject: Re: [PATCH V2 1/3] Calculate Thermal Pressure To: Vincent Guittot , Quentin Perret 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> Cc: Ingo Molnar , Peter Zijlstra , Zhang Rui , linux-kernel , Amit Kachhap , viresh kumar , Javi Merino , Eduardo Valentin , Daniel Lezcano , Nicolas Dechesne , Bjorn Andersson , Dietmar Eggemann From: Thara Gopinath Message-ID: <5CC31314.3070700@linaro.org> Date: Fri, 26 Apr 2019 10:17:56 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04/25/2019 08:45 AM, Vincent Guittot wrote: > On Thu, 25 Apr 2019 at 12:57, Quentin Perret wrote: >> >> On Tuesday 16 Apr 2019 at 15:38:39 (-0400), Thara Gopinath wrote: >>> +/* Per cpu structure to keep track of Thermal Pressure */ >>> +struct thermal_pressure { >>> + unsigned long scale; /* scale reflecting average cpu max capacity*/ >>> + unsigned long acc_scale; /* Accumulated scale for this time window */ >>> + unsigned long old_scale; /* Scale value for the previous window */ >>> + unsigned long raw_scale; /* Raw max capacity */ >>> + unsigned long age_stamp; /* Last time old_scale was updated */ >>> + unsigned long last_update; /* Last time acc_scale was updated */ >>> + spinlock_t lock; /* Lock for protecting from simultaneous access*/ >>> + /* Timer for periodic update of thermal pressure */ >>> + struct timer_list timer; >> >> Do you actually need the periodic update ? You only really need to >> update the 'scale' value when updating the LB stats no ? Nobody >> accesses that value in between two LBs. > > 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. Regards Thara > >> >> Thanks, >> Quentin -- Regards Thara