summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorglebius <glebius@FreeBSD.org>2013-09-06 05:37:49 +0000
committerglebius <glebius@FreeBSD.org>2013-09-06 05:37:49 +0000
commit358d3d145a0923158cfe4823195e4c60f4e37249 (patch)
tree95660228ea128a00ac5ae55cbb3e3b550d776d01 /sys
parent5110b054b22685516ac8b828fb0e43187ce8a532 (diff)
downloadFreeBSD-src-358d3d145a0923158cfe4823195e4c60f4e37249.zip
FreeBSD-src-358d3d145a0923158cfe4823195e4c60f4e37249.tar.gz
On those machines, where sf_bufs do not represent any real object, make
sf_buf_alloc()/sf_buf_free() inlines, to save two calls to an absolutely empty functions. Reviewed by: alc, kib, scottl Sponsored by: Nginx, Inc. Sponsored by: Netflix
Diffstat (limited to 'sys')
-rw-r--r--sys/amd64/amd64/vm_machdep.c22
-rw-r--r--sys/amd64/include/sf_buf.h12
-rw-r--r--sys/ia64/ia64/vm_machdep.c22
-rw-r--r--sys/ia64/include/sf_buf.h12
-rw-r--r--sys/mips/include/sf_buf.h12
-rw-r--r--sys/mips/mips/vm_machdep.c10
6 files changed, 39 insertions, 51 deletions
diff --git a/sys/amd64/amd64/vm_machdep.c b/sys/amd64/amd64/vm_machdep.c
index 3e961e9..7253fe2 100644
--- a/sys/amd64/amd64/vm_machdep.c
+++ b/sys/amd64/amd64/vm_machdep.c
@@ -59,7 +59,6 @@ __FBSDID("$FreeBSD$");
#include <sys/mutex.h>
#include <sys/pioctl.h>
#include <sys/proc.h>
-#include <sys/sf_buf.h>
#include <sys/smp.h>
#include <sys/sysctl.h>
#include <sys/sysent.h>
@@ -695,27 +694,6 @@ cpu_reset_real()
}
/*
- * Allocate an sf_buf for the given vm_page. On this machine, however, there
- * is no sf_buf object. Instead, an opaque pointer to the given vm_page is
- * returned.
- */
-struct sf_buf *
-sf_buf_alloc(struct vm_page *m, int pri)
-{
-
- return ((struct sf_buf *)m);
-}
-
-/*
- * Free the sf_buf. In fact, do nothing because there are no resources
- * associated with the sf_buf.
- */
-void
-sf_buf_free(struct sf_buf *sf)
-{
-}
-
-/*
* Software interrupt handler for queued VM system processing.
*/
void
diff --git a/sys/amd64/include/sf_buf.h b/sys/amd64/include/sf_buf.h
index b5245e6..729e8e5 100644
--- a/sys/amd64/include/sf_buf.h
+++ b/sys/amd64/include/sf_buf.h
@@ -41,6 +41,18 @@
*/
struct sf_buf;
+static inline struct sf_buf *
+sf_buf_alloc(struct vm_page *m, int pri)
+{
+
+ return ((struct sf_buf *)m);
+}
+
+static inline void
+sf_buf_free(struct sf_buf *sf)
+{
+}
+
static __inline vm_offset_t
sf_buf_kva(struct sf_buf *sf)
{
diff --git a/sys/ia64/ia64/vm_machdep.c b/sys/ia64/ia64/vm_machdep.c
index 09987fd..186897b 100644
--- a/sys/ia64/ia64/vm_machdep.c
+++ b/sys/ia64/ia64/vm_machdep.c
@@ -79,7 +79,6 @@
#include <sys/vmmeter.h>
#include <sys/kernel.h>
#include <sys/mbuf.h>
-#include <sys/sf_buf.h>
#include <sys/sysctl.h>
#include <sys/unistd.h>
@@ -353,27 +352,6 @@ cpu_exit(struct thread *td)
}
/*
- * Allocate an sf_buf for the given vm_page. On this machine, however, there
- * is no sf_buf object. Instead, an opaque pointer to the given vm_page is
- * returned.
- */
-struct sf_buf *
-sf_buf_alloc(struct vm_page *m, int pri)
-{
-
- return ((struct sf_buf *)m);
-}
-
-/*
- * Free the sf_buf. In fact, do nothing because there are no resources
- * associated with the sf_buf.
- */
-void
-sf_buf_free(struct sf_buf *sf)
-{
-}
-
-/*
* Software interrupt handler for queued VM system processing.
*/
void
diff --git a/sys/ia64/include/sf_buf.h b/sys/ia64/include/sf_buf.h
index 75bcdfa..44d0109 100644
--- a/sys/ia64/include/sf_buf.h
+++ b/sys/ia64/include/sf_buf.h
@@ -41,6 +41,18 @@
*/
struct sf_buf;
+static inline struct sf_buf *
+sf_buf_alloc(struct vm_page *m, int pri)
+{
+
+ return ((struct sf_buf *)m);
+}
+
+static inline void
+sf_buf_free(struct sf_buf *sf)
+{
+}
+
static __inline vm_page_t
sf_buf_page(struct sf_buf *sf)
{
diff --git a/sys/mips/include/sf_buf.h b/sys/mips/include/sf_buf.h
index b9efaf0..00502a0 100644
--- a/sys/mips/include/sf_buf.h
+++ b/sys/mips/include/sf_buf.h
@@ -41,6 +41,18 @@
/* In 64 bit the whole memory is directly mapped */
struct sf_buf;
+static inline struct sf_buf *
+sf_buf_alloc(struct vm_page *m, int pri)
+{
+
+ return ((struct sf_buf *)m);
+}
+
+static inline void
+sf_buf_free(struct sf_buf *sf)
+{
+}
+
static __inline vm_offset_t
sf_buf_kva(struct sf_buf *sf)
{
diff --git a/sys/mips/mips/vm_machdep.c b/sys/mips/mips/vm_machdep.c
index 86dfde9..c42f640 100644
--- a/sys/mips/mips/vm_machdep.c
+++ b/sys/mips/mips/vm_machdep.c
@@ -76,7 +76,9 @@ __FBSDID("$FreeBSD$");
#include <sys/user.h>
#include <sys/mbuf.h>
+#ifndef __mips_n64
#include <sys/sf_buf.h>
+#endif
#ifndef NSFBUFS
#define NSFBUFS (512 + maxusers * 16)
@@ -523,7 +525,6 @@ sf_buf_init(void *arg)
}
sf_buf_alloc_want = 0;
}
-#endif
/*
* Get an sf_buf from the freelist. Will block if none are available.
@@ -531,7 +532,6 @@ sf_buf_init(void *arg)
struct sf_buf *
sf_buf_alloc(struct vm_page *m, int flags)
{
-#ifndef __mips_n64
struct sf_buf *sf;
int error;
@@ -560,9 +560,6 @@ sf_buf_alloc(struct vm_page *m, int flags)
}
mtx_unlock(&sf_freelist.sf_lock);
return (sf);
-#else
- return ((struct sf_buf *)m);
-#endif
}
/*
@@ -571,7 +568,6 @@ sf_buf_alloc(struct vm_page *m, int flags)
void
sf_buf_free(struct sf_buf *sf)
{
-#ifndef __mips_n64
pmap_qremove(sf->kva, 1);
mtx_lock(&sf_freelist.sf_lock);
SLIST_INSERT_HEAD(&sf_freelist.sf_head, sf, free_list);
@@ -579,8 +575,8 @@ sf_buf_free(struct sf_buf *sf)
if (sf_buf_alloc_want > 0)
wakeup(&sf_freelist);
mtx_unlock(&sf_freelist.sf_lock);
-#endif
}
+#endif /* !__mips_n64 */
/*
* Software interrupt handler for queued VM system processing.
OpenPOWER on IntegriCloud