From: James Bottomley <James.Bottomley@steeleye.com>
To: Hugh Dickins <hugh@veritas.com>
Cc: Andrew Morton <akpm@osdl.org>,
"Martin J. Bligh" <mbligh@aracnet.com>,
Russell King <rmk@arm.linux.org.uk>,
Linux Kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] rmap 22 flush_dcache_mmap_lock
Date: 04 May 2004 17:53:10 -0500 [thread overview]
Message-ID: <1083711195.1660.3.camel@mulgrave> (raw)
In-Reply-To: <Pine.LNX.4.44.0405042320100.2156-100000@localhost.localdomain>
On Tue, 2004-05-04 at 17:22, Hugh Dickins wrote:
> arm and parisc __flush_dcache_page have been scanning the i_mmap(_shared)
> list without locking or disabling preemption. That may be even more
> unsafe now it's a prio tree instead of a list.
>
> It looks like we cannot use i_shared_lock for this protection: most uses
> of flush_dcache_page are okay, and only one would need lock ordering
> fixed (get_user_pages holds page_table_lock across flush_dcache_page);
> but there's a few (e.g. in net and ntfs) which look as if they're using
> it in I/O completion - and it would be restrictive to disallow it there.
>
> So, on arm and parisc only, define flush_dcache_mmap_lock(mapping) as
> spin_lock_irq(&(mapping)->tree_lock); on i386 (and other arches left
> to the next patch) define it away to nothing; and use where needed.
>
> While updating locking hierarchy in filemap.c, remove two layers of the
> fossil record from add_to_page_cache comment: no longer used for swap.
>
> I believe all the #includes will work out, but have only built i386.
> I can see several things about this patch which might cause revulsion:
> the name flush_dcache_mmap_lock? the reuse of the page radix_tree's
> tree_lock for this different purpose? spin_lock_irqsave instead?
> can't we somehow get i_shared_lock to handle the problem?
Hugh,
I thought in a prior discussion with Andrea that there was a generic VM
i_mmap loop that can take rather a long time, and thus we didn't want a
spinlock for this, but a rwlock. Since our critical regions in the
cache flushing are read only, only i_mmap updates (which are short
critical regions) take the write lock with irqsave, all the rest take
the shared read lock with irq.
Unless you've eliminated this long scan from the generic VM, I think the
idea is still better than a simple spinlock.
James
next prev parent reply other threads:[~2004-05-04 22:53 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-05-04 22:18 [PATCH] rmap 20 i_mmap_shared into i_mmap Hugh Dickins
2004-05-04 22:19 ` [PATCH] rmap 21 try_to_unmap_one mapcount Hugh Dickins
2004-05-04 22:22 ` [PATCH] rmap 22 flush_dcache_mmap_lock Hugh Dickins
2004-05-04 22:40 ` Andrew Morton
2004-05-05 0:12 ` Hugh Dickins
2004-05-04 22:53 ` James Bottomley [this message]
2004-05-05 0:29 ` Hugh Dickins
2004-05-04 22:28 ` [PATCH] rmap 23 empty flush_dcache_mmap_lock Hugh Dickins
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=1083711195.1660.3.camel@mulgrave \
--to=james.bottomley@steeleye.com \
--cc=akpm@osdl.org \
--cc=hugh@veritas.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mbligh@aracnet.com \
--cc=rmk@arm.linux.org.uk \
/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