mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Arjan van de Ven <arjan@infradead.org>
To: Andrew Morton <akpm@osdl.org>
Cc: Ingo Molnar <mingo@elte.hu>, ccb@acm.org, linux-kernel@vger.kernel.org
Subject: Re: [patch] increase spinlock-debug looping timeouts from 1 sec to 1 min
Date: Tue, 20 Jun 2006 10:06:06 +0200	[thread overview]
Message-ID: <1150790766.2891.160.camel@laptopd505.fenrus.org> (raw)
In-Reply-To: <20060619125531.4c72b8cc.akpm@osdl.org>

On Mon, 2006-06-19 at 12:55 -0700, Andrew Morton wrote:

> I get that impression ;) If it takes 1-2 seconds to get this lock then it
> can take five seconds.  a) that's just gross and b) the NMI watchdog will
> nuke the box.
> 
> Why is it taking so long to get the lock?

on a high level, this is a "feature" of unfair read/write locks in
general. Just have enough processors and a lock that can be taken for
read as a result from a userspace action, and BLAM you have this as a
user triggerable condition... which is effectively a DoS security issue.

> What do we do about it?

read/write spinlocks are effectively silly. There is NO scalability
advantage in practice (well, there would be if you have really long hold
times, which you don't for spinlocks, rwsems are obviously different
there). This may sound counter intuitive.... but nowadays the
scalability cost for taking a lock is in the cache miss for bouncing the
cacheline of the lock to your cpu for write. (once this is done the
actual locked cycle tends to be free or near free)

In this cache bounce aspect, read/write spinlocks are no better than
normal spinlocks. In fact, in the ">1 concurrent readers" case, they are
*worse* than normal spinlocks! 

So I'm entirely on Ingo's side with the "we should get rid of rw
spinlocks as much as we can" proposal; they make no sense whatsoever for
scalability, the only reason they are useful is for recursion...

(well there is a border line case with the rare writer in user context
but the normal users for read in irq context, but even there the
scalability is horrible and this should consider rcu or per-cpu data
realistically)




  reply	other threads:[~2006-06-20  8:06 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-12 19:53 BUG: write-lock lockup Charles C. Bennett, Jr.
2006-06-17 17:07 ` Andrew Morton
2006-06-19  7:02   ` [patch] increase spinlock-debug looping timeouts from 1 sec to 1 min Ingo Molnar
2006-06-19  7:59     ` Andrew Morton
2006-06-19  8:12       ` Ingo Molnar
2006-06-19  8:21         ` Ingo Molnar
2006-06-19  8:32         ` Andrew Morton
2006-06-19  8:35           ` Ingo Molnar
2006-06-19  9:13             ` Andrew Morton
2006-06-19 11:39               ` Ingo Molnar
2006-06-19 19:55                 ` Andrew Morton
2006-06-20  8:06                   ` Arjan van de Ven [this message]
2006-06-20  8:40                   ` [patch] fix spinlock-debug looping Ingo Molnar
2006-06-20  8:52                     ` Andrew Morton
2006-06-20  9:15                       ` Ingo Molnar
2006-06-20  9:32                         ` Andrew Morton
2006-06-20  9:34                           ` Ingo Molnar
2006-06-20 16:02                           ` Dave Olson

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=1150790766.2891.160.camel@laptopd505.fenrus.org \
    --to=arjan@infradead.org \
    --cc=akpm@osdl.org \
    --cc=ccb@acm.org \
    --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

all inboxes | Powered by JetHome®