From: Andrea Arcangeli <andrea@suse.de>
To: Rajesh Venkatasubramanian <vrajesh@umich.edu>
Cc: "Martin J. Bligh" <mbligh@aracnet.com>,
Hugh Dickins <hugh@veritas.com>,
linux-kernel@vger.kernel.org, Andrew Morton <akpm@osdl.org>
Subject: Re: [PATCH] anobjrmap 9 priority mjb tree
Date: Thu, 15 Apr 2004 15:00:28 +0200 [thread overview]
Message-ID: <20040415130028.GB2150@dualathlon.random> (raw)
In-Reply-To: <Pine.GSO.4.58.0404142323160.21462@sapphire.engin.umich.edu>
On Wed, Apr 14, 2004 at 11:40:52PM -0400, Rajesh Venkatasubramanian wrote:
>
> > > 2) However, vmas can be added and removed from a vm_set list
> > > by just holding the read lock and a bit lock (vm_set_lock)
> > > in the corresponding prio_tree node.
> >
> > no way, you cannot bitflip vm_flags unless you own the mmap_sem, this
> > patch seems very broken to me, it should randomly corrupt memory in
> > vma->vm_flags while racing against mprotect etc.. or am I missing
> > something?
>
> I don't know why bit_spin_lock with vma->vm_flags should be a problem
> if it is used without mmap_sem. Can you explain ?
you seem not to know all rules about the atomic operations in smp, you
cannot just set_bit on one side and use non-atomic operations on the
other side, and expect the set_bit not to invalidate the non-atomic
operations.
The effect of the mprotect may be deleted by your new concurrent
set_bit and stuff like that.
> If it is really racy to use bit_spin_lock on vm_flags without mmap_sem
it __definitely__ is racy.
> Well. In that case, we can use rwsem as you mentioned below: take
> down_write on all modifications and take down_read on pageout. Here, you
exactly, this also avoids the more complex (and racy, but the racy would
be easy to fix by adding another 4 atomic bytes to the vma) double
locking that you introduced.
> allow multiple parallel page_referenced and try_to_unmap on the same
> inode, however with only one modification at a time.
exactly.
> Wherease my solution will allow multiple modifications at the same
> time (if possible) with only one pageout routine at a time. I chose
> this solution because Martin's SDET took big hit in common cases of
> adding and removing vmas from the i_mmap{_shared} data structure.
you can still fix the smp race condition by trivially adding 4 bytes to
the vma (i.e. a vma->vm_flags_atomic), but I'd be surprised if your
double locking actually improve things, Martin is running on a very
parallel old-numa where cacheline bouncing across nodes pass through a
fibre channel IIRC, and the cacheline bouncing that the semaphore
generates is huge, it's not necessairly huge contention, it's just the
bouncing that hurts, and the down_read won't help at all for the
cacheline trashing, it'll still bounce like before. Though you may gain
something minor, but I doubt it'd be huge.
I'd suggest Martin to give a try to the racy code, it's just good enough
for a pratical experiment (the race shouldn't easily trigger so it
probably passes one run of SDET safely).
next prev parent reply other threads:[~2004-04-15 13:00 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-04-04 12:33 Hugh Dickins
2004-04-09 20:39 ` Martin J. Bligh
2004-04-09 21:31 ` Rajesh Venkatasubramanian
2004-04-09 21:40 ` Martin J. Bligh
2004-04-09 23:17 ` Rajesh Venkatasubramanian
2004-04-09 21:51 ` Hugh Dickins
2004-04-09 22:01 ` Martin J. Bligh
2004-04-09 22:56 ` Martin J. Bligh
2004-04-11 16:09 ` Hugh Dickins
2004-04-11 17:28 ` Martin J. Bligh
2004-04-12 4:32 ` Rajesh Venkatasubramanian
2004-04-12 5:24 ` Martin J. Bligh
2004-04-12 15:46 ` Martin J. Bligh
2004-04-12 18:43 ` Hugh Dickins
2004-04-12 18:58 ` Rajesh Venkatasubramanian
2004-04-12 19:01 ` Martin J. Bligh
2004-04-12 19:10 ` Hugh Dickins
2004-04-12 19:38 ` Rajesh Venkatasubramanian
2004-04-12 21:14 ` Martin J. Bligh
2004-04-12 21:12 ` Andrew Morton
2004-04-12 21:43 ` Martin J. Bligh
2004-04-14 20:18 ` Rajesh Venkatasubramanian
2004-04-15 0:05 ` Andrea Arcangeli
2004-04-15 0:22 ` Martin J. Bligh
2004-04-15 3:40 ` Rajesh Venkatasubramanian
2004-04-15 6:23 ` Martin J. Bligh
2004-04-15 10:26 ` Hugh Dickins
2004-04-15 12:52 ` Andrea Arcangeli
2004-04-15 15:40 ` Martin J. Bligh
2004-04-15 16:55 ` Hugh Dickins
2004-04-15 17:14 ` Martin J. Bligh
2004-04-15 17:50 ` Hugh Dickins
2004-04-15 18:42 ` Dave McCracken
[not found] ` <192710000.1082052992@flay>
2004-04-15 18:47 ` Rajesh Venkatasubramanian
2004-04-15 22:40 ` Andrea Arcangeli
2004-04-15 22:33 ` Andrea Arcangeli
2004-04-15 13:00 ` Andrea Arcangeli [this message]
2004-04-15 14:41 ` Rajesh Venkatasubramanian
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=20040415130028.GB2150@dualathlon.random \
--to=andrea@suse.de \
--cc=akpm@osdl.org \
--cc=hugh@veritas.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mbligh@aracnet.com \
--cc=vrajesh@umich.edu \
/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®