aboutsummaryrefslogtreecommitdiff
path: root/sys/compat/linprocfs/linprocfs.c
diff options
context:
space:
mode:
authorDmitry Chagin <dchagin@FreeBSD.org>2022-05-31 08:42:06 +0000
committerDmitry Chagin <dchagin@FreeBSD.org>2022-06-17 19:35:41 +0000
commitb3c809b96f778dad3c1b385d2f772c0944b8b47b (patch)
tree7d7185f5794a8505a9a7ef77767cac559cdb319c /sys/compat/linprocfs/linprocfs.c
parentd37548e01059f7cff3b88bebe894b7519b7fd1e6 (diff)
linprocfs: Add /proc/vm/max_map_count
On Linux this limits the number of maps per mm struct. We don't limit mappings, return a suitable large value. Reviewed by: emaste Differential revision: https://reviews.freebsd.org/D35351 MFC after: 2 weeks (cherry picked from commit 7e2a451119373b7d3f2b3fd062d4ccb099dde022)
Diffstat (limited to 'sys/compat/linprocfs/linprocfs.c')
-rw-r--r--sys/compat/linprocfs/linprocfs.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/sys/compat/linprocfs/linprocfs.c b/sys/compat/linprocfs/linprocfs.c
index e1cc3289ce99..6cf25350d9e8 100644
--- a/sys/compat/linprocfs/linprocfs.c
+++ b/sys/compat/linprocfs/linprocfs.c
@@ -1979,6 +1979,21 @@ linprocfs_do_oom_score_adj(PFS_FILL_ARGS)
}
/*
+ * Filler function for proc/sys/vm/max_map_count
+ *
+ * Maximum number of active map areas, on Linux this limits the number
+ * of vmaps per mm struct. We don't limit mappings, return a suitable
+ * large value.
+ */
+static int
+linprocfs_domax_map_cnt(PFS_FILL_ARGS)
+{
+
+ sbuf_printf(sb, "%d\n", INT32_MAX);
+ return (0);
+}
+
+/*
* Constructor
*/
static int
@@ -2122,6 +2137,8 @@ linprocfs_init(PFS_INIT_ARGS)
dir = pfs_create_dir(sys, "vm", NULL, NULL, NULL, 0);
pfs_create_file(dir, "min_free_kbytes", &linprocfs_dominfree,
NULL, NULL, NULL, PFS_RD);
+ pfs_create_file(dir, "max_map_count", &linprocfs_domax_map_cnt,
+ NULL, NULL, NULL, PFS_RD);
return (0);
}