On Fri, Oct 19, 2012 at 10:15:32AM +0000, Andre Oppermann wrote:
> Author: andre
> Date: Fri Oct 19 10:15:32 2012
> New Revision: 241726
> URL: http://svn.freebsd.org/changeset/base/241726
> 
> Log:
>   Move UMA socket zone initialization from uipc_domain.c to uipc_socket.c
>   into one place next to its other related functions to avoid confusion.

I think you can remove include of vm/uma.h from uipc_domain.c now.

> Modified:
>   head/sys/kern/uipc_domain.c
>   head/sys/kern/uipc_socket.c
> 
> Modified: head/sys/kern/uipc_domain.c
> ==============================================================================
> --- head/sys/kern/uipc_domain.c       Fri Oct 19 10:07:55 2012        
> (r241725)
> +++ head/sys/kern/uipc_domain.c       Fri Oct 19 10:15:32 2012        
> (r241726)
> @@ -239,28 +239,11 @@ domain_add(void *data)
>       mtx_unlock(&dom_mtx);
>  }
>  
> -static void
> -socket_zone_change(void *tag)
> -{
> -
> -     uma_zone_set_max(socket_zone, maxsockets);
> -}
> -
>  /* ARGSUSED*/
>  static void
>  domaininit(void *dummy)
>  {
>  
> -     /*
> -      * Before we do any setup, make sure to initialize the
> -      * zone allocator we get struct sockets from.
> -      */
> -     socket_zone = uma_zcreate("socket", sizeof(struct socket), NULL, NULL,
> -         NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE);
> -     uma_zone_set_max(socket_zone, maxsockets);
> -     EVENTHANDLER_REGISTER(maxsockets_change, socket_zone_change, NULL,
> -             EVENTHANDLER_PRI_FIRST);
> -
>       if (max_linkhdr < 16)           /* XXX */
>               max_linkhdr = 16;
>  
> 
> Modified: head/sys/kern/uipc_socket.c
> ==============================================================================
> --- head/sys/kern/uipc_socket.c       Fri Oct 19 10:07:55 2012        
> (r241725)
> +++ head/sys/kern/uipc_socket.c       Fri Oct 19 10:15:32 2012        
> (r241726)
> @@ -227,6 +227,29 @@ MTX_SYSINIT(so_global_mtx, &so_global_mt
>  SYSCTL_NODE(_kern, KERN_IPC, ipc, CTLFLAG_RW, 0, "IPC");
>  
>  /*
> + * Initialize the socket subsystem and set up the socket
> + * memory allocator.
> + */
> +static void
> +socket_zone_change(void *tag)
> +{
> +
> +     uma_zone_set_max(socket_zone, maxsockets);
> +}
> +
> +static void
> +socket_init(void *tag)
> +{
> +
> +        socket_zone = uma_zcreate("socket", sizeof(struct socket), NULL, 
> NULL,
> +            NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE);
> +        uma_zone_set_max(socket_zone, maxsockets);
> +        EVENTHANDLER_REGISTER(maxsockets_change, socket_zone_change, NULL,
> +                EVENTHANDLER_PRI_FIRST);
> +}
> +SYSINIT(socket, SI_SUB_PROTO_DOMAININIT, SI_ORDER_ANY, socket_init, 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.
>   */

-- 
Pawel Jakub Dawidek                       http://www.wheelsystems.com
FreeBSD committer                         http://www.FreeBSD.org
Am I Evil? Yes, I Am!                     http://tupytaj.pl

Attachment: pgpr9xl1wZ8Pa.pgp
Description: PGP signature

Reply via email to