Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 19 Oct 2012 12:16:29 +0000 (UTC)
From:      Andre Oppermann <andre@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r241729 - head/sys/kern
Message-ID:  <201210191216.q9JCGTCe086268@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: andre
Date: Fri Oct 19 12:16:29 2012
New Revision: 241729
URL: http://svn.freebsd.org/changeset/base/241729

Log:
  Move socket UMA zone initialization functionality together into
  one place.

Modified:
  head/sys/kern/uipc_socket.c

Modified: head/sys/kern/uipc_socket.c
==============================================================================
--- head/sys/kern/uipc_socket.c	Fri Oct 19 11:01:39 2012	(r241728)
+++ head/sys/kern/uipc_socket.c	Fri Oct 19 12:16:29 2012	(r241729)
@@ -173,11 +173,8 @@ static struct filterops sowrite_filtops 
 	.f_event = filt_sowrite,
 };
 
-uma_zone_t socket_zone;
 so_gen_t	so_gencnt;	/* generation count for sockets */
 
-int	maxsockets;
-
 MALLOC_DEFINE(M_SONAME, "soname", "socket name");
 MALLOC_DEFINE(M_PCB, "pcb", "protocol control block");
 
@@ -230,6 +227,9 @@ SYSCTL_NODE(_kern, KERN_IPC, ipc, CTLFLA
  * Initialize the socket subsystem and set up the socket
  * memory allocator.
  */
+uma_zone_t socket_zone;
+int	maxsockets;
+
 static void
 socket_zone_change(void *tag)
 {
@@ -250,6 +250,19 @@ socket_init(void *tag)
 SYSINIT(socket, SI_SUB_PROTO_DOMAININIT, SI_ORDER_ANY, socket_init, NULL);
 
 /*
+ * Initialise maxsockets.  This SYSINIT must be run after
+ * tunable_mbinit().
+ */
+static void
+init_maxsockets(void *ignored)
+{
+
+	TUNABLE_INT_FETCH("kern.ipc.maxsockets", &maxsockets);
+	maxsockets = imax(maxsockets, imax(maxfiles, nmbclusters));
+}
+SYSINIT(param, SI_SUB_TUNABLES, SI_ORDER_ANY, init_maxsockets, NULL);
+
+/*
  * Sysctl to get and set the maximum global sockets limit.  Notify protocols
  * of the change so that they can update their dependent limits as required.
  */
@@ -273,25 +286,11 @@ sysctl_maxsockets(SYSCTL_HANDLER_ARGS)
 	}
 	return (error);
 }
-
 SYSCTL_PROC(_kern_ipc, OID_AUTO, maxsockets, CTLTYPE_INT|CTLFLAG_RW,
     &maxsockets, 0, sysctl_maxsockets, "IU",
     "Maximum number of sockets avaliable");
 
 /*
- * Initialise maxsockets.  This SYSINIT must be run after
- * tunable_mbinit().
- */
-static void
-init_maxsockets(void *ignored)
-{
-
-	TUNABLE_INT_FETCH("kern.ipc.maxsockets", &maxsockets);
-	maxsockets = imax(maxsockets, imax(maxfiles, nmbclusters));
-}
-SYSINIT(param, SI_SUB_TUNABLES, SI_ORDER_ANY, init_maxsockets, NULL);
-
-/*
  * Socket operation routines.  These routines are called by the routines in
  * sys_socket.c or from a system process, and implement the semantics of
  * socket operations by switching out to the protocol specific routines.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201210191216.q9JCGTCe086268>