public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrea Arcangeli <andrea@suse.de>
To: Andreas Dilger <adilger@turbolinux.com>
Cc: lvm-devel@sistina.com, Andi Kleen <ak@suse.de>,
	Lance Larsh <llarsh@oracle.com>,
	Brian Strand <bstrand@switchmanagement.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [lvm-devel] Re: 2x Oracle slowdown from 2.2.16 to 2.4.4
Date: Thu, 12 Jul 2001 20:18:19 +0200	[thread overview]
Message-ID: <20010712201819.C19011@athlon.random> (raw)
In-Reply-To: <20010712114512.J779@athlon.random> <200107121704.f6CH4d6j027383@webber.adilger.int>
In-Reply-To: <200107121704.f6CH4d6j027383@webber.adilger.int>; from adilger@turbolinux.com on Thu, Jul 12, 2001 at 11:04:39AM -0600

On Thu, Jul 12, 2001 at 11:04:39AM -0600, Andreas Dilger wrote:
> Andrea writes:
> > > Wouldn't a single semaphore be enough BTW to cover both? 
> > 
> > Actually the _pe_lock is global and it's hold for a short time so it
> > can make some sense. And if you look closely you'll see that _pe_lock
> > should _definitely_ be a rw_spinlock not a rw_semaphore. I didn't
> > changed that though just to keep the patch smaller and to avoid changing
> > the semantics of the lock, the only thing that matters for us is to
> > never block and to have a fast read fast path which is provided just
> > fine by the rwsem (i'll left the s/sem/spinlock/ to the CVS).
> 
> Actually, I have already fixed the _pe_lock problem in LVM CVS, so that
> it is not acquired on the fast path.  The cases where a PV is being moved

ok, btw if you care to write correct C code you should also declare
.lock as volatile or gcc has the rights to miscompile your code.

> is very rare and only affects the write path, so I check rw == WRITE
> and pe_lock_req.lock == LOCK_PE, before getting _pe_lock and re-checking
> pe_lock_req.lock.  This does not affect the semantics of the operation.
> 
> Note also that the current kernel LVM code holds the _pe_lock for the
> entire time it is flushing write requests from the queue, when it does
> not need to do so.  My changes (also in LVM CVS) fix this as well.
> I have attached the patch which should take beta7 to current CVS in
> this regard.  Please take a look.

Ok, I will thanks.

> Note that your current patch is broken by the use of rwsems, because
> _pe_lock also protects the _pe_requests list, which you modify under
> up_read() (you can't upgrade a read lock to a write lock, AFAIK), so
> you always need a write lock whenever you get _pe_lock.  With my changes
> there will be very little contention on _pe_lock, as it is off the fast
> path and only held for a few asm instructions at a time.

Yes, there's a race condition when people moves PV around, thanks for
noticing it.

> It is also a good thing that you fixed up lv_snapshot_sem, which was
> also on the fast path, but at least that was a per-LV semaphore, unlike
> _pe_lock which was global.  But I don't think you can complain about it,
> because I think you were the one that added it ;-).

Definitely wrong, I added it only to the snapshot case, it wasn't
definitely in the fast path hitten by Oracle. Somebody (not me) moved it
into the main fast path of lvm, and as said in the earlier email when I
found it used that way I was scared as soon as I seen it.  Incidentally
infact it is still called lv_snapshot_sem because it wasn't renamed yet.

Go back into the old releases (or back to 2.2) and you will see where I
put the lv_snapshot_sem.

So definitely don't complain at me if the lv_snapshot_sem was hurting
the fast path.

> Note, how does this all apply to 2.2 kernels?  I don't think rwsems
> existed then, nor rwspinlocks, did they?

2.2 have no semaphores in the fast path so this doesn't apply to 2.2 at
all (it may have race conditions though). 2.2 only had the
lv_snapshot_sem in the snapshot I/O code, which is the one I added to
fix the race conditions, but it wasn't at all related to the fast path
hitten by Oracle as said above.

Andrea

  reply	other threads:[~2001-07-12 18:18 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-07-11  0:45 2x Oracle slowdown from 2.2.16 to 2.4.4 Brian Strand
2001-07-11  1:15 ` Andrea Arcangeli
2001-07-11 16:44   ` Brian Strand
2001-07-11 17:08     ` Andrea Arcangeli
2001-07-11 17:23       ` Chris Mason
2001-07-11 23:03     ` Lance Larsh
2001-07-11 23:46       ` Brian Strand
2001-07-12 15:21         ` Lance Larsh
2001-07-12 21:31           ` Hans Reiser
2001-07-12 21:51             ` Chris Mason
2001-07-13  3:00           ` Andrew Morton
2001-07-13  4:17             ` Andrew Morton
2001-07-13 15:36               ` Jeffrey W. Baker
2001-07-13 15:49                 ` Andrew Morton
2001-07-16 22:03                 ` Stephen C. Tweedie
2001-07-12  0:23       ` Chris Mason
2001-07-12 14:48         ` Lance Larsh
2001-07-12  2:30       ` Andrea Arcangeli
2001-07-12  9:26         ` [lvm-devel] " Andi Kleen
2001-07-12  9:45           ` Andrea Arcangeli
2001-07-12 17:04             ` Andreas Dilger
2001-07-12 18:18               ` Andrea Arcangeli [this message]
2001-07-12 22:55                 ` Andrea Arcangeli
2001-07-13  7:35                   ` Andreas Dilger
2001-07-13 16:07                     ` Andrea Arcangeli
2001-07-12  6:12       ` parviz dey
2001-07-11  2:58 ` Jeff V. Merkey
2001-07-11 15:55   ` Brian Strand
2001-07-11  2:59 ` Jeff V. Merkey

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=20010712201819.C19011@athlon.random \
    --to=andrea@suse.de \
    --cc=adilger@turbolinux.com \
    --cc=ak@suse.de \
    --cc=bstrand@switchmanagement.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llarsh@oracle.com \
    --cc=lvm-devel@sistina.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