Re: [CFT/CFR] machine independent sf_bufs

2014-07-29 Thread Gleb Smirnoff
On Wed, Jul 30, 2014 at 01:34:46PM +0800, Kevin Lo wrote:
K> I tested your patch on FreeBSD/arm (OpenBlocks AX3), it seems to be working
K> fine.

Thanks a lot, Kevin!

-- 
Totus tuus, Glebius.
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: [CFT/CFR] machine independent sf_bufs

2014-07-29 Thread Kevin Lo
On Tue, Jul 29, 2014 at 10:00:43PM +0400, Gleb Smirnoff wrote:
> 
> On Tue, Jul 29, 2014 at 07:29:43PM +0200, Michael Tuexen wrote:
> M> >  Sorry for top quoting, this is to annoy you :) I got zero
> M> > replies on the below email during a week. I'd really appreciate
> M> > testing on different platforms. Any takers?
> M> OK, it works on an Raspberry pi running r269231 with your patch.
> M> The only suspicious thing I observed was that the number of
> M> 'requests for I/O initiated by sendfile' in netstat -m doesn't
> M> always increase. I would expect that. However, I'm not sure if
> M> this is ARM related (I would not think so) or is related to your
> M> patch at all.
> 
> Thanks a lot, Michael!
> 
> The observation on number of I/Os is absolutely okay, since VM
> cashes pages.

Hi Gleb,

I tested your patch on FreeBSD/arm (OpenBlocks AX3), it seems to be working
fine.

> -- 
> Totus tuus, Glebius.

Kevin
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: [CFT/CFR] machine independent sf_bufs

2014-07-29 Thread Michael Tuexen
On 29 Jul 2014, at 20:00, Gleb Smirnoff  wrote:

> On Tue, Jul 29, 2014 at 07:29:43PM +0200, Michael Tuexen wrote:
> M> >  Sorry for top quoting, this is to annoy you :) I got zero
> M> > replies on the below email during a week. I'd really appreciate
> M> > testing on different platforms. Any takers?
> M> OK, it works on an Raspberry pi running r269231 with your patch.
> M> The only suspicious thing I observed was that the number of
> M> 'requests for I/O initiated by sendfile' in netstat -m doesn't
> M> always increase. I would expect that. However, I'm not sure if
> M> this is ARM related (I would not think so) or is related to your
> M> patch at all.
> 
> Thanks a lot, Michael!
> 
> The observation on number of I/Os is absolutely okay, since VM
> cashes pages.
Ahh, OK, makes sense. I was transmitting the same file several times...

Best regards
Michael
> 
> 
> -- 
> Totus tuus, Glebius.
> 

___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: [CFT/CFR] machine independent sf_bufs

2014-07-29 Thread Gleb Smirnoff
On Tue, Jul 29, 2014 at 07:29:43PM +0200, Michael Tuexen wrote:
M> >  Sorry for top quoting, this is to annoy you :) I got zero
M> > replies on the below email during a week. I'd really appreciate
M> > testing on different platforms. Any takers?
M> OK, it works on an Raspberry pi running r269231 with your patch.
M> The only suspicious thing I observed was that the number of
M> 'requests for I/O initiated by sendfile' in netstat -m doesn't
M> always increase. I would expect that. However, I'm not sure if
M> this is ARM related (I would not think so) or is related to your
M> patch at all.

Thanks a lot, Michael!

The observation on number of I/Os is absolutely okay, since VM
cashes pages.


-- 
Totus tuus, Glebius.
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: [CFT/CFR] machine independent sf_bufs

2014-07-29 Thread Michael Tuexen
On 29 Jul 2014, at 12:41, Gleb Smirnoff  wrote:

>  Hi!
> 
>  Sorry for top quoting, this is to annoy you :) I got zero
> replies on the below email during a week. I'd really appreciate
> testing on different platforms. Any takers?
OK, it works on an Raspberry pi running r269231 with your patch.
The only suspicious thing I observed was that the number of
'requests for I/O initiated by sendfile' in netstat -m doesn't
always increase. I would expect that. However, I'm not sure if
this is ARM related (I would not think so) or is related to your
patch at all.

Let me know if you need more information.

Best regards
Michael
> 
> On Sat, Jul 19, 2014 at 10:27:25AM +0400, Gleb Smirnoff wrote:
> T>   Hi!
> T> 
> T>   we've got a lot of common code in sys/*/*/vm_machdep.c wrt the
> T> sf_buf allocation. I have gathered it into kern/subr_sfbuf.c.
> T> 
> T> o No MD code left in sys/*/*/vm_machdep.c.
> T> o The arches that have physical map have their implementation in
> T>   machine/sf_buf.h
> T> o The arches that needs sf_bufs use subr_sfbuf.c, optionally having
> T>   some stuff in machine/sf_buf.h
> T> 
> T> I can test only i386. I'd be grateful for testing:
> T> 
> T> arm
> T> mips
> T> mips64
> T> sparc64
> T> powerpc
> T> i386 XEN
> T> 
> T> The test is a simple use of any applcation or test that uses sendfile(2).
> T> The box shouldn't crash :) of course, and after end of a test there
> T> should be no evidence of sf_buf leak (observed via netstat -m).
> T> 
> T> -- 
> T> Totus tuus, Glebius.
> 
> T> Index: sys/amd64/include/sf_buf.h
> T> ===
> T> --- sys/amd64/include/sf_buf.h (revision 268750)
> T> +++ sys/amd64/include/sf_buf.h (working copy)
> T> @@ -29,10 +29,6 @@
> T>  #ifndef _MACHINE_SF_BUF_H_
> T>  #define _MACHINE_SF_BUF_H_
> T>  
> T> -#include 
> T> -#include 
> T> -#include 
> T> -
> T>  /*
> T>   * On this machine, the only purpose for which sf_buf is used is to 
> implement
> T>   * an opaque pointer required by the machine-independent parts of the 
> kernel.
> T> @@ -39,21 +35,7 @@
> T>   * That pointer references the vm_page that is "mapped" by the sf_buf.  
> The
> T>   * actual mapping is provided by the direct virtual-to-physical mapping.  
> T>   */
> T> -struct sf_buf;
> T> -
> T> -static inline struct sf_buf *
> T> -sf_buf_alloc(struct vm_page *m, int pri)
> T> -{
> T> -
> T> -  return ((struct sf_buf *)m);
> T> -}
> T> -
> T> -static inline void
> T> -sf_buf_free(struct sf_buf *sf)
> T> -{
> T> -}
> T> -
> T> -static __inline vm_offset_t
> T> +static inline vm_offset_t
> T>  sf_buf_kva(struct sf_buf *sf)
> T>  {
> T>  
> T> @@ -60,11 +42,10 @@ sf_buf_kva(struct sf_buf *sf)
> T>return (PHYS_TO_DMAP(VM_PAGE_TO_PHYS((vm_page_t)sf)));
> T>  }
> T>  
> T> -static __inline vm_page_t
> T> +static inline vm_page_t
> T>  sf_buf_page(struct sf_buf *sf)
> T>  {
> T>  
> T>return ((vm_page_t)sf);
> T>  }
> T> -
> T>  #endif /* !_MACHINE_SF_BUF_H_ */
> T> Index: sys/arm/arm/vm_machdep.c
> T> ===
> T> --- sys/arm/arm/vm_machdep.c   (revision 268750)
> T> +++ sys/arm/arm/vm_machdep.c   (working copy)
> T> @@ -50,7 +50,6 @@ __FBSDID("$FreeBSD$");
> T>  #include 
> T>  #include 
> T>  #include 
> T> -#include 
> T>  #include 
> T>  #include 
> T>  #include 
> T> @@ -83,43 +82,7 @@ __FBSDID("$FreeBSD$");
> T>  CTASSERT(sizeof(struct switchframe) == 24);
> T>  CTASSERT(sizeof(struct trapframe) == 80);
> T>  
> T> -#ifndef NSFBUFS
> T> -#define NSFBUFS   (512 + maxusers * 16)
> T> -#endif
> T> -
> T> -static int nsfbufs;
> T> -static int nsfbufspeak;
> T> -static int nsfbufsused;
> T> -
> T> -SYSCTL_INT(_kern_ipc, OID_AUTO, nsfbufs, CTLFLAG_RDTUN, &nsfbufs, 0,
> T> -"Maximum number of sendfile(2) sf_bufs available");
> T> -SYSCTL_INT(_kern_ipc, OID_AUTO, nsfbufspeak, CTLFLAG_RD, &nsfbufspeak, 0,
> T> -"Number of sendfile(2) sf_bufs at peak usage");
> T> -SYSCTL_INT(_kern_ipc, OID_AUTO, nsfbufsused, CTLFLAG_RD, &nsfbufsused, 0,
> T> -"Number of sendfile(2) sf_bufs in use");
> T> -
> T> -static void sf_buf_init(void *arg);
> T> -SYSINIT(sock_sf, SI_SUB_MBUF, SI_ORDER_ANY, sf_buf_init, NULL);
> T> -
> T> -LIST_HEAD(sf_head, sf_buf);
> T> -
> T>  /*
> T> - * A hash table of active sendfile(2) buffers
> T> - */
> T> -static struct sf_head *sf_buf_active;
> T> -static u_long sf_buf_hashmask;
> T> -
> T> -#define SF_BUF_HASH(m)  (((m) - vm_page_array) & sf_buf_hashmask)
> T> -
> T> -static TAILQ_HEAD(, sf_buf) sf_buf_freelist;
> T> -static u_intsf_buf_alloc_want;
> T> -
> T> -/*
> T> - * A lock used to synchronize access to the hash table and free list
> T> - */
> T> -static struct mtx sf_buf_lock;
> T> -
> T> -/*
> T>   * Finish a fork operation, with process p2 nearly set up.
> T>   * Copy and update the pcb, set up the stack so that the child
> T>   * ready to run and return to user mode.
> T> @@ -184,107 +147,7 @@ cpu_thread_swapou

Re: [CFT/CFR] machine independent sf_bufs

2014-07-29 Thread Michael Tuexen
On 29 Jul 2014, at 12:41, Gleb Smirnoff  wrote:

> Hi!
> 
> Sorry for top quoting, this is to annoy you :) I got zero
> replies on the below email during a week. I'd really appreciate
> testing on different platforms. Any takers?
I can try to test it on a raspberry pi, building a patched kernel
right now.

Best regards
Michael
> 
> On Sat, Jul 19, 2014 at 10:27:25AM +0400, Gleb Smirnoff wrote:
> T>   Hi!
> T> 
> T>   we've got a lot of common code in sys/*/*/vm_machdep.c wrt the
> T> sf_buf allocation. I have gathered it into kern/subr_sfbuf.c.
> T> 
> T> o No MD code left in sys/*/*/vm_machdep.c.
> T> o The arches that have physical map have their implementation in
> T>   machine/sf_buf.h
> T> o The arches that needs sf_bufs use subr_sfbuf.c, optionally having
> T>   some stuff in machine/sf_buf.h
> T> 
> T> I can test only i386. I'd be grateful for testing:
> T> 
> T> arm
> T> mips
> T> mips64
> T> sparc64
> T> powerpc
> T> i386 XEN
> T> 
> T> The test is a simple use of any applcation or test that uses sendfile(2).
> T> The box shouldn't crash :) of course, and after end of a test there
> T> should be no evidence of sf_buf leak (observed via netstat -m).
> T> 
> T> -- 
> T> Totus tuus, Glebius.
> 
> T> Index: sys/amd64/include/sf_buf.h
> T> ===
> T> --- sys/amd64/include/sf_buf.h (revision 268750)
> T> +++ sys/amd64/include/sf_buf.h (working copy)
> T> @@ -29,10 +29,6 @@
> T>  #ifndef _MACHINE_SF_BUF_H_
> T>  #define _MACHINE_SF_BUF_H_
> T>  
> T> -#include 
> T> -#include 
> T> -#include 
> T> -
> T>  /*
> T>   * On this machine, the only purpose for which sf_buf is used is to 
> implement
> T>   * an opaque pointer required by the machine-independent parts of the 
> kernel.
> T> @@ -39,21 +35,7 @@
> T>   * That pointer references the vm_page that is "mapped" by the sf_buf.  
> The
> T>   * actual mapping is provided by the direct virtual-to-physical mapping.  
> T>   */
> T> -struct sf_buf;
> T> -
> T> -static inline struct sf_buf *
> T> -sf_buf_alloc(struct vm_page *m, int pri)
> T> -{
> T> -
> T> -  return ((struct sf_buf *)m);
> T> -}
> T> -
> T> -static inline void
> T> -sf_buf_free(struct sf_buf *sf)
> T> -{
> T> -}
> T> -
> T> -static __inline vm_offset_t
> T> +static inline vm_offset_t
> T>  sf_buf_kva(struct sf_buf *sf)
> T>  {
> T>  
> T> @@ -60,11 +42,10 @@ sf_buf_kva(struct sf_buf *sf)
> T>return (PHYS_TO_DMAP(VM_PAGE_TO_PHYS((vm_page_t)sf)));
> T>  }
> T>  
> T> -static __inline vm_page_t
> T> +static inline vm_page_t
> T>  sf_buf_page(struct sf_buf *sf)
> T>  {
> T>  
> T>return ((vm_page_t)sf);
> T>  }
> T> -
> T>  #endif /* !_MACHINE_SF_BUF_H_ */
> T> Index: sys/arm/arm/vm_machdep.c
> T> ===
> T> --- sys/arm/arm/vm_machdep.c   (revision 268750)
> T> +++ sys/arm/arm/vm_machdep.c   (working copy)
> T> @@ -50,7 +50,6 @@ __FBSDID("$FreeBSD$");
> T>  #include 
> T>  #include 
> T>  #include 
> T> -#include 
> T>  #include 
> T>  #include 
> T>  #include 
> T> @@ -83,43 +82,7 @@ __FBSDID("$FreeBSD$");
> T>  CTASSERT(sizeof(struct switchframe) == 24);
> T>  CTASSERT(sizeof(struct trapframe) == 80);
> T>  
> T> -#ifndef NSFBUFS
> T> -#define NSFBUFS   (512 + maxusers * 16)
> T> -#endif
> T> -
> T> -static int nsfbufs;
> T> -static int nsfbufspeak;
> T> -static int nsfbufsused;
> T> -
> T> -SYSCTL_INT(_kern_ipc, OID_AUTO, nsfbufs, CTLFLAG_RDTUN, &nsfbufs, 0,
> T> -"Maximum number of sendfile(2) sf_bufs available");
> T> -SYSCTL_INT(_kern_ipc, OID_AUTO, nsfbufspeak, CTLFLAG_RD, &nsfbufspeak, 0,
> T> -"Number of sendfile(2) sf_bufs at peak usage");
> T> -SYSCTL_INT(_kern_ipc, OID_AUTO, nsfbufsused, CTLFLAG_RD, &nsfbufsused, 0,
> T> -"Number of sendfile(2) sf_bufs in use");
> T> -
> T> -static void sf_buf_init(void *arg);
> T> -SYSINIT(sock_sf, SI_SUB_MBUF, SI_ORDER_ANY, sf_buf_init, NULL);
> T> -
> T> -LIST_HEAD(sf_head, sf_buf);
> T> -
> T>  /*
> T> - * A hash table of active sendfile(2) buffers
> T> - */
> T> -static struct sf_head *sf_buf_active;
> T> -static u_long sf_buf_hashmask;
> T> -
> T> -#define SF_BUF_HASH(m)  (((m) - vm_page_array) & sf_buf_hashmask)
> T> -
> T> -static TAILQ_HEAD(, sf_buf) sf_buf_freelist;
> T> -static u_intsf_buf_alloc_want;
> T> -
> T> -/*
> T> - * A lock used to synchronize access to the hash table and free list
> T> - */
> T> -static struct mtx sf_buf_lock;
> T> -
> T> -/*
> T>   * Finish a fork operation, with process p2 nearly set up.
> T>   * Copy and update the pcb, set up the stack so that the child
> T>   * ready to run and return to user mode.
> T> @@ -184,107 +147,7 @@ cpu_thread_swapout(struct thread *td)
> T>  {
> T>  }
> T>  
> T> -/*
> T> - * Detatch mapped page and release resources back to the system.
> T> - */
> T>  void
> T> -sf_buf_free(struct sf_buf *sf)
> T> -{
> T> -
> T> -   mtx_lock(&sf_buf_lock);
> T> -   sf->ref_count--;
> T> -   if (sf->ref_count == 0) {
> T> - 

Re: [CFT/CFR] machine independent sf_bufs

2014-07-29 Thread Gleb Smirnoff
  Hi!

  Sorry for top quoting, this is to annoy you :) I got zero
replies on the below email during a week. I'd really appreciate
testing on different platforms. Any takers?

On Sat, Jul 19, 2014 at 10:27:25AM +0400, Gleb Smirnoff wrote:
T>   Hi!
T> 
T>   we've got a lot of common code in sys/*/*/vm_machdep.c wrt the
T> sf_buf allocation. I have gathered it into kern/subr_sfbuf.c.
T> 
T> o No MD code left in sys/*/*/vm_machdep.c.
T> o The arches that have physical map have their implementation in
T>   machine/sf_buf.h
T> o The arches that needs sf_bufs use subr_sfbuf.c, optionally having
T>   some stuff in machine/sf_buf.h
T> 
T> I can test only i386. I'd be grateful for testing:
T> 
T> arm
T> mips
T> mips64
T> sparc64
T> powerpc
T> i386 XEN
T> 
T> The test is a simple use of any applcation or test that uses sendfile(2).
T> The box shouldn't crash :) of course, and after end of a test there
T> should be no evidence of sf_buf leak (observed via netstat -m).
T> 
T> -- 
T> Totus tuus, Glebius.

T> Index: sys/amd64/include/sf_buf.h
T> ===
T> --- sys/amd64/include/sf_buf.h   (revision 268750)
T> +++ sys/amd64/include/sf_buf.h   (working copy)
T> @@ -29,10 +29,6 @@
T>  #ifndef _MACHINE_SF_BUF_H_
T>  #define _MACHINE_SF_BUF_H_
T>  
T> -#include 
T> -#include 
T> -#include 
T> -
T>  /*
T>   * On this machine, the only purpose for which sf_buf is used is to 
implement
T>   * an opaque pointer required by the machine-independent parts of the 
kernel.
T> @@ -39,21 +35,7 @@
T>   * That pointer references the vm_page that is "mapped" by the sf_buf.  The
T>   * actual mapping is provided by the direct virtual-to-physical mapping.  
T>   */
T> -struct sf_buf;
T> -
T> -static inline struct sf_buf *
T> -sf_buf_alloc(struct vm_page *m, int pri)
T> -{
T> -
T> -return ((struct sf_buf *)m);
T> -}
T> -
T> -static inline void
T> -sf_buf_free(struct sf_buf *sf)
T> -{
T> -}
T> -
T> -static __inline vm_offset_t
T> +static inline vm_offset_t
T>  sf_buf_kva(struct sf_buf *sf)
T>  {
T>  
T> @@ -60,11 +42,10 @@ sf_buf_kva(struct sf_buf *sf)
T>  return (PHYS_TO_DMAP(VM_PAGE_TO_PHYS((vm_page_t)sf)));
T>  }
T>  
T> -static __inline vm_page_t
T> +static inline vm_page_t
T>  sf_buf_page(struct sf_buf *sf)
T>  {
T>  
T>  return ((vm_page_t)sf);
T>  }
T> -
T>  #endif /* !_MACHINE_SF_BUF_H_ */
T> Index: sys/arm/arm/vm_machdep.c
T> ===
T> --- sys/arm/arm/vm_machdep.c (revision 268750)
T> +++ sys/arm/arm/vm_machdep.c (working copy)
T> @@ -50,7 +50,6 @@ __FBSDID("$FreeBSD$");
T>  #include 
T>  #include 
T>  #include 
T> -#include 
T>  #include 
T>  #include 
T>  #include 
T> @@ -83,43 +82,7 @@ __FBSDID("$FreeBSD$");
T>  CTASSERT(sizeof(struct switchframe) == 24);
T>  CTASSERT(sizeof(struct trapframe) == 80);
T>  
T> -#ifndef NSFBUFS
T> -#define NSFBUFS (512 + maxusers * 16)
T> -#endif
T> -
T> -static int nsfbufs;
T> -static int nsfbufspeak;
T> -static int nsfbufsused;
T> -
T> -SYSCTL_INT(_kern_ipc, OID_AUTO, nsfbufs, CTLFLAG_RDTUN, &nsfbufs, 0,
T> -"Maximum number of sendfile(2) sf_bufs available");
T> -SYSCTL_INT(_kern_ipc, OID_AUTO, nsfbufspeak, CTLFLAG_RD, &nsfbufspeak, 0,
T> -"Number of sendfile(2) sf_bufs at peak usage");
T> -SYSCTL_INT(_kern_ipc, OID_AUTO, nsfbufsused, CTLFLAG_RD, &nsfbufsused, 0,
T> -"Number of sendfile(2) sf_bufs in use");
T> -
T> -static void sf_buf_init(void *arg);
T> -SYSINIT(sock_sf, SI_SUB_MBUF, SI_ORDER_ANY, sf_buf_init, NULL);
T> -
T> -LIST_HEAD(sf_head, sf_buf);
T> -
T>  /*
T> - * A hash table of active sendfile(2) buffers
T> - */
T> -static struct sf_head *sf_buf_active;
T> -static u_long sf_buf_hashmask;
T> -
T> -#define SF_BUF_HASH(m)  (((m) - vm_page_array) & sf_buf_hashmask)
T> -
T> -static TAILQ_HEAD(, sf_buf) sf_buf_freelist;
T> -static u_intsf_buf_alloc_want;
T> -
T> -/*
T> - * A lock used to synchronize access to the hash table and free list
T> - */
T> -static struct mtx sf_buf_lock;
T> -
T> -/*
T>   * Finish a fork operation, with process p2 nearly set up.
T>   * Copy and update the pcb, set up the stack so that the child
T>   * ready to run and return to user mode.
T> @@ -184,107 +147,7 @@ cpu_thread_swapout(struct thread *td)
T>  {
T>  }
T>  
T> -/*
T> - * Detatch mapped page and release resources back to the system.
T> - */
T>  void
T> -sf_buf_free(struct sf_buf *sf)
T> -{
T> -
T> - mtx_lock(&sf_buf_lock);
T> - sf->ref_count--;
T> - if (sf->ref_count == 0) {
T> - TAILQ_INSERT_TAIL(&sf_buf_freelist, sf, free_entry);
T> - nsfbufsused--;
T> - pmap_kremove(sf->kva);
T> - sf->m = NULL;
T> - LIST_REMOVE(sf, list_entry);
T> - if (sf_buf_alloc_want > 0)
T> - wakeup(&sf_buf_freelist);
T> - }
T> - mtx_unlock(&sf_buf_lock);
T> -}
T> -
T> -/*
T> - * Allocate a pool of sf_bufs (sendfile(2) or "super-fast" if you prefer. 
:-))

[CFT/CFR] machine independent sf_bufs

2014-07-18 Thread Gleb Smirnoff
  Hi!

  we've got a lot of common code in sys/*/*/vm_machdep.c wrt the
sf_buf allocation. I have gathered it into kern/subr_sfbuf.c.

o No MD code left in sys/*/*/vm_machdep.c.
o The arches that have physical map have their implementation in
  machine/sf_buf.h
o The arches that needs sf_bufs use subr_sfbuf.c, optionally having
  some stuff in machine/sf_buf.h

I can test only i386. I'd be grateful for testing:

arm
mips
mips64
sparc64
powerpc
i386 XEN

The test is a simple use of any applcation or test that uses sendfile(2).
The box shouldn't crash :) of course, and after end of a test there
should be no evidence of sf_buf leak (observed via netstat -m).

-- 
Totus tuus, Glebius.
Index: sys/amd64/include/sf_buf.h
===
--- sys/amd64/include/sf_buf.h	(revision 268750)
+++ sys/amd64/include/sf_buf.h	(working copy)
@@ -29,10 +29,6 @@
 #ifndef _MACHINE_SF_BUF_H_
 #define _MACHINE_SF_BUF_H_
 
-#include 
-#include 
-#include 
-
 /*
  * On this machine, the only purpose for which sf_buf is used is to implement
  * an opaque pointer required by the machine-independent parts of the kernel.
@@ -39,21 +35,7 @@
  * That pointer references the vm_page that is "mapped" by the sf_buf.  The
  * actual mapping is provided by the direct virtual-to-physical mapping.  
  */
-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
+static inline vm_offset_t
 sf_buf_kva(struct sf_buf *sf)
 {
 
@@ -60,11 +42,10 @@ sf_buf_kva(struct sf_buf *sf)
 	return (PHYS_TO_DMAP(VM_PAGE_TO_PHYS((vm_page_t)sf)));
 }
 
-static __inline vm_page_t
+static inline vm_page_t
 sf_buf_page(struct sf_buf *sf)
 {
 
 	return ((vm_page_t)sf);
 }
-
 #endif /* !_MACHINE_SF_BUF_H_ */
Index: sys/arm/arm/vm_machdep.c
===
--- sys/arm/arm/vm_machdep.c	(revision 268750)
+++ sys/arm/arm/vm_machdep.c	(working copy)
@@ -50,7 +50,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -83,43 +82,7 @@ __FBSDID("$FreeBSD$");
 CTASSERT(sizeof(struct switchframe) == 24);
 CTASSERT(sizeof(struct trapframe) == 80);
 
-#ifndef NSFBUFS
-#define NSFBUFS		(512 + maxusers * 16)
-#endif
-
-static int nsfbufs;
-static int nsfbufspeak;
-static int nsfbufsused;
-
-SYSCTL_INT(_kern_ipc, OID_AUTO, nsfbufs, CTLFLAG_RDTUN, &nsfbufs, 0,
-"Maximum number of sendfile(2) sf_bufs available");
-SYSCTL_INT(_kern_ipc, OID_AUTO, nsfbufspeak, CTLFLAG_RD, &nsfbufspeak, 0,
-"Number of sendfile(2) sf_bufs at peak usage");
-SYSCTL_INT(_kern_ipc, OID_AUTO, nsfbufsused, CTLFLAG_RD, &nsfbufsused, 0,
-"Number of sendfile(2) sf_bufs in use");
-
-static void sf_buf_init(void *arg);
-SYSINIT(sock_sf, SI_SUB_MBUF, SI_ORDER_ANY, sf_buf_init, NULL);
-
-LIST_HEAD(sf_head, sf_buf);
-
 /*
- * A hash table of active sendfile(2) buffers
- */
-static struct sf_head *sf_buf_active;
-static u_long sf_buf_hashmask;
-
-#define SF_BUF_HASH(m)  (((m) - vm_page_array) & sf_buf_hashmask)
-
-static TAILQ_HEAD(, sf_buf) sf_buf_freelist;
-static u_intsf_buf_alloc_want;
-
-/*
- * A lock used to synchronize access to the hash table and free list
- */
-static struct mtx sf_buf_lock;
-
-/*
  * Finish a fork operation, with process p2 nearly set up.
  * Copy and update the pcb, set up the stack so that the child
  * ready to run and return to user mode.
@@ -184,107 +147,7 @@ cpu_thread_swapout(struct thread *td)
 {
 }
 
-/*
- * Detatch mapped page and release resources back to the system.
- */
 void
-sf_buf_free(struct sf_buf *sf)
-{
-
-	 mtx_lock(&sf_buf_lock);
-	 sf->ref_count--;
-	 if (sf->ref_count == 0) {
-		 TAILQ_INSERT_TAIL(&sf_buf_freelist, sf, free_entry);
-		 nsfbufsused--;
-		 pmap_kremove(sf->kva);
-		 sf->m = NULL;
-		 LIST_REMOVE(sf, list_entry);
-		 if (sf_buf_alloc_want > 0)
-			 wakeup(&sf_buf_freelist);
-	 }
-	 mtx_unlock(&sf_buf_lock);
-}
-
-/*
- * Allocate a pool of sf_bufs (sendfile(2) or "super-fast" if you prefer. :-))
- */
-static void
-sf_buf_init(void *arg)
-{
-	struct sf_buf *sf_bufs;
-	vm_offset_t sf_base;
-	int i;
-
-	nsfbufs = NSFBUFS;
-	TUNABLE_INT_FETCH("kern.ipc.nsfbufs", &nsfbufs);
-		
-	sf_buf_active = hashinit(nsfbufs, M_TEMP, &sf_buf_hashmask);
-	TAILQ_INIT(&sf_buf_freelist);
-	sf_base = kva_alloc(nsfbufs * PAGE_SIZE);
-	sf_bufs = malloc(nsfbufs * sizeof(struct sf_buf), M_TEMP,
-	M_NOWAIT | M_ZERO);
-	for (i = 0; i < nsfbufs; i++) {
-		sf_bufs[i].kva = sf_base + i * PAGE_SIZE;
-		TAILQ_INSERT_TAIL(&sf_buf_freelist, &sf_bufs[i], free_entry);
-	}
-	sf_buf_alloc_want = 0;
-	mtx_init(&sf_buf_lock, "sf_buf", NULL, MTX_DEF);
-}
-
-/*
- * Get an sf_buf from the freelist. Will block if none are available.
- */
-struct sf_buf *
-sf_buf_alloc(struct vm_page *m, int flags)
-{
-	struct sf_head *hash_list;
-	struct sf_buf *sf;
-	int error;
-
-	h