From: David Howells <dhowells@redhat.com>
To: torvalds@transmeta.com
Cc: manfred@colorfullife.com, andrea@suse.de,
David Howells <dhowells@redhat.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH] Make same-process recursive mm_struct access possible
Date: Thu, 20 Sep 2001 16:24:35 +0100 [thread overview]
Message-ID: <27978.1000999475@warthog.cambridge.redhat.com> (raw)
In-Reply-To: Message from David Howells <dhowells@redhat.com> of "Thu, 20 Sep 2001 13:40:29 BST." <16291.1000989629@warthog.cambridge.redhat.com>
[-- Attachment #1: Type: text/plain, Size: 1556 bytes --]
Based on an idea by Andrea Arcangeli, this patch wraps the rw_semaphore on the
mm_struct (to force you to use special locking operations to access it) and
adds a counter to the task_struct (which counts the number of active read
locks you hold on _your_ mm_struct). The four new ops are:
mm_lock_shared(struct mm_struct *);
mm_unlock_shared(struct mm_struct *);
mm_lock_exclusive(struct mm_struct *);
mm_unlock_exclusive(struct mm_struct *);
* The exclusive ops map directly to down_write() and up_write().
* The unlock-shared op decrements the current mm readlock counter if the mm
unlocked is the current mm; finally it calls up_read().
* The lock-shared op does one of the following two things:
* If the mm being locked is the current mm, and if the current readlock
counter is greater than zero, then it calls down_read_recursive() and
then increments the current readlock counter.
* Otherwise, it just calls down_read() and then increments the current
readlock counter.
down_read_recursive() is a new rw-semaphore operation. It simply adjusts the
semaphore to record an extra active readlock. As specified in the comments
associated with it, it MUST ONLY be called if you know that there is already
an active read lock on the semaphore. Note that it never needs to wait; given
the preconditions for calling it, it knows it can always succeed immediately.
This patch makes no changes to existing rw-semaphore operations. They are
still fair. It simply makes mm_struct locks fair and capable of recursion.
David
[-- Attachment #2: rwsem+mmlock.diff --]
[-- Type: application/octet-stream, Size: 10319 bytes --]
next prev parent reply other threads:[~2001-09-20 15:24 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <masp0008@stud.uni-sb.de>
2001-09-20 10:57 ` Deadlock on the mm->mmap_sem Studierende der Universitaet des Saarlandes
2001-09-20 12:40 ` David Howells
2001-09-20 15:24 ` David Howells [this message]
2001-09-20 18:24 ` Andrea Arcangeli
2001-09-20 21:43 ` Manfred Spraul
2001-09-22 21:06 ` Manfred Spraul
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=27978.1000999475@warthog.cambridge.redhat.com \
--to=dhowells@redhat.com \
--cc=andrea@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=manfred@colorfullife.com \
--cc=torvalds@transmeta.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