public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Lukasz Luba <lukasz.luba@arm.com>
To: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Linux PM <linux-pm@vger.kernel.org>,
	Daniel Lezcano <daniel.lezcano@linaro.org>,
	Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Subject: Re: [PATCH v1 06/16] thermal: gov_power_allocator: Use .manage() callback instead of .throttle()
Date: Fri, 19 Apr 2024 10:50:37 +0100	[thread overview]
Message-ID: <1aea8475-e47c-479b-b06e-638d442f277e@arm.com> (raw)
In-Reply-To: <1815410.VLH7GnMWUR@kreacher>



On 4/10/24 17:10, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> 
> The Power Allocator governor really only wants to be called once per
> thermal zone update and it does a special check to skip the extra,
> from its perspective, invocations of the .throttle() callback.
> 
> Make it use .manage() instead of .throttle().
> 
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---
>   drivers/thermal/gov_power_allocator.c |   24 +++++++-----------------
>   1 file changed, 7 insertions(+), 17 deletions(-)
> 
> Index: linux-pm/drivers/thermal/gov_power_allocator.c
> ===================================================================
> --- linux-pm.orig/drivers/thermal/gov_power_allocator.c
> +++ linux-pm/drivers/thermal/gov_power_allocator.c
> @@ -395,7 +395,7 @@ static void divvy_up_power(struct power_
>   	}
>   }
>   
> -static int allocate_power(struct thermal_zone_device *tz, int control_temp)
> +static void allocate_power(struct thermal_zone_device *tz, int control_temp)
>   {
>   	struct power_allocator_params *params = tz->governor_data;
>   	unsigned int num_actors = params->num_actors;
> @@ -410,7 +410,7 @@ static int allocate_power(struct thermal
>   	int i = 0, ret;
>   
>   	if (!num_actors)
> -		return -ENODEV;
> +		return;
>   
>   	/* Clean all buffers for new power estimations */
>   	memset(power, 0, params->buffer_size);
> @@ -471,8 +471,6 @@ static int allocate_power(struct thermal
>   				      num_actors, power_range,
>   				      max_allocatable_power, tz->temperature,
>   				      control_temp - tz->temperature);
> -
> -	return 0;
>   }
>   
>   /**
> @@ -745,40 +743,32 @@ static void power_allocator_unbind(struc
>   	tz->governor_data = NULL;
>   }
>   
> -static int power_allocator_throttle(struct thermal_zone_device *tz,
> -				    const struct thermal_trip *trip)
> +static void power_allocator_manage(struct thermal_zone_device *tz)
>   {
>   	struct power_allocator_params *params = tz->governor_data;
> +	const struct thermal_trip *trip = params->trip_switch_on;
>   	bool update;
>   
>   	lockdep_assert_held(&tz->lock);
>   
> -	/*
> -	 * We get called for every trip point but we only need to do
> -	 * our calculations once
> -	 */
> -	if (trip != params->trip_max)
> -		return 0;
> -
> -	trip = params->trip_switch_on;
>   	if (trip && tz->temperature < trip->temperature) {
>   		update = tz->passive;
>   		tz->passive = 0;
>   		reset_pid_controller(params);
>   		allow_maximum_power(tz, update);
> -		return 0;
> +		return;
>   	}
>   
>   	tz->passive = 1;
>   
> -	return allocate_power(tz, params->trip_max->temperature);
> +	allocate_power(tz, params->trip_max->temperature);
>   }
>   
>   static struct thermal_governor thermal_gov_power_allocator = {
>   	.name		= "power_allocator",
>   	.bind_to_tz	= power_allocator_bind,
>   	.unbind_from_tz	= power_allocator_unbind,
> -	.throttle	= power_allocator_throttle,
> +	.manage		= power_allocator_manage,
>   	.update_tz	= power_allocator_update_tz,
>   };
>   THERMAL_GOVERNOR_DECLARE(thermal_gov_power_allocator);
> 
> 
> 

LGTM

Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>

  reply	other threads:[~2024-04-19  9:50 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-10 15:41 [PATCH v1 00/16] thermal: core: Redesign the governor interface Rafael J. Wysocki
2024-04-10 16:04 ` [PATCH v1 02/16] thermal: gov_bang_bang: Use .trip_crossed() instead of .throttle() Rafael J. Wysocki
2024-04-19  9:34   ` Lukasz Luba
2024-04-23 17:04   ` Daniel Lezcano
2024-04-10 16:05 ` [PATCH v1 03/16] thermal: gov_bang_bang: Clean up thermal_zone_trip_update() Rafael J. Wysocki
2024-04-19  9:41   ` Lukasz Luba
2024-04-23 17:05   ` Daniel Lezcano
2024-04-10 16:06 ` [PATCH v1 04/16] thermal: gov_bang_bang: Fold thermal_zone_trip_update() into its caller Rafael J. Wysocki
2024-04-19  9:42   ` Lukasz Luba
2024-04-23 17:06   ` Daniel Lezcano
2024-04-10 16:08 ` [PATCH v1 05/16] thermal: core: Introduce .manage() callback for thermal governors Rafael J. Wysocki
2024-04-19  9:44   ` Lukasz Luba
2024-04-23 17:07   ` Daniel Lezcano
2024-04-10 16:10 ` [PATCH v1 06/16] thermal: gov_power_allocator: Use .manage() callback instead of .throttle() Rafael J. Wysocki
2024-04-19  9:50   ` Lukasz Luba [this message]
2024-04-10 16:10 ` [PATCH v1 01/16] thermal: core: Introduce .trip_crossed() callback for thermal governors Rafael J. Wysocki
2024-04-19  8:47   ` Lukasz Luba
2024-04-23 17:14   ` Daniel Lezcano
2024-04-23 17:25     ` Rafael J. Wysocki
2024-04-23 17:58       ` Daniel Lezcano
2024-04-10 16:12 ` [PATCH v1 07/16] thermal: gov_power_allocator: Eliminate a redundant variable Rafael J. Wysocki
2024-04-19  9:56   ` Lukasz Luba
2024-04-23 17:35   ` Daniel Lezcano
2024-04-23 17:54     ` Rafael J. Wysocki
2024-04-23 18:00       ` Daniel Lezcano
2024-04-23 18:05         ` Rafael J. Wysocki
2024-04-23 18:09           ` Daniel Lezcano
2024-04-10 16:13 ` [PATCH v1 08/16] thermal: gov_step_wise: Use .manage() callback instead of .throttle() Rafael J. Wysocki
2024-04-19 17:20   ` Lukasz Luba
2024-04-24  7:54   ` Daniel Lezcano
2024-04-10 16:43 ` [PATCH v1 09/16] thermal: gov_step_wise: Use trip thresholds instead of trip temperatures Rafael J. Wysocki
2024-04-19 19:11   ` Lukasz Luba
2024-04-24  7:03   ` Daniel Lezcano
2024-04-10 16:44 ` [PATCH v1 10/16] thermal: gov_step_wise: Clean up thermal_zone_trip_update() Rafael J. Wysocki
2024-04-19 18:21   ` Lukasz Luba
2024-04-10 16:57 ` [PATCH v1 11/16] thermal: gov_fair_share: Use .manage() callback instead of .throttle() Rafael J. Wysocki
2024-04-19 18:28   ` Lukasz Luba
2024-04-10 16:58 ` [PATCH v1 12/16] thermal: gov_fair_share: Use trip thresholds instead of trip temperatures Rafael J. Wysocki
2024-04-19 19:18   ` Lukasz Luba
2024-04-10 17:00 ` [PATCH v1 13/16] thermal: gov_fair_share: Eliminate unnecessary integer divisions Rafael J. Wysocki
2024-04-19 18:46   ` Lukasz Luba
2024-04-10 17:03 ` [PATCH v1 14/16] thermal: gov_user_space: Use .trip_crossed() instead of .throttle() Rafael J. Wysocki
2024-04-19 18:16   ` Lukasz Luba
2024-04-24  9:14   ` Daniel Lezcano
2024-04-24 11:32     ` Srinivas Pandruvada
2024-04-24 11:34       ` Daniel Lezcano
2024-04-24 11:44         ` Srinivas Pandruvada
2024-04-10 17:42 ` [PATCH v1 15/16] thermal: core: Drop the .throttle() governor callback Rafael J. Wysocki
2024-04-19 18:50   ` Lukasz Luba
2024-04-24  9:11   ` Daniel Lezcano
2024-04-10 17:44 ` [PATCH v1 16/16] thermal: core: Relocate critical and hot trip handling Rafael J. Wysocki
2024-04-19 18:52   ` Lukasz Luba
2024-04-24  9:17   ` Daniel Lezcano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1aea8475-e47c-479b-b06e-638d442f277e@arm.com \
    --to=lukasz.luba@arm.com \
    --cc=daniel.lezcano@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    --cc=srinivas.pandruvada@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox