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
This commit is contained in:
Dmitry Chagin 2022-05-31 11:42:06 +03:00
parent 037dd0a967
commit 7e2a451119

View File

@ -1978,6 +1978,21 @@ linprocfs_do_oom_score_adj(PFS_FILL_ARGS)
return (0);
}
/*
* 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
*/
@ -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);
}