From owner-svn-src-head@FreeBSD.ORG Fri Jun 1 08:28:27 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 124231065670; Fri, 1 Jun 2012 08:28:27 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id 814EB8FC14; Fri, 1 Jun 2012 08:28:26 +0000 (UTC) Received: from skuns.kiev.zoral.com.ua (localhost [127.0.0.1]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id q518S7XL023490; Fri, 1 Jun 2012 11:28:07 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.5/8.14.5) with ESMTP id q518S607052985; Fri, 1 Jun 2012 11:28:06 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.5/8.14.5/Submit) id q518S6W0052984; Fri, 1 Jun 2012 11:28:06 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 1 Jun 2012 11:28:06 +0300 From: Konstantin Belousov To: Eitan Adler Message-ID: <20120601082806.GR2358@deviant.kiev.zoral.com.ua> References: <201206010442.q514gqqv084148@svn.freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="KHxoa/2yf2SjDQvg" Content-Disposition: inline In-Reply-To: <201206010442.q514gqqv084148@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.0 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r236380 - head/sys/vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Jun 2012 08:28:27 -0000 --KHxoa/2yf2SjDQvg Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Jun 01, 2012 at 04:42:52AM +0000, Eitan Adler wrote: > Author: eadler > Date: Fri Jun 1 04:42:52 2012 > New Revision: 236380 > URL: http://svn.freebsd.org/changeset/base/236380 >=20 > Log: > Add sysctl to query amount of swap space free > =20 > PR: kern/166780 > Submitted by: Radim Kolar > Approved by: cperciva > MFC after: 1 week >=20 > Modified: > head/sys/vm/swap_pager.c The commit messages lack any rationale for the change. The rationale specified in the PR is wrong, there _is_ the sysctl interface to read the swap use, vm.swap_info.N. It is used by e.g. swapinfo(8)/libkvm(3) on live system. >=20 > Modified: head/sys/vm/swap_pager.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/vm/swap_pager.c Fri Jun 1 04:34:49 2012 (r236379) > +++ head/sys/vm/swap_pager.c Fri Jun 1 04:42:52 2012 (r236380) > @@ -2692,3 +2692,18 @@ swaponvp(struct thread *td, struct vnode > NODEV); > return (0); > } > + > +static int > +sysctl_vm_swap_free(SYSCTL_HANDLER_ARGS) { > + int swap_free, used; > + int total; > + > + swap_pager_status(&total, &used); > + > + swap_free =3D (total - used) * PAGE_SIZE; > + return SYSCTL_OUT(req, &swap_free, sizeof(swap_free)); > +} This just overflows at swap sizes greater then 2GB. > + > +SYSCTL_OID(_vm, OID_AUTO, swap_free, CTLTYPE_INT|CTLFLAG_RD|CTLFLAG_MPSA= FE, > + NULL, 0, sysctl_vm_swap_free, "Q", > + "Blocks of free swap storage."); Please revert the commit. --KHxoa/2yf2SjDQvg Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (FreeBSD) iEYEARECAAYFAk/IfRYACgkQC3+MBN1Mb4jbxwCglxOXsoKwgOSPPe26n20E/vYY hWAAniG9a3SxbtiBOs+euXhw0ZQUdcOt =OWVg -----END PGP SIGNATURE----- --KHxoa/2yf2SjDQvg--