Sysctl interface to UNIX_INFLIGHT_TRIGGER_GC v.2
Subsystems (4)
PATCH 1/1 Sysctl interface to UNIX_INFLIGHT_TRIGGER_GC v.2
Sysctl interface to UNIX_INFLIGHT_TRIGGER_GC.
IMHO convenient for testing.
Documentation/networking/ip-sysctl.txt | 4 ++++ include/net/af_unix.h | 1 + net/unix/garbage.c | 5 ++--- net/unix/sysctl_net_unix.c | 9 +++++++++ 4 files changed, 16 insertions(+), 3 deletions(-)
Documentation/networking/ip-sysctl.txt +4 -0
@@ -1463,6 +1463,10 @@ max_dgram_qlen - INTEGER Default: 10 +inflight_trigger_gc - INTEGER + The maximal number of inflight sockets for force garbage collect. + + Default: 16000 UNDOCUMENTED:
include/net/af_unix.h +1 -0
@@ -15,6 +15,7 @@ extern struct sock *unix_get_socket(struct file *filp);#define UNIX_HASH_SIZE 256extern unsigned int unix_tot_inflight; +extern unsigned int sysctl_inflight_trigger_gc;struct unix_address {atomic_t refcnt;
net/unix/garbage.c +2 -3
@@ -94,7 +94,7 @@ static DEFINE_SPINLOCK(unix_gc_lock);static DECLARE_WAIT_QUEUE_HEAD (unix_gc_wait);unsigned int unix_tot_inflight; - +unsigned int sysctl_inflight_trigger_gc =16000 ;struct sock *unix_get_socket (struct file *filp) {
@@ -259,7 +259,6 @@ static void inc_inflight_move_tail(struct unix_sock *u) }static bool gc_in_progress = false; -#define UNIX_INFLIGHT_TRIGGER_GC 16000void wait_for_unix_gc (void ) {
@@ -267,7 +266,7 @@ void wait_for_unix_gc(void)* If number of inflight sockets is insane, * force a garbage collect right now. */ -if (unix_tot_inflight >UNIX_INFLIGHT_TRIGGER_GC && !gc_in_progress) +if (unix_tot_inflight > sysctl_inflight_trigger_gc && !gc_in_progress)unix_gc ();wait_event (unix_gc_wait, gc_in_progress == false); }
net/unix/sysctl_net_unix.c +9 -0
@@ -23,6 +23,13 @@ static ctl_table unix_table[] = { .mode = 0644, .proc_handler = proc_dointvec }, + { + .procname = "inflight_trigger_gc", + .data = &sysctl_inflight_trigger_gc, + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = proc_dointvec + }, { } };
@@ -41,6 +48,8 @@ int __net_init unix_sysctl_register(struct net *net) goto err_alloc; table[0 ].data = &net->unx.sysctl_max_dgram_qlen; + table[1 ].data = &sysctl_inflight_trigger_gc; + net->unx.ctl =register_net_sysctl_table (net, unix_path, table);if (net->unx.ctl ==NULL ) goto err_reg;
---
Pavel Vasilyev wrote, at 12/10/2010 01:26 AM:
Documentation/networking/ip-sysctl.txt max_dgram_qlen - INTEGER · line 1469
Quoted 7 lines
Sysctl interface to
UNIX_INFLIGHT_TRIGGER_GC.
IMHO convenient for testing.Documentation/networking/ip-sysctl.txt +4
-0+inflight_trigger_gc - INTEGER + The maximal number of inflight sockets for force garbage collect. + + Default: 16000
1) For lower payload and enough memory, it's not necessary to force garbage collection. So set it to 0, disable gc.
2) Copy your patch to the mail, for other guys to review it.
Signature · 3 lines
Best Regards ----- Shan Wei
Re: [PATCH] Sysctl interface to UNIX_INFLIGHT_TRIGGER_GC v.3
Quoted 11 lines · Shan Wei
Pavel Vasilyev wrote, at 12/10/2010 01:26 AM:
Review
Quoted 7 lines
Sysctl interface to
UNIX_INFLIGHT_TRIGGER_GC.
IMHO convenient for testing.(quoted diff) +4
-0+inflight_trigger_gc - INTEGER + The maximal number of inflight sockets for force garbage collect. + + Default: 160001) For lower payload and enough memory, it's not necessary to force garbage collection. So set it to 0, disable gc.
May be, set default to 2000, and zero to disable
Quoted 1 line
2) Copy your patch to the mail, for other guys to review it.
Where me find other guys? :)
Signature · 1 line
Pavel.
Documentation/networking/ip-sysctl.txt | 6 ++++++ include/net/af_unix.h | 1 + net/unix/garbage.c | 8 +++++--- net/unix/sysctl_net_unix.c | 9 +++++++++ 4 files changed, 21 insertions(+), 3 deletions(-)
Documentation/networking/ip-sysctl.txt +6 -0
@@ -1463,6 +1463,12 @@ max_dgram_qlen - INTEGER Default: 10 +inflight_trigger_gc - INTEGER + The maximal number of inflight sockets for force garbage collect. + + 0 - disable force garbage collection. + + Default: 2000 UNDOCUMENTED:
include/net/af_unix.h +1 -0
@@ -15,6 +15,7 @@ extern struct sock *unix_get_socket(struct file *filp);#define UNIX_HASH_SIZE 256extern unsigned int unix_tot_inflight; +extern unsigned int sysctl_inflight_trigger_gc;struct unix_address {atomic_t refcnt;
net/unix/garbage.c +5 -3
@@ -94,7 +94,7 @@ static DEFINE_SPINLOCK(unix_gc_lock);static DECLARE_WAIT_QUEUE_HEAD (unix_gc_wait);unsigned int unix_tot_inflight; - +unsigned int sysctl_inflight_trigger_gc =2000 ;struct sock *unix_get_socket (struct file *filp) {
@@ -259,7 +259,6 @@ static void inc_inflight_move_tail(struct unix_sock *u) }static bool gc_in_progress = false; -#define UNIX_INFLIGHT_TRIGGER_GC 16000void wait_for_unix_gc (void ) {
@@ -267,8 +266,11 @@ void wait_for_unix_gc(void)* If number of inflight sockets is insane, * force a garbage collect right now. */ -if (unix_tot_inflight >UNIX_INFLIGHT_TRIGGER_GC && !gc_in_progress) +if (!sysctl_inflight_trigger_gc && + (unix_tot_inflight > sysctl_inflight_trigger_gc + && !gc_in_progress))unix_gc (); +wait_event (unix_gc_wait, gc_in_progress == false); }
net/unix/sysctl_net_unix.c +9 -0
@@ -23,6 +23,13 @@ static ctl_table unix_table[] = { .mode = 0644, .proc_handler = proc_dointvec }, + { + .procname = "inflight_trigger_gc", + .data = &sysctl_inflight_trigger_gc, + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = proc_dointvec + }, { } };
@@ -41,6 +48,8 @@ int __net_init unix_sysctl_register(struct net *net) goto err_alloc; table[0 ].data = &net->unx.sysctl_max_dgram_qlen; + table[1 ].data = &sysctl_inflight_trigger_gc; + net->unx.ctl =register_net_sysctl_table (net, unix_path, table);if (net->unx.ctl ==NULL ) goto err_reg;
---
Re: [PATCH] Sysctl interface to UNIX_INFLIGHT_TRIGGER_GC v.3
Quoted 14 lines · Pavel Vasilyev
Quoted 11 lines · Shan Wei
Pavel Vasilyev wrote, at 12/10/2010 01:26 AM:
Documentation/networking/ip-sysctl.txt max_dgram_qlen - INTEGER
Quoted 7 lines
Sysctl interface to
UNIX_INFLIGHT_TRIGGER_GC.
IMHO convenient for testing.Documentation/networking/ip-sysctl.txt +4
-0+inflight_trigger_gc - INTEGER + The maximal number of inflight sockets for force garbage collect. + + Default: 160001) For lower payload and enough memory, it's not necessary to force garbage collection. So set it to 0, disable gc.
Quoted 2 lines
May be, set default to 2000, and zero to disable
zero to disable ?
Maybe you missed commit 9915672d41273f5b77 intent.
If you have no limit (like old kernels), you can freeze your machine, even if it has terabytes of ram, running a single program, even as a non root user.
When we discussed about the fix, we said a limit was needed, obviously.
Now you'll have to prove we need to make it a sysctl (yet another /proc/sys/net parameter, yet another documentation to add...)
Even changing default from 16000 to 2000 must be for a valid reason (a real use case)
David Miller
maintainerRe: [PATCH] Sysctl interface to UNIX_INFLIGHT_TRIGGER_GC v.3
From: Eric Dumazet <[email protected]>
Date: Fri, 10 Dec 2010 14:04:33 +0100
Quoted 26 lines · Pavel Vasilyev
Quoted 14 lines · Shan Wei
Quoted 11 lines
Pavel Vasilyev wrote, at 12/10/2010 01:26 AM:
Documentation/networking/ip-sysctl.txt max_dgram_qlen - INTEGER
Quoted 7 lines
Sysctl interface to
UNIX_INFLIGHT_TRIGGER_GC.
IMHO convenient for testing.Documentation/networking/ip-sysctl.txt +4
-0+inflight_trigger_gc - INTEGER + The maximal number of inflight sockets for force garbage collect. + + Default: 160001) For lower payload and enough memory, it's not necessary to force garbage collection. So set it to 0, disable gc.
Quoted 2 lines
May be, set default to 2000, and zero to disable
zero to disable ?
Maybe you missed commit
9915672d41273f5b77intent.If you have no limit (like old kernels), you can freeze your machine, even if it has terabytes of ram, running a single program, even as a non root user.
Quoted 7 lines
When we discussed about the fix, we said a limit was needed, obviously.
Now you'll have to prove we need to make it a sysctl (yet another
/proc/sys/netparameter, yet another documentation to add...)Even changing default from 16000 to 2000 must be for a valid reason (a real use case)
I don't want to add this sysctl. Exactly because there is no reason to believe that the current value could even need to be changed by anyone.
Once a demonstratable need can be proven and shown beyond a shadow of a doubt, we can consider adding the sysctl.
We have too many damn sysctls as-is.