public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@ucw.cz>
To: 640E9920 <640e9920@gmail.com>
Cc: linux-pm@lists.linux-foundation.org, linux-kernel@vger.kernel.org
Subject: Re: [linux-pm] [RFC] PM_QOS api update to use handles 1/5
Date: Mon, 4 Jan 2010 09:31:27 +0100	[thread overview]
Message-ID: <20100104083127.GA1450@ucw.cz> (raw)
In-Reply-To: <20091130010953.GA4732@mgross-laptop>

On Sun 2009-11-29 17:09:53, 640E9920 wrote:
> I'm using this crazy email address because I have problems getting to
> linux.intel.com from home, and my work at intel has changed a bit.
> 
> This is the first in a 5 part series that attempts to update PM_QOS to
> use handles instead of named strings in its kernel api.  It seams that
> some folks are using pm_qos on hot paths and the overhead of the list
> walks and string compares is a problem.
> 
> Most of the changes came from aili@codeaurora.org, and I spent some time
> cleaning up the API.
> 
> Also, I couldn't resist myself in renaming the API's a bit give the fact
> that the signatures changed enough that I had to touch all the pm_qos
> users anyway.  I changed *requirement* to *request* in keeping with the
> way PM_QOS really only does best effort.  I've felt "requirement" is too
> strong a word for the way it works.

Looks good on quick scan. Moving away from strings is certainly good.

> @@ -384,15 +363,14 @@ static ssize_t pm_qos_power_write(struct file *filp, const char __user *buf,
>  		size_t count, loff_t *f_pos)
>  {
>  	s32 value;
> -	int pm_qos_class;
> +	struct pm_qos_request_list *pm_qos_req;
>  
> -	pm_qos_class = (long)filp->private_data;
>  	if (count != sizeof(s32))
>  		return -EINVAL;
>  	if (copy_from_user(&value, buf, sizeof(s32)))
>  		return -EFAULT;
> -	sprintf(name, "process_%d", current->pid);
> -	pm_qos_update_requirement(pm_qos_class, name, value);
> +	pm_qos_req = (struct pm_qos_request_list *)filp->private_data;
> +	pm_qos_update_request(pm_qos_req, value);
>  
>  	return  sizeof(s32);
>  }

Umm.. passing binary numbers like that... is not exactly good
interface. Think endianness issues  when writing to it from high-level
language.

									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

  reply	other threads:[~2010-01-04  8:33 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-30  1:09 [RFC] PM_QOS api update to use handles 1/5 640E9920
2010-01-04  8:31 ` Pavel Machek [this message]
2010-01-06 19:11   ` [linux-pm] " mark gross
2010-01-06 19:18     ` Pavel Machek
2010-01-07 20:55       ` mark gross
2010-01-07 20:58         ` Pavel Machek

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=20100104083127.GA1450@ucw.cz \
    --to=pavel@ucw.cz \
    --cc=640e9920@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@lists.linux-foundation.org \
    /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