lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 09 Dec 2010 06:34:26 +0300
From:	Pavel Vasilyev <pavel@...linux.ru>
To:	LKML <linux-kernel@...r.kernel.org>
Subject: [PATCH] Sysctl interface to UNIX_INFLIGHT_TRIGGER_GC

Convenient for testing.
Maybe something to add in Documentation/kernel-parameters.txt ?

--- cut ---

diff --git a/include/net/af_unix.h b/include/net/af_unix.h
index 18e5c3f..ea580e4 100644
--- a/include/net/af_unix.h
+++ b/include/net/af_unix.h
@@ -15,6 +15,7 @@ extern struct sock *unix_get_socket(struct file *filp);
 #define UNIX_HASH_SIZE 256

 extern unsigned int unix_tot_inflight;
+extern unsigned int sysctl_inflight_trigger_gc;

 struct unix_address {
        atomic_t        refcnt;
diff --git a/net/unix/garbage.c b/net/unix/garbage.c
index f89f83b..c646c6b 100644
--- a/net/unix/garbage.c
+++ b/net/unix/garbage.c
@@ -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 16000

 void 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);
 }
diff --git a/net/unix/sysctl_net_unix.c b/net/unix/sysctl_net_unix.c
index 397cffe..c807235 100644
--- a/net/unix/sysctl_net_unix.c
+++ b/net/unix/sysctl_net_unix.c
@@ -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;

--- end of cut ---

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ