# Re: \[PATCH RFC\] pm\_qos\_requirement might sleep

- From: John Kacur \<hidden\>
- Date: 2008-08-14 22:51:24 
- List: linux-rt-users
- Page: https://ratatoskr.run/linux-rt-users/2008/08/1139502
- Thread: https://ratatoskr.run/linux-rt-users/2008/08/1134835/t.md

```text
On Thu, Aug 14, 2008 at 7:48 PM, Peter Zijlstra [ref] wrote:
> On Thu, 2008-08-14 at 08:52 -0700, mark gross wrote:
>
>> Keeping a lock around the different "target_value"s may not be so
>> important.  Its just a 32bit scaler value, and perhaps we can make it an
>> atomic type?  That way we loose the raw_spinlock.
>
> My suggestion was to keep the locking for the write side - so as to
> avoid stuff stomping on one another, but drop the read side as:
>
>  spin_lock
>  foo = var;
>  spin_unlock
>  return foo;
>
> is kinda useless, it doesn't actually serialize against the usage of
> foo, that is, once it gets used, var might already have acquired a new
> value.
>
> The only thing it would protect is reading var, but since that is a
> machine sized read, its atomic anyway (assuming its naturally aligned).
>
> So no need for atomic_t (its read-side is just a read too), just drop
> the whole lock usage from pq_qos_requirement().
>

Thanks Peter.

Mark, is the following patch ok with you? This should be applied to
mainline, and then after that no special patches are necessary for
real-time.

Thanks

John Kacur
```

## Attachments

- [pm\_qos\_requirement\_lock.patch](https://ratatoskr.run/linux-rt-users/2008/08/1139502/attachment/0) (text/x-patch, 707 bytes)
