From: Peter Zijlstra <peterz@infradead.org>
To: Hillf Danton <dhillf@gmail.com>
Cc: LKML <linux-kernel@vger.kernel.org>, Ingo Molnar <mingo@elte.hu>
Subject: Re: [PATCH] sched: correct testing need_resched in mutex_spin_on_owner()
Date: Tue, 07 Jun 2011 17:20:40 +0200 [thread overview]
Message-ID: <1307460040.2322.279.camel@twins> (raw)
In-Reply-To: <BANLkTi=XTpYTZvetOUDgobRa_S4Cb=+syA@mail.gmail.com>
On Tue, 2011-06-07 at 22:47 +0800, Hillf Danton wrote:
> Oh, it looks you are willing to rethink about testing need_resched?
Dude, however did you come up with that deduction?
mutex_spin_on_owner() does two things:
- it validates that owner is in fact still running (if so it must be on
another cpu, since we're running on this one).
- it ensures we play nice and reschedule when we need to, so we don't
hog our cpu.
Testing TIF_NEED_RESCHED on owner like you propose is wrong because:
- owner is not a stable pointer you can dereference, see
owner_running(), you first need to validate that its still a valid
pointer and then keep it valid while dereferencing it.
- if owner were to reschedule, it would leave the cpu and we'd break
out of the loop anyway by means of owner_running() failing, so its
superfluous.
Please, get a grip on reality and stop sending endless streams of
patches based on wrong assumptions and mis-understandings.
next prev parent reply other threads:[~2011-06-07 15:20 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-07 13:41 Hillf Danton
2011-06-07 13:47 ` Peter Zijlstra
2011-06-07 13:50 ` Peter Zijlstra
2011-06-07 13:59 ` Peter Zijlstra
2011-06-07 14:14 ` Hillf Danton
2011-06-07 14:10 ` Hillf Danton
2011-06-07 14:24 ` Peter Zijlstra
2011-06-07 14:36 ` Hillf Danton
2011-06-07 14:40 ` Peter Zijlstra
2011-06-07 14:47 ` Hillf Danton
2011-06-07 15:08 ` Steven Rostedt
2011-06-07 18:22 ` Hillf Danton
2011-06-07 18:34 ` Steven Rostedt
2011-06-07 15:20 ` Peter Zijlstra [this message]
2011-06-07 15:43 ` 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=1307460040.2322.279.camel@twins \
--to=peterz@infradead.org \
--cc=dhillf@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
/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
Powered by JetHome