From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8E40CC433E1 for ; Mon, 13 Jul 2020 14:32:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 692FE205CB for ; Mon, 13 Jul 2020 14:32:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="pa6pNCMC" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730061AbgGMOcw (ORCPT ); Mon, 13 Jul 2020 10:32:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58320 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729919AbgGMOcq (ORCPT ); Mon, 13 Jul 2020 10:32:46 -0400 Received: from mail-qt1-x841.google.com (mail-qt1-x841.google.com [IPv6:2607:f8b0:4864:20::841]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 188C9C061794 for ; Mon, 13 Jul 2020 07:32:46 -0700 (PDT) Received: by mail-qt1-x841.google.com with SMTP id x62so10078253qtd.3 for ; Mon, 13 Jul 2020 07:32:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=JV7XujCjT0WQ4wkjALKmlW731iVG+iPdV0Rii6HipsE=; b=pa6pNCMCjQQsJcn6JRnuQVsJuBE0YMkf8XHeoTrN40w24whIS3UehEHKsvoDinmJTt DBQ3YUhvghGYV60Xpb5xSXl2lDujV2jF6VxwOr/aDF76DRVCvd/1dCr8LbhoyVzYBV3L NAFlykQunvALJ8h2nY2Kd+5ozXlNYyFr2YhUax8lCIosdi8C5gdumEjELCyqJFXo6xTQ ciCmX5gM3wA8fGEja7vJdp+0XTSMxXi4wzsZPZmxax9hbegn+OdYOhrpF7BF9qG8WKCE Wj/eNmqlpb8hks0b+FK0gz8HdgFmhkEOnW4f1OjEqVAwuBj04gj3DQTwT/EswUOGex76 jTHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=JV7XujCjT0WQ4wkjALKmlW731iVG+iPdV0Rii6HipsE=; b=nE84cMbZG0SjNJLNQ6s6YM54LTt2y2Nh15mAZwhqPw2jesnkB2OjYZKzIjmdsIwtTi wk3VHmrV1mM2RYvPQDiHLZgvAnFcGgHIW2bfHgs36GT3IIElsvgpzK+ZeLdghEFpk6c4 lcZJc5iz4gl6oGzkzOTwaOrfznQJaz+9I7Fuw3Hi8rKCHI8+xp4Rq9kBMWzzVkh0rZ61 s1xGDWN2/jN7w9FiXFIQO+ECP60afjgwC0TQvau/SRzDVBvg3CHSS2jLMs9WqFyIGjDq chbtVNKQot/IvcBxge5SDFLhN09B2pQ3DVGAurnQZGASgWlvYbq3DTLQ2R0ck42njwR5 IlEw== X-Gm-Message-State: AOAM532nC+75Dv6XpxKzZfRljJS+SsErQA9Sn5i2b69dykgez8X4oXtr zbF7otFzrECZg7HpEz7H3tCfpQ== X-Google-Smtp-Source: ABdhPJwCpXBnQ3gVjbL3KO0uYLMvWJ4HBXi/rSe0OTG4oUjXgHWdxblMk7Zj6jjIKa89WBuHHrMrMQ== X-Received: by 2002:ac8:c4e:: with SMTP id l14mr70226000qti.106.1594650765164; Mon, 13 Jul 2020 07:32:45 -0700 (PDT) Received: from [192.168.1.92] (pool-71-255-246-27.washdc.fios.verizon.net. [71.255.246.27]) by smtp.gmail.com with ESMTPSA id w18sm18516302qtn.3.2020.07.13.07.32.43 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 13 Jul 2020 07:32:43 -0700 (PDT) Subject: Re: [PATCH v2 1/3] arch_topology, sched/core: Cleanup thermal pressure definition To: Valentin Schneider , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org Cc: Russell King , Sudeep Holla , Amit Daniel Kachhap , Daniel Lezcano , Viresh Kumar , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann References: <20200712165917.9168-1-valentin.schneider@arm.com> <20200712165917.9168-2-valentin.schneider@arm.com> From: Thara Gopinath Message-ID: <88488b17-fd01-76e6-ae53-027c1016340b@linaro.org> Date: Mon, 13 Jul 2020 10:32:42 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: <20200712165917.9168-2-valentin.schneider@arm.com> Content-Type: text/plain; charset=utf-8; format=flowed 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 7/12/20 12:59 PM, Valentin Schneider wrote: > The following commit: > > 14533a16c46d ("thermal/cpu-cooling, sched/core: Move the arch_set_thermal_pressure() API to generic scheduler code") > > moved the definition of arch_set_thermal_pressure() to sched/core.c, but > kept its declaration in linux/arch_topology.h. When building e.g. an x86 > kernel with CONFIG_SCHED_THERMAL_PRESSURE=y, cpufreq_cooling.c ends up > getting the declaration of arch_set_thermal_pressure() from > include/linux/arch_topology.h, which is somewhat awkward. > > On top of this, sched/core.c unconditionally defines > o The thermal_pressure percpu variable > o arch_set_thermal_pressure() > > while arch_scale_thermal_pressure() does nothing unless redefined by the > architecture. > > arch_*() functions are meant to be defined by architectures, so revert the > aforementioned commit and re-implement it in a way that keeps > arch_set_thermal_pressure() architecture-definable, and doesn't define the > thermal pressure percpu variable for kernels that don't need > it (CONFIG_SCHED_THERMAL_PRESSURE=n). > > Signed-off-by: Valentin Schneider > --- Reviewed-by: Thara Gopinath > arch/arm/include/asm/topology.h | 3 ++- > arch/arm64/include/asm/topology.h | 3 ++- > drivers/base/arch_topology.c | 11 +++++++++++ > include/linux/arch_topology.h | 4 ++-- > include/linux/sched/topology.h | 7 +++++++ > kernel/sched/core.c | 11 ----------- > 6 files changed, 24 insertions(+), 15 deletions(-) > > diff --git a/arch/arm/include/asm/topology.h b/arch/arm/include/asm/topology.h > index 435aba289fc5..e0593cf095d0 100644 > --- a/arch/arm/include/asm/topology.h > +++ b/arch/arm/include/asm/topology.h > @@ -16,8 +16,9 @@ > /* Enable topology flag updates */ > #define arch_update_cpu_topology topology_update_cpu_topology > > -/* Replace task scheduler's default thermal pressure retrieve API */ > +/* Replace task scheduler's default thermal pressure API */ > #define arch_scale_thermal_pressure topology_get_thermal_pressure > +#define arch_set_thermal_pressure topology_set_thermal_pressure > > #else > > diff --git a/arch/arm64/include/asm/topology.h b/arch/arm64/include/asm/topology.h > index 0cc835ddfcd1..e042f6527981 100644 > --- a/arch/arm64/include/asm/topology.h > +++ b/arch/arm64/include/asm/topology.h > @@ -34,8 +34,9 @@ void topology_scale_freq_tick(void); > /* Enable topology flag updates */ > #define arch_update_cpu_topology topology_update_cpu_topology > > -/* Replace task scheduler's default thermal pressure retrieve API */ > +/* Replace task scheduler's default thermal pressure API */ > #define arch_scale_thermal_pressure topology_get_thermal_pressure > +#define arch_set_thermal_pressure topology_set_thermal_pressure > > #include > > diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c > index 4d0a0038b476..d14cab7dfa3c 100644 > --- a/drivers/base/arch_topology.c > +++ b/drivers/base/arch_topology.c > @@ -54,6 +54,17 @@ void topology_set_cpu_scale(unsigned int cpu, unsigned long capacity) > per_cpu(cpu_scale, cpu) = capacity; > } > > +DEFINE_PER_CPU(unsigned long, thermal_pressure); > + > +void arch_set_thermal_pressure(const struct cpumask *cpus, > + unsigned long th_pressure) > +{ > + int cpu; > + > + for_each_cpu(cpu, cpus) > + WRITE_ONCE(per_cpu(thermal_pressure, cpu), th_pressure); > +} > + > static ssize_t cpu_capacity_show(struct device *dev, > struct device_attribute *attr, > char *buf) > diff --git a/include/linux/arch_topology.h b/include/linux/arch_topology.h > index 0566cb3314ef..69b1dabe39dc 100644 > --- a/include/linux/arch_topology.h > +++ b/include/linux/arch_topology.h > @@ -39,8 +39,8 @@ static inline unsigned long topology_get_thermal_pressure(int cpu) > return per_cpu(thermal_pressure, cpu); > } > > -void arch_set_thermal_pressure(struct cpumask *cpus, > - unsigned long th_pressure); > +void topology_set_thermal_pressure(const struct cpumask *cpus, > + unsigned long th_pressure); > > struct cpu_topology { > int thread_id; > diff --git a/include/linux/sched/topology.h b/include/linux/sched/topology.h > index fb11091129b3..764222d637b7 100644 > --- a/include/linux/sched/topology.h > +++ b/include/linux/sched/topology.h > @@ -232,6 +232,13 @@ unsigned long arch_scale_thermal_pressure(int cpu) > } > #endif > > +#ifndef arch_set_thermal_pressure > +static __always_inline > +void arch_set_thermal_pressure(const struct cpumask *cpus, > + unsigned long th_pressure) > +{ } > +#endif > + > static inline int task_node(const struct task_struct *p) > { > return cpu_to_node(task_cpu(p)); > diff --git a/kernel/sched/core.c b/kernel/sched/core.c > index ff0519551188..90b44f3840e4 100644 > --- a/kernel/sched/core.c > +++ b/kernel/sched/core.c > @@ -3731,17 +3731,6 @@ unsigned long long task_sched_runtime(struct task_struct *p) > return ns; > } > > -DEFINE_PER_CPU(unsigned long, thermal_pressure); > - > -void arch_set_thermal_pressure(struct cpumask *cpus, > - unsigned long th_pressure) > -{ > - int cpu; > - > - for_each_cpu(cpu, cpus) > - WRITE_ONCE(per_cpu(thermal_pressure, cpu), th_pressure); > -} > - > /* > * This function gets called by the timer code, with HZ frequency. > * We call it with interrupts disabled. > -- Warm Regards Thara From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DCBD5C433E4 for ; Mon, 13 Jul 2020 14:34:29 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A7678205CB for ; Mon, 13 Jul 2020 14:34:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="n5g22x0x"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="pa6pNCMC" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A7678205CB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Type: Content-Transfer-Encoding:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From: References:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=eFHTmNELw/LE6k1apXopw6dcF5g98MlA7uI8yhBmc8s=; b=n5g22x0x7UF5CxfRedByyZiFS tBgdYRGUSyVmeEAXLCwE3CVYnNrvx1jWpioflNnJ3+7ZjTFVSRVpUcJJZOaDHrWGj3dZhHejl3GMI cTlmTYK8O3OvaHsVZMIkeCVtLlKayVU/YNKWEiFIjegouwBnyF0bnwdySPrPs4JKo0LUIJz1eM/4y U1cMPhkdSrlfs6pQWPhyQ1saDedC5+O4nPIiXe/BqDS6vzoxNvURqwbQvFXKyW3/D+dlXYWahS31K jgCLOQtYH3UWpAYtRSIG0I/VTMplEsmsNuWY+Z/zrEXRO0VWJApB1L9qdawsJ7Phu2wCM/P3hQHdP crWEBaKWA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1juzVi-0003H5-MP; Mon, 13 Jul 2020 14:32:50 +0000 Received: from mail-qt1-x842.google.com ([2607:f8b0:4864:20::842]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1juzVg-0003Fu-Nq for linux-arm-kernel@lists.infradead.org; Mon, 13 Jul 2020 14:32:49 +0000 Received: by mail-qt1-x842.google.com with SMTP id a32so10074767qtb.5 for ; Mon, 13 Jul 2020 07:32:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=JV7XujCjT0WQ4wkjALKmlW731iVG+iPdV0Rii6HipsE=; b=pa6pNCMCjQQsJcn6JRnuQVsJuBE0YMkf8XHeoTrN40w24whIS3UehEHKsvoDinmJTt DBQ3YUhvghGYV60Xpb5xSXl2lDujV2jF6VxwOr/aDF76DRVCvd/1dCr8LbhoyVzYBV3L NAFlykQunvALJ8h2nY2Kd+5ozXlNYyFr2YhUax8lCIosdi8C5gdumEjELCyqJFXo6xTQ ciCmX5gM3wA8fGEja7vJdp+0XTSMxXi4wzsZPZmxax9hbegn+OdYOhrpF7BF9qG8WKCE Wj/eNmqlpb8hks0b+FK0gz8HdgFmhkEOnW4f1OjEqVAwuBj04gj3DQTwT/EswUOGex76 jTHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=JV7XujCjT0WQ4wkjALKmlW731iVG+iPdV0Rii6HipsE=; b=XtXfRhnzSiR5M5y6yPwHV1SxNz0EfNDnMUmoiGatNVCReC44LbAlZPsK20oXT4vwWR Y8hpFnmCizawMCvtGoEQYZ7lIA3M69floBOcKKuuWNIS/wI/3xHCYAmCPec41YoRa4Le hLcQq2f+loF8ydmOGNNCdv7hSZEdeDdGvtIJIjqYVDzxUis9BZgUlcX7l2piBTwaBgrD jLoa8fPce7QEJp2wDTfXnqt06Efq1Rga3oKb6/AcwKge3dc8sfs63UnLNhCDjwLzsxbf gbnsVC8auEBe1UPypxQ849xHNz8WyIdSr1XVHBAhoZlvvbwwxFjJXfktSn6YPsxoHAqZ JROQ== X-Gm-Message-State: AOAM532W90CeLwEyad01im2flDXz1sG0DDGPslMm7rnz+VNeJi2c9I5j zRC06gSOvySKuU30CVx78NgaeQ== X-Google-Smtp-Source: ABdhPJwCpXBnQ3gVjbL3KO0uYLMvWJ4HBXi/rSe0OTG4oUjXgHWdxblMk7Zj6jjIKa89WBuHHrMrMQ== X-Received: by 2002:ac8:c4e:: with SMTP id l14mr70226000qti.106.1594650765164; Mon, 13 Jul 2020 07:32:45 -0700 (PDT) Received: from [192.168.1.92] (pool-71-255-246-27.washdc.fios.verizon.net. [71.255.246.27]) by smtp.gmail.com with ESMTPSA id w18sm18516302qtn.3.2020.07.13.07.32.43 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 13 Jul 2020 07:32:43 -0700 (PDT) Subject: Re: [PATCH v2 1/3] arch_topology, sched/core: Cleanup thermal pressure definition To: Valentin Schneider , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org References: <20200712165917.9168-1-valentin.schneider@arm.com> <20200712165917.9168-2-valentin.schneider@arm.com> From: Thara Gopinath Message-ID: <88488b17-fd01-76e6-ae53-027c1016340b@linaro.org> Date: Mon, 13 Jul 2020 10:32:42 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: <20200712165917.9168-2-valentin.schneider@arm.com> Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200713_103248_796344_8AC1F624 X-CRM114-Status: GOOD ( 26.29 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Juri Lelli , Vincent Guittot , Peter Zijlstra , Viresh Kumar , Amit Daniel Kachhap , Daniel Lezcano , Russell King , Dietmar Eggemann , Sudeep Holla , Ingo Molnar Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 7/12/20 12:59 PM, Valentin Schneider wrote: > The following commit: > > 14533a16c46d ("thermal/cpu-cooling, sched/core: Move the arch_set_thermal_pressure() API to generic scheduler code") > > moved the definition of arch_set_thermal_pressure() to sched/core.c, but > kept its declaration in linux/arch_topology.h. When building e.g. an x86 > kernel with CONFIG_SCHED_THERMAL_PRESSURE=y, cpufreq_cooling.c ends up > getting the declaration of arch_set_thermal_pressure() from > include/linux/arch_topology.h, which is somewhat awkward. > > On top of this, sched/core.c unconditionally defines > o The thermal_pressure percpu variable > o arch_set_thermal_pressure() > > while arch_scale_thermal_pressure() does nothing unless redefined by the > architecture. > > arch_*() functions are meant to be defined by architectures, so revert the > aforementioned commit and re-implement it in a way that keeps > arch_set_thermal_pressure() architecture-definable, and doesn't define the > thermal pressure percpu variable for kernels that don't need > it (CONFIG_SCHED_THERMAL_PRESSURE=n). > > Signed-off-by: Valentin Schneider > --- Reviewed-by: Thara Gopinath > arch/arm/include/asm/topology.h | 3 ++- > arch/arm64/include/asm/topology.h | 3 ++- > drivers/base/arch_topology.c | 11 +++++++++++ > include/linux/arch_topology.h | 4 ++-- > include/linux/sched/topology.h | 7 +++++++ > kernel/sched/core.c | 11 ----------- > 6 files changed, 24 insertions(+), 15 deletions(-) > > diff --git a/arch/arm/include/asm/topology.h b/arch/arm/include/asm/topology.h > index 435aba289fc5..e0593cf095d0 100644 > --- a/arch/arm/include/asm/topology.h > +++ b/arch/arm/include/asm/topology.h > @@ -16,8 +16,9 @@ > /* Enable topology flag updates */ > #define arch_update_cpu_topology topology_update_cpu_topology > > -/* Replace task scheduler's default thermal pressure retrieve API */ > +/* Replace task scheduler's default thermal pressure API */ > #define arch_scale_thermal_pressure topology_get_thermal_pressure > +#define arch_set_thermal_pressure topology_set_thermal_pressure > > #else > > diff --git a/arch/arm64/include/asm/topology.h b/arch/arm64/include/asm/topology.h > index 0cc835ddfcd1..e042f6527981 100644 > --- a/arch/arm64/include/asm/topology.h > +++ b/arch/arm64/include/asm/topology.h > @@ -34,8 +34,9 @@ void topology_scale_freq_tick(void); > /* Enable topology flag updates */ > #define arch_update_cpu_topology topology_update_cpu_topology > > -/* Replace task scheduler's default thermal pressure retrieve API */ > +/* Replace task scheduler's default thermal pressure API */ > #define arch_scale_thermal_pressure topology_get_thermal_pressure > +#define arch_set_thermal_pressure topology_set_thermal_pressure > > #include > > diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c > index 4d0a0038b476..d14cab7dfa3c 100644 > --- a/drivers/base/arch_topology.c > +++ b/drivers/base/arch_topology.c > @@ -54,6 +54,17 @@ void topology_set_cpu_scale(unsigned int cpu, unsigned long capacity) > per_cpu(cpu_scale, cpu) = capacity; > } > > +DEFINE_PER_CPU(unsigned long, thermal_pressure); > + > +void arch_set_thermal_pressure(const struct cpumask *cpus, > + unsigned long th_pressure) > +{ > + int cpu; > + > + for_each_cpu(cpu, cpus) > + WRITE_ONCE(per_cpu(thermal_pressure, cpu), th_pressure); > +} > + > static ssize_t cpu_capacity_show(struct device *dev, > struct device_attribute *attr, > char *buf) > diff --git a/include/linux/arch_topology.h b/include/linux/arch_topology.h > index 0566cb3314ef..69b1dabe39dc 100644 > --- a/include/linux/arch_topology.h > +++ b/include/linux/arch_topology.h > @@ -39,8 +39,8 @@ static inline unsigned long topology_get_thermal_pressure(int cpu) > return per_cpu(thermal_pressure, cpu); > } > > -void arch_set_thermal_pressure(struct cpumask *cpus, > - unsigned long th_pressure); > +void topology_set_thermal_pressure(const struct cpumask *cpus, > + unsigned long th_pressure); > > struct cpu_topology { > int thread_id; > diff --git a/include/linux/sched/topology.h b/include/linux/sched/topology.h > index fb11091129b3..764222d637b7 100644 > --- a/include/linux/sched/topology.h > +++ b/include/linux/sched/topology.h > @@ -232,6 +232,13 @@ unsigned long arch_scale_thermal_pressure(int cpu) > } > #endif > > +#ifndef arch_set_thermal_pressure > +static __always_inline > +void arch_set_thermal_pressure(const struct cpumask *cpus, > + unsigned long th_pressure) > +{ } > +#endif > + > static inline int task_node(const struct task_struct *p) > { > return cpu_to_node(task_cpu(p)); > diff --git a/kernel/sched/core.c b/kernel/sched/core.c > index ff0519551188..90b44f3840e4 100644 > --- a/kernel/sched/core.c > +++ b/kernel/sched/core.c > @@ -3731,17 +3731,6 @@ unsigned long long task_sched_runtime(struct task_struct *p) > return ns; > } > > -DEFINE_PER_CPU(unsigned long, thermal_pressure); > - > -void arch_set_thermal_pressure(struct cpumask *cpus, > - unsigned long th_pressure) > -{ > - int cpu; > - > - for_each_cpu(cpu, cpus) > - WRITE_ONCE(per_cpu(thermal_pressure, cpu), th_pressure); > -} > - > /* > * This function gets called by the timer code, with HZ frequency. > * We call it with interrupts disabled. > -- Warm Regards Thara _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel