public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH]: mutex: Fix !CONFIG_MUTEX_SPIN_ON_OWNER compile warning
@ 2010-05-27 19:07 Prarit Bhargava
  2010-05-27 19:16 ` Frederic Weisbecker
  2010-05-27 22:40 ` Frederic Weisbecker
  0 siblings, 2 replies; 3+ messages in thread
From: Prarit Bhargava @ 2010-05-27 19:07 UTC (permalink / raw)
  To: linux-kernel, hpa, mingo; +Cc: Prarit Bhargava

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 731 bytes --]

Fixes linux-next !CONFIG_MUTEX_SPIN_ON_OWNER compile warning:

kernel/mutex.c: In function ‘__mutex_lock_common’:
kernel/mutex.c:148: error: unused variable ‘timeout’

timeout is only used if CONFIG_MUTEX_SPIN_ON_OWNER is on.

Signed-off-by: Prarit Bhargava <prarit@redhat.com>

diff --git a/kernel/mutex.c b/kernel/mutex.c
index 7d4626b..c262942 100644
--- a/kernel/mutex.c
+++ b/kernel/mutex.c
@@ -145,7 +145,9 @@ __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass,
 	struct task_struct *task = current;
 	struct mutex_waiter waiter;
 	unsigned long flags;
+#ifdef CONFIG_MUTEX_SPIN_ON_OWNER
 	unsigned long timeout;
+#endif
 
 	preempt_disable();
 	mutex_acquire(&lock->dep_map, subclass, 0, ip);

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH]: mutex: Fix !CONFIG_MUTEX_SPIN_ON_OWNER compile warning
  2010-05-27 19:07 [PATCH]: mutex: Fix !CONFIG_MUTEX_SPIN_ON_OWNER compile warning Prarit Bhargava
@ 2010-05-27 19:16 ` Frederic Weisbecker
  2010-05-27 22:40 ` Frederic Weisbecker
  1 sibling, 0 replies; 3+ messages in thread
From: Frederic Weisbecker @ 2010-05-27 19:16 UTC (permalink / raw)
  To: Prarit Bhargava; +Cc: linux-kernel, hpa, mingo

On Thu, May 27, 2010 at 03:07:40PM -0400, Prarit Bhargava wrote:
> Fixes linux-next !CONFIG_MUTEX_SPIN_ON_OWNER compile warning:
> 
> kernel/mutex.c: In function ‘__mutex_lock_common’:
> kernel/mutex.c:148: error: unused variable ‘timeout’
> 
> timeout is only used if CONFIG_MUTEX_SPIN_ON_OWNER is on.
> 
> Signed-off-by: Prarit Bhargava <prarit@redhat.com>
> 
> diff --git a/kernel/mutex.c b/kernel/mutex.c
> index 7d4626b..c262942 100644
> --- a/kernel/mutex.c
> +++ b/kernel/mutex.c
> @@ -145,7 +145,9 @@ __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass,
>  	struct task_struct *task = current;
>  	struct mutex_waiter waiter;
>  	unsigned long flags;
> +#ifdef CONFIG_MUTEX_SPIN_ON_OWNER
>  	unsigned long timeout;
> +#endif



Andrew had a patch that fixed it with a "__used" tag.
Either way that doesn't look much proper.

It would be much nicer to put the mutex spinning in a separate
function, that would be a stub with !CONFIG_MUTEX_SPIN_ON_OWNER.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH]: mutex: Fix !CONFIG_MUTEX_SPIN_ON_OWNER compile warning
  2010-05-27 19:07 [PATCH]: mutex: Fix !CONFIG_MUTEX_SPIN_ON_OWNER compile warning Prarit Bhargava
  2010-05-27 19:16 ` Frederic Weisbecker
@ 2010-05-27 22:40 ` Frederic Weisbecker
  1 sibling, 0 replies; 3+ messages in thread
From: Frederic Weisbecker @ 2010-05-27 22:40 UTC (permalink / raw)
  To: Prarit Bhargava, Ingo Molnar; +Cc: linux-kernel, hpa, Peter Zijlstra

On Thu, May 27, 2010 at 03:07:40PM -0400, Prarit Bhargava wrote:
> Fixes linux-next !CONFIG_MUTEX_SPIN_ON_OWNER compile warning:
> 
> kernel/mutex.c: In function ‘__mutex_lock_common’:
> kernel/mutex.c:148: error: unused variable ‘timeout’
> 
> timeout is only used if CONFIG_MUTEX_SPIN_ON_OWNER is on.
> 
> Signed-off-by: Prarit Bhargava <prarit@redhat.com>
> 
> diff --git a/kernel/mutex.c b/kernel/mutex.c
> index 7d4626b..c262942 100644
> --- a/kernel/mutex.c
> +++ b/kernel/mutex.c
> @@ -145,7 +145,9 @@ __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass,
>  	struct task_struct *task = current;
>  	struct mutex_waiter waiter;
>  	unsigned long flags;
> +#ifdef CONFIG_MUTEX_SPIN_ON_OWNER
>  	unsigned long timeout;
> +#endif
>  
>  	preempt_disable();
>  	mutex_acquire(&lock->dep_map, subclass, 0, ip);



In fact the situation is a bit more complicated.

There are two things that are related to this build warning:

- the lock inversion prevention against the bkl
- the timeout for other purposes, basically to limit too long spins

And the lock inversion fix needs to be standalone because it should
be backported to the stable branches.

So it seems that the plans are more:

1) have a clean patch that only prevents from the bkl lock inversion
2) thinking about the timeout, may be find something better if we can

All in one, I suspect these patches will be refactored rather than
improved incrementally, to make the backport of 1) easier.

So the warning issue will probably disappear in the meantime.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-05-27 22:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-27 19:07 [PATCH]: mutex: Fix !CONFIG_MUTEX_SPIN_ON_OWNER compile warning Prarit Bhargava
2010-05-27 19:16 ` Frederic Weisbecker
2010-05-27 22:40 ` Frederic Weisbecker

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox