Date: Wed, 26 Aug 1998 09:54:08 +0100 (BST) From: Doug Rabson <dfr@nlsystems.com> To: "John S. Dyson" <dyson@iquest.net> Cc: Stephen McKay <syssgm@dtir.qld.gov.au>, freebsd-current@FreeBSD.ORG Subject: Re: Serious bug in vm_page.h in current Message-ID: <Pine.BSF.4.01.9808260953170.17263-100000@herring.nlsystems.com> In-Reply-To: <199808260240.VAA02790@dyson.iquest.net>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 25 Aug 1998, John S. Dyson wrote:
> Stephen McKay said:
> >
> > I was perhaps too brief. All the PAGE_XXX macros would have to change to
> > be consistent (hopefully changed to inline functions at the same time).
> > I had noticed that you were being consistent with existing naming, but the
> > naming used in vm_object.h is clearly better.
> >
> I agree that it is probably time to get rid of the PAGE_XXX macros.
How about this:
Index: vm_page.h
===================================================================
RCS file: /home/ncvs/src/sys/vm/vm_page.h,v
retrieving revision 1.44
diff -u -u -r1.44 vm_page.h
--- vm_page.h 1998/08/24 08:39:38 1.44
+++ vm_page.h 1998/08/26 08:50:32
@@ -281,32 +281,58 @@
* Functions implemented as macros
*/
-#define PAGE_SET_FLAG(m, bits) atomic_set_short(&(m)->flags, bits)
+static __inline void
+vm_page_set_flag(vm_page_t m, unsigned int bits)
+{
+ atomic_set_short(&(m)->flags, bits);
+}
+
+static __inline void
+vm_page_clear_flag(vm_page_t m, unsigned int bits)
+{
+ atomic_clear_short(&(m)->flags, bits);
+}
-#define PAGE_CLEAR_FLAG(m, bits) atomic_clear_short(&(m)->flags, bits)
+#if 0
+static __inline void
+vm_page_assert_wait(vm_page_t m, int interruptible)
+{
+ vm_page_set_flag(m, PG_WANTED);
+ assert_wait((int) m, interruptible);
+}
+#endif
-#define PAGE_ASSERT_WAIT(m, interruptible) { \
- PAGE_SET_FLAG(m, PG_WANTED); \
- assert_wait((int) (m), (interruptible)); \
+static __inline void
+vm_page_busy(vm_page_t m)
+{
+ vm_page_busy(m);
}
-#define PAGE_WAKEUP(m) { \
- PAGE_CLEAR_FLAG(m, PG_BUSY); \
- if (((m)->flags & PG_WANTED) && ((m)->busy == 0)) { \
- PAGE_CLEAR_FLAG(m, PG_WANTED); \
- wakeup((m)); \
- } \
+static __inline void
+vm_page_wakeup(vm_page_t m)
+{
+ vm_page_clear_flag(m, PG_BUSY);
+ if ((m->flags & PG_WANTED) && (m->busy == 0)) {
+ vm_page_clear_flag(m, PG_WANTED);
+ wakeup(m);
+ }
}
-#define PAGE_BUSY(m) atomic_add_char(&(m)->busy, 1)
+static __inline void
+vm_page_start_io(vm_page_t m)
+{
+ atomic_add_char(&(m)->busy, 1);
+}
-#define PAGE_BWAKEUP(m) { \
- atomic_subtract_char(&(m)->busy, 1); \
- if ((((m)->flags & (PG_WANTED | PG_BUSY)) == PG_WANTED) && \
- ((m)->busy == 0)) { \
- PAGE_CLEAR_FLAG(m, PG_WANTED); \
- wakeup((m)); \
- } \
+static __inline void
+vm_page_finish_io(vm_page_t m)
+{
+ atomic_subtract_char(&m->busy, 1);
+ if (((m->flags & (PG_WANTED | PG_BUSY)) == PG_WANTED) &&
+ (m->busy == 0)) {
+ vm_page_clear_flag(m, PG_WANTED);
+ wakeup(m);
+ }
}
@@ -381,11 +407,11 @@
if (prot == VM_PROT_NONE) {
if (mem->flags & (PG_WRITEABLE|PG_MAPPED)) {
pmap_page_protect(VM_PAGE_TO_PHYS(mem), VM_PROT_NONE);
- PAGE_CLEAR_FLAG(mem, PG_WRITEABLE|PG_MAPPED);
+ vm_page_clear_flag(mem, PG_WRITEABLE|PG_MAPPED);
}
} else if ((prot == VM_PROT_READ) && (mem->flags & PG_WRITEABLE)) {
pmap_page_protect(VM_PAGE_TO_PHYS(mem), VM_PROT_READ);
- PAGE_CLEAR_FLAG(mem, PG_WRITEABLE);
+ vm_page_clear_flag(mem, PG_WRITEABLE);
}
}
--
Doug Rabson Mail: dfr@nlsystems.com
Nonlinear Systems Ltd. Phone: +44 181 951 1891
Fax: +44 181 381 1039
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.01.9808260953170.17263-100000>
