# Re: \[PATCH v13 2/6\] sched/core: uclamp: Propagate parent clamps

- From: Michal Koutný \<mkoutny@suse.com\>
- Date: 2019-08-06 16:12:02 
- List: linux-api
- Page: https://ratatoskr.run/linux-api/2019/08/5679716
- Thread: https://ratatoskr.run/linux-pm/2019/08/5675866/t.md

```text
On Fri, Aug 02, 2019 at 10:08:49AM +0100, Patrick Bellasi [ref] wrote:
> @@ -7095,6 +7149,7 @@ static ssize_t cpu_uclamp_write(struct kernfs_open_file *of, char *buf,
>  	if (req.ret)
>  		return req.ret;
>  
> +	mutex_lock(&uclamp_mutex);
>  	rcu_read_lock();
>  
>  	tg = css_tg(of_css(of));
> @@ -7107,7 +7162,11 @@ static ssize_t cpu_uclamp_write(struct kernfs_open_file *of, char *buf,
>  	 */
>  	tg->uclamp_pct[clamp_id] = req.percent;
>  
> +	/* Update effective clamps to track the most restrictive value */
> +	cpu_util_update_eff(of_css(of));
> +
>  	rcu_read_unlock();
> +	mutex_unlock(&uclamp_mutex);
Following my remarks to "[PATCH v13 1/6] sched/core: uclamp: Extend
CPU's cgroup", I wonder if the rcu_read_lock() couldn't be moved right
before cpu_util_update_eff(). And by extension rcu_read_(un)lock could
be hidden into cpu_util_update_eff() closer to its actual need.

```

## Attachments

- [signature.asc](https://ratatoskr.run/linux-api/2019/08/5679716/attachment/0) (application/pgp-signature, 833 bytes)
