All of lore.kernel.org
 help / color / mirror / Atom feed
From: mark gross <mgross@linux.intel.com>
To: John Kacur <jkacur@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
	LKML <linux-kernel@vger.kernel.org>,
	rt-users <linux-rt-users@vger.kernel.org>,
	Steven Rostedt <rostedt@goodmis.org>, Ingo Molnar <mingo@elte.hu>,
	Thomas Gleixner <tglx@linutronix.de>, arjan <arjan@infradead.org>
Subject: Re: [PATCH RFC] pm_qos_requirement might sleep
Date: Wed, 20 Aug 2008 12:14:37 -0700	[thread overview]
Message-ID: <20080820191437.GA12415@linux.intel.com> (raw)
In-Reply-To: <520f0cf10808141551k283aecb8y647d0f5ae321b81f@mail.gmail.com>

On Fri, Aug 15, 2008 at 12:51:11AM +0200, John Kacur wrote:
> On Thu, Aug 14, 2008 at 7:48 PM, Peter Zijlstra <peterz@infradead.org> 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.

It looks ok to me, do I need to add a compiler declaration to the
structure to make sure the target_value is word aligned?

thanks,

--mgross


> 
> Thanks
> 
> John Kacur

> Subject: Remove unnecessary lock in pm_qos_requirement
> 
> Signed-off-by: John Kacur <jkacur at gmail dot com>
> 
> Index: linux-2.6/kernel/pm_qos_params.c
> ===================================================================
> --- linux-2.6.orig/kernel/pm_qos_params.c
> +++ linux-2.6/kernel/pm_qos_params.c
> @@ -193,14 +193,7 @@ static int find_pm_qos_object_by_minor(i
>   */
>  int pm_qos_requirement(int pm_qos_class)
>  {
> -	int ret_val;
> -	unsigned long flags;
> -
> -	spin_lock_irqsave(&pm_qos_lock, flags);
> -	ret_val = pm_qos_array[pm_qos_class]->target_value;
> -	spin_unlock_irqrestore(&pm_qos_lock, flags);
> -
> -	return ret_val;
> +	return pm_qos_array[pm_qos_class]->target_value;
>  }
>  EXPORT_SYMBOL_GPL(pm_qos_requirement);
>  


  reply	other threads:[~2008-08-20 19:14 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-04 20:52 [PATCH RFC] pm_qos_requirement might sleep John Kacur
2008-08-05  7:25 ` Peter Zijlstra
2008-08-05 20:49   ` mark gross
2008-08-05 21:09     ` Peter Zijlstra
2008-08-05 22:18       ` John Kacur
2008-08-11 13:25         ` John Kacur
2008-08-12 22:49         ` mark gross
2008-08-13  8:24           ` John Kacur
2008-08-14 15:52             ` mark gross
2008-08-14 17:48               ` Peter Zijlstra
2008-08-14 22:51                 ` John Kacur
2008-08-20 19:14                   ` mark gross [this message]
2008-08-25 16:34                   ` mark gross
2008-08-25 16:35                     ` Peter Zijlstra
2008-08-26  8:48                       ` John Kacur
2008-08-26 16:18                         ` mark gross
2008-08-26 17:45                           ` John Kacur
2008-08-28 19:38                             ` mark gross
2008-08-28 19:44                             ` mark gross
2008-08-29  0:32                               ` Andrew Morton
2008-08-29  6:31                                 ` John Kacur
2008-08-29 14:29                                   ` Steven Rostedt

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=20080820191437.GA12415@linux.intel.com \
    --to=mgross@linux.intel.com \
    --cc=arjan@infradead.org \
    --cc=jkacur@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.