From 5ee0575d03c8d49b1ebf1781508113d121e29168 Mon Sep 17 00:00:00 2001 From: Michael Kerrisk Date: Fri, 16 Jan 2009 21:34:35 +1300 Subject: [PATCH] epoll.7: Document /proc interfaces for limiting kernel memory usage Document the following /proc files that were added in Linux 2.6.28: /proc/sys/fs/epoll/max_user_instances /proc/sys/fs/epoll/max_user_watches Signed-off-by: Michael Kerrisk --- man7/epoll.7 | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/man7/epoll.7 b/man7/epoll.7 index 37f76bdb6..f35dbb312 100644 --- a/man7/epoll.7 +++ b/man7/epoll.7 @@ -18,7 +18,7 @@ .\" .\" Davide Libenzi .\" -.TH EPOLL 7 2008-11-04 "Linux" "Linux Programmer's Manual" +.TH EPOLL 7 2009-01-17 "Linux" "Linux Programmer's Manual" .SH NAME epoll \- I/O event notification facility .SH SYNOPSIS @@ -166,6 +166,27 @@ it is the caller's responsibility to rearm the file descriptor using .BR epoll_ctl (2) with .BR EPOLL_CTL_MOD . +.SS /proc interfaces +The following interfaces can be used to limit the amount of +kernel memory consumed by epoll: +.TP +.IR /proc/sys/fs/epoll/max_user_instances " (since Linux 2.6.28)" +This specifies an upper limit on the number of epoll instances +that can be created per real user ID. +.TP +.IR /proc/sys/fs/epoll/max_user_watches " (since Linux 2.6.28)" +This specifies a limit on the total number of +file descriptors that a user can register across +all epoll instances on the system. +The limit is per real user ID. +Each registered file descriptor costs roughly 90 bytes on a 32-bit kernel, +and roughly 160 bytes on a 64-bit kernel. +Currently, +.\" 2.6.28 +the default value for +.I max_user_watches +is 1/32 of the available low memory, +divided by the registration cost in bytes. .SS Example for Suggested Usage While the usage of .B epoll