Date: Thu, 26 Apr 2012 15:50:14 GMT From: Radim Kolar <hsn@filez.com> To: freebsd-bugs@FreeBSD.org Subject: Re: kern/166780: patch for 10.X Message-ID: <201204261550.q3QFoETD031164@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR kern/166780; it has been noted by GNATS. From: Radim Kolar <hsn@filez.com> To: bug-followup@FreeBSD.org Cc: Subject: Re: kern/166780: patch for 10.X Date: Thu, 26 Apr 2012 17:46:17 +0200 Index: sys/vm/swap_pager.c =================================================================== --- sys/vm/swap_pager.c (revision 234696) +++ sys/vm/swap_pager.c (working copy) @@ -2692,3 +2692,20 @@ NODEV); return (0); } + + +static int +sysctl_vm_swap_free(SYSCTL_HANDLER_ARGS) { + int64_t swap_free = 0; + struct swdevt *sp; + + mtx_lock(&sw_dev_mtx); + TAILQ_FOREACH(sp, &swtailq, sw_list) { + swap_free += sp->sw_nblks - sp->sw_used; + } + mtx_unlock(&sw_dev_mtx); + swap_free *= PAGE_SIZE; + return SYSCTL_OUT(req, &swap_free, sizeof(swap_free)); +} +SYSCTL_OID(_vm, OID_AUTO, swap_free, CTLTYPE_S64|CTLFLAG_RD|CTLFLAG_MPSAFE, + NULL, 0, sysctl_vm_swap_free, "Q", "Amount of free swap storage.");
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201204261550.q3QFoETD031164>