From: "Stephen C. Tweedie" <sct@redhat.com>
To: Andrea Arcangeli <andrea@e-mind.com>, Zlatko.Calusic@CARNet.hr
Cc: Linux-MM List <linux-mm@kvack.org>, Andi Kleen <andi@zero.aec.at>
Subject: Re: Update shared mappings
Date: Mon, 30 Nov 1998 13:52:08 GMT [thread overview]
Message-ID: <199811301352.NAA03313@dax.scot.redhat.com> (raw)
In-Reply-To: <87btm3dmxy.fsf@atlas.CARNet.hr>
Hi,
On 20 Nov 1998 05:10:01 +0100, Zlatko Calusic <Zlatko.Calusic@CARNet.hr>
said:
> Should this patch be applied to kernel? [Andrea's
> update_shared_mappings patch]
No.
> Index: 129.2/mm/filemap.c
> --- 129.2/mm/filemap.c Thu, 19 Nov 1998 18:20:34 +0100 zcalusic (linux-2.1/y/b/29_filemap.c 1.2.4.1.1.1.1.1 644)
> +++ 129.3/mm/filemap.c Fri, 20 Nov 1998 05:07:24 +0100 zcalusic (linux-2.1/y/b/29_filemap.c 1.2.4.1.1.1.1.2 644)
> @@ -5,6 +5,10 @@
> */
> +static void update_one_shared_mapping(struct vm_area_struct *shared,
> + unsigned long address, pte_t orig_pte)
> +{
> + pgd_t *pgd;
> + pmd_t *pmd;
> + pte_t *pte;
> + struct semaphore * mmap_sem = &shared->vm_mm->mmap_sem;
> +
> + down(mmap_sem);
The mmap_semaphore is already taken out _much_ earlier on in msync(), or
the vm_area_struct can be destroyed by another thread. Is this patch
tested? Won't we deadlock immediately on doing this extra down()
operation?
The only reason that this patch works in its current state is that
exit_mmap() skips the down(&mm->mmap_sem). It can safely do so only
because if we are exiting the mmap, we know we are the last thread and
so no other thread can be playing games with us. So, exit_mmap()
doesn't deadlock, but a sys_msync() on the region looks as if it will.
Other than that, it looks fine. One other thing occurs to me, though:
it would be easy enough to add a condition (atomic_read(&page->count) >
2) on this to disable the update-mappings call entirely if the page is
only mapped by one vma (which will be a very common case). We already
access the count field, so we are avoiding the cost of any extra cache
misses if we make this check.
Comments?
--Stephen
--
This is a majordomo managed list. To unsubscribe, send a message with
the body 'unsubscribe linux-mm me@address' to: majordomo@kvack.org
next prev parent reply other threads:[~1998-11-29 18:45 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
1998-11-20 4:10 Zlatko Calusic
1998-11-30 13:52 ` Stephen C. Tweedie [this message]
1998-11-30 15:19 ` Zlatko Calusic
1998-11-30 20:02 ` Andrea Arcangeli
1998-12-01 15:03 ` Stephen C. Tweedie
1998-12-01 17:48 ` Andrea Arcangeli
1998-12-02 16:21 ` Stephen C. Tweedie
1998-12-02 18:32 ` Andrea Arcangeli
1998-12-03 5:44 ` Eric W. Biederman
1998-12-03 11:56 ` Stephen C. Tweedie
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=199811301352.NAA03313@dax.scot.redhat.com \
--to=sct@redhat.com \
--cc=Zlatko.Calusic@CARNet.hr \
--cc=andi@zero.aec.at \
--cc=andrea@e-mind.com \
--cc=linux-mm@kvack.org \
/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