linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Viro <viro@math.psu.edu>
To: Manfred Spraul <manfreds@colorfullife.com>
Cc: linux-mm@kvack.org
Subject: Re: Contention on ->i_shared_lock in dup_mmap()
Date: Thu, 8 Jun 2000 19:07:19 -0400 (EDT)	[thread overview]
Message-ID: <Pine.GSO.4.10.10006081855220.10800-100000@weyl.math.psu.edu> (raw)
In-Reply-To: <393FC7F4.C8E4B4B6@colorfullife.com>


On Thu, 8 Jun 2000, Manfred Spraul wrote:

> Alexander Viro wrote:
> > 
> > OK, do_syslog() is just plain silly - it's resetting the buffer and code
> > in question looks so:
> >                 spin_lock_irq(&console_lock);
> >                 logged_chars = 0;
> >                 spin_unlock_irq(&console_lock);
> > ... which is for all purposes equivalent to
> >                 if (logged_chars) {
> >                         ...
> >                 }
> > so this one is easy (looks like a klogd silliness).
> > 
> cpu0: do_syslog
> 	logged_chars = 0;
> 
> cpu1: printk()
> 	logged_chars++;
> 
> We really need the spinlock :-(

And? With the current code:

cpu0:					cpu1:
	spin_lock_irq
	logged_chars = 0
	spin_unlock_irq
					spin_lock_irq
					...
					logged_chars++;
	break;

IOW, you have no warranty that upon the exit from do_syslog() you will
have logged_chars == 0 and that's precisely the same as you will get if
you replace the code with
	if (logged_chars) {
		spin_lock_irq(&console_lock);
		logged_chars = 0;
		spin_unlock_irq(&console_lock);
	}
- if logged_chars was non-zero we are getting the same result anyway and
if it was and something was in the middle of a changing it to non-zero -
fine, we just act as if do_syslog() happened before that.

As for the source of contention... beats me. _Probably_ weird mutated
klogd, but I didn't look at the patches RH slapped on it. syslog(5,...) is
damn silly anyway - it's an unavoidable race.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux.eu.org/Linux-MM/

      reply	other threads:[~2000-06-08 23:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-06-08  3:45 Alexander Viro
2000-06-08 14:19 ` Stephen C. Tweedie
2000-06-08 16:21 ` Manfred Spraul
2000-06-08 23:07   ` Alexander Viro [this message]

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=Pine.GSO.4.10.10006081855220.10800-100000@weyl.math.psu.edu \
    --to=viro@math.psu.edu \
    --cc=linux-mm@kvack.org \
    --cc=manfreds@colorfullife.com \
    /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