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
This commit is contained in:
parent
bc07d95d93
commit
37f8f0ac3b
@ -1302,6 +1302,21 @@ linprocfs_dosem(PFS_FILL_ARGS)
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user