From owner-svn-src-head@freebsd.org Fri Jun 15 15:22:28 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AA4DD100F1B7; Fri, 15 Jun 2018 15:22:28 +0000 (UTC) (envelope-from chuck@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5FD197363E; Fri, 15 Jun 2018 15:22:28 +0000 (UTC) (envelope-from chuck@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4128B192D1; Fri, 15 Jun 2018 15:22:28 +0000 (UTC) (envelope-from chuck@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w5FFMSvN079792; Fri, 15 Jun 2018 15:22:28 GMT (envelope-from chuck@FreeBSD.org) Received: (from chuck@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w5FFMSZI079791; Fri, 15 Jun 2018 15:22:28 GMT (envelope-from chuck@FreeBSD.org) Message-Id: <201806151522.w5FFMSZI079791@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: chuck set sender to chuck@FreeBSD.org using -f From: Chuck Tuffli Date: Fri, 15 Jun 2018 15:22:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r335205 - head/sys/compat/linprocfs X-SVN-Group: head X-SVN-Commit-Author: chuck X-SVN-Commit-Paths: head/sys/compat/linprocfs X-SVN-Commit-Revision: 335205 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 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, 15 Jun 2018 15:22:28 -0000 Author: chuck Date: Fri Jun 15 15:22:27 2018 New Revision: 335205 URL: https://svnweb.freebsd.org/changeset/base/335205 Log: Add linprocfs support for min_free_kbytes This adds linprocfs support for proc/sys/vm/min_free_kbytes which the free program requires for correct operation. The approach mirrors the approach used in illumos. Reviewed by: imp (mentor), emaste Approved by: imp (mentor) Differential Revision: https://reviews.freebsd.org/D15563 Modified: head/sys/compat/linprocfs/linprocfs.c Modified: head/sys/compat/linprocfs/linprocfs.c ============================================================================== --- head/sys/compat/linprocfs/linprocfs.c Fri Jun 15 15:10:21 2018 (r335204) +++ head/sys/compat/linprocfs/linprocfs.c Fri Jun 15 15:22:27 2018 (r335205) @@ -1303,6 +1303,21 @@ linprocfs_dosem(PFS_FILL_ARGS) } /* + * Filler function for proc/sys/vm/min_free_kbytes + * + * This mirrors the approach in illumos to return zero for reads. Effectively, + * it says, no memory is kept in reserve for "atomic allocations". This class + * of allocation can be used at times when a thread cannot be suspended. + */ +static int +linprocfs_dominfree(PFS_FILL_ARGS) +{ + + sbuf_printf(sb, "%d\n", 0); + return (0); +} + +/* * Filler function for proc/scsi/device_info */ static int @@ -1562,6 +1577,7 @@ linprocfs_init(PFS_INIT_ARGS) { struct pfs_node *root; struct pfs_node *dir; + struct pfs_node *sys; root = pi->pi_root; @@ -1643,9 +1659,9 @@ linprocfs_init(PFS_INIT_ARGS) NULL, NULL, NULL, PFS_RD); /* /proc/sys/... */ - dir = pfs_create_dir(root, "sys", NULL, NULL, NULL, 0); + sys = pfs_create_dir(root, "sys", NULL, NULL, NULL, 0); /* /proc/sys/kernel/... */ - dir = pfs_create_dir(dir, "kernel", NULL, NULL, NULL, 0); + dir = pfs_create_dir(sys, "kernel", NULL, NULL, NULL, 0); pfs_create_file(dir, "osrelease", &linprocfs_doosrelease, NULL, NULL, NULL, PFS_RD); pfs_create_file(dir, "ostype", &linprocfs_doostype, @@ -1662,6 +1678,11 @@ linprocfs_init(PFS_INIT_ARGS) /* /proc/sys/kernel/random/... */ dir = pfs_create_dir(dir, "random", NULL, NULL, NULL, 0); pfs_create_file(dir, "uuid", &linprocfs_douuid, + NULL, NULL, NULL, PFS_RD); + + /* /proc/sys/vm/.... */ + dir = pfs_create_dir(sys, "vm", NULL, NULL, NULL, 0); + pfs_create_file(dir, "min_free_kbytes", &linprocfs_dominfree, NULL, NULL, NULL, PFS_RD); return (0);