From: "Adam J. Richter" <adam@yggdrasil.com>
To: dhowells@redhat.com
Cc: linux-kernel@vger.kernel.org
Subject: Patch: linux-2.5.29 __downgrade_write() for CONFIG_RWSEM_GENERIC_SPINLOCK
Date: Sun, 28 Jul 2002 10:50:58 -0700 [thread overview]
Message-ID: <200207281750.KAA19369@baldur.yggdrasil.com> (raw)
linux-2.5.29 lacks __downgrade_write() platforms that use
CONFIG_RWSEM_GENERIC_SPINLOCK, such as i386 (as opposed to later x86
processors). This causes a compiler warnings for compilations
of numerous files.
Although noting in 2.5.29 appears to use downgrade_write(),
I assume that the facility was added because it is going to be used
in the near future. So, I've added what I think is an implementation
of __downgrade_write for lib/rwsem-spinlock.c. It is the same as
__up_write, except that it sets sem->activity to 1. Since nothing
uses it yet, I haven't tested it.
David, please let me know if you are going to forward this
to Linus, if you want me to submit it to Linus, or if you want to
do something else.
Adam J. Richter __ ______________ 575 Oroville Road
adam@yggdrasil.com \ / Milpitas, California 95035
+1 408 309-6081 | g g d r a s i l United States of America
"Free Software For The Rest Of Us."
--- linux-2.5.29/include/linux/rwsem-spinlock.h 2002-07-26 19:58:39.000000000 -0700
+++ linux/include/linux/rwsem-spinlock.h 2002-07-28 10:38:59.000000000 -0700
@@ -57,6 +57,7 @@
extern void FASTCALL(__down_write(struct rw_semaphore *sem));
extern void FASTCALL(__up_read(struct rw_semaphore *sem));
extern void FASTCALL(__up_write(struct rw_semaphore *sem));
+extern void FASTCALL(__downgrade_write(struct rw_semaphore *sem));
#endif /* __KERNEL__ */
#endif /* _LINUX_RWSEM_SPINLOCK_H */
--- linux-2.5.29/lib/rwsem-spinlock.c 2002-07-26 19:58:30.000000000 -0700
+++ linux/lib/rwsem-spinlock.c 2002-07-28 10:49:30.000000000 -0700
@@ -229,11 +229,30 @@
rwsemtrace(sem,"Leaving __up_write");
}
+/*
+ * downgrade a write lock into a read lock
+ */
+void __downgrade_write(struct rw_semaphore *sem)
+{
+ rwsemtrace(sem,"Entering __downgrade_write");
+
+ spin_lock(&sem->wait_lock);
+
+ sem->activity = 1;
+ if (!list_empty(&sem->wait_list))
+ sem = __rwsem_do_wake(sem);
+
+ spin_unlock(&sem->wait_lock);
+
+ rwsemtrace(sem,"Leaving __downgrade_write");
+}
+
EXPORT_SYMBOL(init_rwsem);
EXPORT_SYMBOL(__down_read);
EXPORT_SYMBOL(__down_write);
EXPORT_SYMBOL(__up_read);
EXPORT_SYMBOL(__up_write);
+EXPORT_SYMBOL(__downgrade_write);
#if RWSEM_DEBUG
EXPORT_SYMBOL(rwsemtrace);
#endif
next reply other threads:[~2002-07-28 17:47 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-07-28 17:50 Adam J. Richter [this message]
2002-07-28 18:07 ` Roman Zippel
2002-07-28 18:08 ` Christoph Hellwig
2002-07-28 22:55 ` Roman Zippel
2002-07-29 7:42 ` David Howells
2002-07-29 8:01 ` Roman Zippel
2002-07-29 8:31 ` David Howells
2002-07-29 9:13 ` David Howells
2002-07-29 11:42 ` Roman Zippel
2002-07-29 12:08 ` David Howells
2002-07-29 12:46 ` Roman Zippel
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=200207281750.KAA19369@baldur.yggdrasil.com \
--to=adam@yggdrasil.com \
--cc=dhowells@redhat.com \
--cc=linux-kernel@vger.kernel.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
all inboxes | Powered by JetHome®