Re: [Patch] idle governor: Avoid lock acquisition to read pm_qosbefore entering idle
From: Andi Kleen
Date: Thu Feb 10 2011 - 11:20:29 EST
On Wed, Feb 09, 2011 at 09:10:42PM -0800, mark gross wrote:
> On Wed, Feb 09, 2011 at 05:21:04PM -0800, Tim Chen wrote:
> > I noticed that before entering idle state, the menu idle governor will
> > look up the current pm_qos value according to the list of qos request
> > received. This look up currently needs the acquisition of a lock to go
> > down a list of qos requests to find the qos value, slowing down the
>
> wait a second... It gets the target_value (that is an atomic variable)
> humpf. I was looking at 2.6.35, where this is true. If you want to put
> back a target_value why not put it back the way it was?
I don't think the goal is to make the code look like it was before,
just to have clean and scalable code going forwards.
> I'm surprised by this as the last update to the pm_qos replaced the
> lists with a O(1) data structure so there was no more walking of pending
> requests.
>
> What is the profile after the patch the Plist should be only one
> dereference and an if instruction slower than a cached value.
The problem with the plist is that you need to take a lock for reading
the first value. The lock is a performance problem on servers.
The reference doesn't matter at all.
> Does your patch remove the need for the locks because if it doesn't I
> don't see how it will make much of a difference?
The value itself doesn't need a lock, just the list access.
>
> > Perhaps a better approach will be to cache the updated pm_qos value so
> > reading it does not require lock acquisition as in the patch below.
>
> See v2.6.35 for an possible instance of the better approach.
Tim's new code seems simpler and cleaner than what was in .35.
-Andi
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/