Skip to contentSkip to conversation

Increase limit of max_user_watches from 1/25 to 1/16

PATCH In review Eric Curtin 1 participant 2 messages Jan 20, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Increase limit of max_user_watches from 1/25 to 1/16

The current default value for max_user_watches is the 1/16 (6.25%) of the available low memory, divided for the "watch" cost in bytes.

Tools like inotify-tools and visual studio code, seem to hit these limits a little to easy.

Also amending the documentation, it referred to an old value for this.

---
 Documentation/admin-guide/sysctl/fs.rst | 4 ++--
 fs/eventpoll.c                          | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
Documentation/admin-guide/sysctl/fs.rst +2 -2
index f48277a0a850..f7fe45e69c41 100644
@@ -380,5 +380,5 @@ This configuration option sets the maximum number of "watches" that are
 allowed for each user.
 Each "watch" costs roughly 90 bytes on a 32bit kernel, and roughly 160 bytes
 on a 64bit one.
-The current default value for  max_user_watches  is the 1/32 of the available
-low memory, divided for the "watch" cost in bytes.
+The current default value for  max_user_watches  is the 1/16 (6.25%) of the
+available low memory, divided for the "watch" cost in bytes.
fs/eventpoll.c +2 -2
index a829af074eb5..de9ef8f6d0b2 100644
@@ -2352,9 +2352,9 @@ static int __init eventpoll_init(void)
 
 	si_meminfo(&si);
 	/*
-	 * Allows top 4% of lomem to be allocated for epoll watches (per user).
+	 * Allows top 6.25% of lomem to be allocated for epoll watches (per user).
 	 */
-	max_user_watches = (((si.totalram - si.totalhigh) / 25) << PAGE_SHIFT) /
+	max_user_watches = (((si.totalram - si.totalhigh) / 16) << PAGE_SHIFT) /
 		EP_ITEM_COST;
 	BUG_ON(max_user_watches < 0);
 
Signature · 1 line
2.25.1
#1 lore raw
Quoted 44 lines · Eric Curtin

The current default value for max_user_watches is the 1/16 (6.25%) of the available low memory, divided for the "watch" cost in bytes.

Tools like inotify-tools and visual studio code, seem to hit these limits a little to easy.

Also amending the documentation, it referred to an old value for this.

---
 Documentation/admin-guide/sysctl/fs.rst | 4 ++--
 fs/eventpoll.c                          | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
Documentation/admin-guide/sysctl/fs.rst +2 -2
index f48277a0a850..f7fe45e69c41 100644
@@ -380,5 +380,5 @@ This configuration option sets the maximum number of "watches" that are
 allowed for each user.
 Each "watch" costs roughly 90 bytes on a 32bit kernel, and roughly 160 bytes
 on a 64bit one.
-The current default value for  max_user_watches  is the 1/32 of the available
-low memory, divided for the "watch" cost in bytes.
+The current default value for  max_user_watches  is the 1/16 (6.25%) of the
+available low memory, divided for the "watch" cost in bytes.
fs/eventpoll.c +2 -3
index a829af074eb5..de9ef8f6d0b2 100644
@@ -2352,9 +2352,9 @@ static int __init eventpoll_init(void)
 
        si_meminfo(&si);
        /*
-        * Allows top 4% of lomem to be allocated for epoll watches (per user).
+        * Allows top 6.25% of lomem to be allocated for epoll watches (per user).
         */
-       max_user_watches = (((si.totalram - si.totalhigh) / 25) << PAGE_SHIFT) /
+       max_user_watches = (((si.totalram - si.totalhigh) / 16) << PAGE_SHIFT) /
                EP_ITEM_COST;
        BUG_ON(max_user_watches < 0);
 
--
Quoted 2 lines

2.25.1

Please ignore this, this is the wrong limit (an epoll one), I sent another patch just
to update the documentation to be correct. Weiman Long already kindly solved the issue in 92890123749bafc317bbfacbe0a62ce08d78efb7

Separate patch is titled "[PATCH] Update
Documentation/admin-guide/sysctl/fs.rst"