diff options
author | Chuck Tuffli <chuck@FreeBSD.org> | 2018-06-15 15:22:27 +0000 |
---|---|---|
committer | Chuck Tuffli <chuck@FreeBSD.org> | 2018-06-15 15:22:27 +0000 |
commit | d1fa346fac2e4318dc89cc05a393d4541d8fccf0 (patch) | |
tree | 64e7cef1f099370f2a08dd5cd703f82fd0eb0c86 /sys/compat/linprocfs/linprocfs.c | |
parent | 931e2a1a6e0d8ac7d99f48eb7fc744e3a40284f0 (diff) |
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
Notes
Notes:
svn path=/head/; revision=335205
Diffstat (limited to 'sys/compat/linprocfs/linprocfs.c')
-rw-r--r-- | sys/compat/linprocfs/linprocfs.c | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/sys/compat/linprocfs/linprocfs.c b/sys/compat/linprocfs/linprocfs.c index d0551e9cfc84..b4cdea0298a0 100644 --- a/sys/compat/linprocfs/linprocfs.c +++ b/sys/compat/linprocfs/linprocfs.c @@ -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, @@ -1664,6 +1680,11 @@ linprocfs_init(PFS_INIT_ARGS) 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); } |