From: Ingo Molnar <mingo@elte.hu>
To: Nick Piggin <nickpiggin@yahoo.com.au>
Cc: Hugh Dickins <hugh@veritas.com>, Andrew Morton <akpm@osdl.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] break_lock forever broken
Date: Mon, 14 Mar 2005 09:14:02 +0100 [thread overview]
Message-ID: <20050314081402.GA26589@elte.hu> (raw)
In-Reply-To: <42354562.1080900@yahoo.com.au>
* Nick Piggin <nickpiggin@yahoo.com.au> wrote:
> > while writing the ->break_lock feature i intentionally avoided
> > overhead in the spinlock fastpath. A better solution for the bug you
> > noticed is to clear the break_lock flag in places that use
> > need_lock_break() explicitly.
>
> What happens if break_lock gets set by random contention on the lock
> somewhere (with no need_lock_break or cond_resched_lock)? Next time it
> goes through a lockbreak will (may) be a false positive.
yes, and that's harmless. Lock contention is supposed to be a relatively
rare thing (compared to the frequency of uncontended locking), so all
the overhead is concentrated towards the contention case, not towards
the uncontended case. If the flag lingers then it may be a false
positive and the lock will be dropped once, the flag will be cleared,
and the lock will be reacquired. So we've traded a constant amount of
overhead in the fastpath for a somewhat higher, but still constant
amount of overhead in the slowpath.
> >One robust way for that seems to be to make the need_lock_break() macro
> >clear the flag if it sees it set, and to make all the other (internal)
> >users use __need_lock_break() that doesnt clear the flag. I'll cook up a
> >patch for this.
> >
>
> If you do this exactly as you describe, then you'll break
> cond_resched_lock (eg. for the copy_page_range path), won't you?
(cond_resched_lock() is an 'internal' user that will use
__need_lock_break().)
Ingo
next prev parent reply other threads:[~2005-03-14 8:14 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-03-11 18:51 [PATCH] break_lock forever broken Hugh Dickins
2005-03-12 4:34 ` Andrew Morton
2005-03-12 23:20 ` Hugh Dickins
2005-03-13 8:23 ` Arjan van de Ven
2005-03-13 9:35 ` Hugh Dickins
2005-03-13 13:52 ` Arjan van de Ven
2005-03-14 5:01 ` Nick Piggin
2005-03-14 7:02 ` Ingo Molnar
2005-03-14 8:03 ` Nick Piggin
2005-03-14 8:14 ` Ingo Molnar [this message]
2005-03-14 8:24 ` Nick Piggin
2005-03-14 8:34 ` Arjan van de Ven
2005-03-14 8:43 ` Nick Piggin
2005-03-14 10:46 ` Ingo Molnar
2005-03-14 11:01 ` Nick Piggin
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=20050314081402.GA26589@elte.hu \
--to=mingo@elte.hu \
--cc=akpm@osdl.org \
--cc=hugh@veritas.com \
--cc=linux-kernel@vger.kernel.org \
--cc=nickpiggin@yahoo.com.au \
/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