From: James Bottomley <James.Bottomley@suse.de>
To: markgross@thegnar.org
Cc: Linux PM <linux-pm@lists.linux-foundation.org>
Subject: Re: [RFC] pm_qos: reimplement using plists
Date: Sun, 06 Jun 2010 23:05:06 -0400 [thread overview]
Message-ID: <1275879906.7227.582.camel@mulgrave.site> (raw)
In-Reply-To: <20100606213954.GD8610@gvim.org>
On Sun, 2010-06-06 at 14:39 -0700, mark gross wrote:
> > @@ -251,22 +244,27 @@ void pm_qos_update_request(struct pm_qos_request_list *pm_qos_req,
> > unsigned long flags;
> > int pending_update = 0;
> > s32 temp;
> > + struct pm_qos_object *o;
> >
> > - if (pm_qos_req) { /*guard against callers passing in null */
> > - spin_lock_irqsave(&pm_qos_lock, flags);
> > - if (new_value == PM_QOS_DEFAULT_VALUE)
> > - temp = pm_qos_array[pm_qos_req->pm_qos_class]->default_value;
> > - else
> > - temp = new_value;
> > + if (!pm_qos_req) /*guard against callers passing in null */
> > + return;
>
> need a better test to see if the pm_qos_req is in the plist or not as we
> move to a caller allocated design.
This is a guard against callers passing in NULL ... which is probably
unnecessary ... I think oopsing on a NULL deref would be just fine for
that, since it would represent a programming error.
> >
> > - if (temp != pm_qos_req->value) {
> > - pending_update = 1;
> > - pm_qos_req->value = temp;
> > - }
> > + o = pm_qos_array[pm_qos_req->pm_qos_class];
> > +
> > + if (new_value == PM_QOS_DEFAULT_VALUE)
> > + temp = o->default_value;
> > + else
> > + temp = new_value;
> > +
> > + if (temp != pm_qos_req->list.prio) {
> > + pending_update = 1;
> > + spin_lock_irqsave(&pm_qos_lock, flags);
> > + plist_del(&pm_qos_req->list, &o->requests);
> > + plist_node_init(&pm_qos_req->list, temp);
> > spin_unlock_irqrestore(&pm_qos_lock, flags);
> > - if (pending_update)
> > - update_target(pm_qos_req->pm_qos_class);
> > }
> > + if (pending_update)
> > + update_target(o, &pm_qos_req->list, 0);
> > }
> > EXPORT_SYMBOL_GPL(pm_qos_update_request);
> >
> > @@ -280,19 +278,15 @@ EXPORT_SYMBOL_GPL(pm_qos_update_request);
> > */
> > void pm_qos_remove_request(struct pm_qos_request_list *pm_qos_req)
> > {
> > - unsigned long flags;
> > - int qos_class;
> > + struct pm_qos_object *o;
> >
> > if (pm_qos_req == NULL)
> > return;
> > /* silent return to keep pcm code cleaner */
>
> need a way to tell if the request is in the list or not so we don't
> crater removing a plist node that isn't in the list.
It won't: plist_del is idempotent, like list_del. Of course, such a
programming error represents a bug and probably *should* be reported.
James
next prev parent reply other threads:[~2010-06-07 3:05 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-05 17:58 [RFC] pm_qos: reimplement using plists James Bottomley
2010-06-05 18:17 ` Rafael J. Wysocki
2010-06-05 18:19 ` James Bottomley
2010-06-06 21:05 ` mark gross
2010-06-07 2:41 ` James Bottomley
2010-06-06 21:39 ` mark gross
2010-06-07 3:05 ` James Bottomley [this message]
2010-06-09 6:38 ` Florian Mickler
2010-06-09 14:03 ` James Bottomley
2010-06-08 13:31 ` mark gross
2010-06-08 15:52 ` James Bottomley
2010-06-09 2:42 ` mark gross
2010-06-09 14:03 ` James Bottomley
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=1275879906.7227.582.camel@mulgrave.site \
--to=james.bottomley@suse.de \
--cc=linux-pm@lists.linux-foundation.org \
--cc=markgross@thegnar.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