I don't totally like the cflag overrides, but ...

looks good for merge

On Tue, 2009-09-08 at 10:26 +1200, Angus Salkeld wrote:
> Hi
> 
> This adds the following option to configure:
> --enable-small-memory-footprint
> 
> It overrides (using CFLAGS) the following defines to reduce
> the overall memory footprint.
> 
> MESSAGE_SIZE_MAX=1024*64
> MESSAGE_QUEUE_MAX=512
> PROCESSOR_COUNT_MAX=16
> IPC_REQUEST_SIZE=1024*64
> IPC_RESPONSE_SIZE=1024*64
> IPC_DISPATCH_SIZE=1024*64
> 
> These values *might* need tweeking but they seem OK from some reasonable
> usage.
> 
> Regards
> Angus
> 
> 
> Index: include/corosync/corodefs.h
> ===================================================================
> --- include/corosync/corodefs.h       (revision 2405)
> +++ include/corosync/corodefs.h       (working copy)
> @@ -60,7 +60,9 @@
>       AMF_V2_SERVICE = 17
>  };
> 
> -#define PROCESSOR_COUNT_MAX  384
> +#ifndef PROCESSOR_COUNT_MAX
> +#define PROCESSOR_COUNT_MAX 384
> +#endif /* PROCESSOR_COUNT_MAX */
> 
>  #define TOTEMIP_ADDRLEN (sizeof(struct in6_addr))
> 
> Index: include/corosync/totem/totem.h
> ===================================================================
> --- include/corosync/totem/totem.h    (revision 2405)
> +++ include/corosync/totem/totem.h    (working copy)
> @@ -44,7 +44,9 @@
>  #define MESSAGE_QUEUE_MAX MESSAGE_SIZE_MAX / totem_config->net_mtu
>  #endif /* MESSAGE_QUEUE_MAX */
> 
> +#ifndef PROCESSOR_COUNT_MAX
>  #define PROCESSOR_COUNT_MAX  384
> +#endif /* PROCESSOR_COUNT_MAX */
>  #define FRAME_SIZE_MAX               10000
>  #define TRANSMITS_ALLOWED    16
>  #define SEND_THREADS_MAX     16
> Index: include/corosync/engine/coroapi.h
> ===================================================================
> --- include/corosync/engine/coroapi.h (revision 2405)
> +++ include/corosync/engine/coroapi.h (working copy)
> @@ -65,7 +65,9 @@
> 
>  #define TOTEMIP_ADDRLEN (sizeof(struct in6_addr))
> 
> +#ifndef PROCESSOR_COUNT_MAX
>  #define PROCESSOR_COUNT_MAX 384
> +#endif /* PROCESSOR_COUNT_MAX */
>  #define INTERFACE_MAX 2
> 
>  #ifndef MESSAGE_SIZE_MAX
> Index: exec/totemip.c
> Index: configure.ac
> ===================================================================
> --- configure.ac      (revision 2405)
> +++ configure.ac      (working copy)
> @@ -185,6 +185,10 @@
>       [  --enable-coverage       : coverage analysis of the codebase. ],
>       [ default="no" ])
> 
> +AC_ARG_ENABLE([small-memory-footprint],
> +     [  --enable-small-memory-footprint : Use small message queues and
> small messages sizes. ],
> +     [ default="no" ])
> +
>  AC_ARG_ENABLE([nss],
>       [  --enable-nss            : Network Security Services encryption. ],,
>       [ enable_nss="yes" ])
> @@ -346,6 +350,19 @@
>       COVERAGE_LDFLAGS=""
>  fi
> 
> +
> +if test "x${enable_small_memory_footprint}" = xyes ; then
> +     AC_MSG_NOTICE([Enabling Small memory footprint])
> +     FOOTPRINT_CFLAGS="-DMESSAGE_SIZE_MAX=1024*64"
> +     FOOTPRINT_CFLAGS+=" -DMESSAGE_QUEUE_MAX=512"
> +     FOOTPRINT_CFLAGS+=" -DPROCESSOR_COUNT_MAX=16"
> +     FOOTPRINT_CFLAGS+=" -DIPC_REQUEST_SIZE=1024*64"
> +     FOOTPRINT_CFLAGS+=" -DIPC_RESPONSE_SIZE=1024*64"
> +     FOOTPRINT_CFLAGS+=" -DIPC_DISPATCH_SIZE=1024*64"
> +
> +     PACKAGE_FEATURES="$PACKAGE_FEATURES enable_small-memory-footprint"
> +fi
> +
>  if test "x${enable_ansi}" = xyes && \
>               cc_supports_flag -std=iso9899:199409 ; then
>       AC_MSG_NOTICE([Enabling ANSI Compatibility])
> @@ -366,7 +383,8 @@
> 
>  # final build of *FLAGS
>  CFLAGS="$ENV_CFLAGS $OPT_CFLAGS $GDB_FLAGS $OS_CFLAGS \
> -     $COVERAGE_CFLAGS $EXTRA_WARNINGS $WERROR_CFLAGS $NSS_CFLAGS"
> +     $COVERAGE_CFLAGS $EXTRA_WARNINGS $WERROR_CFLAGS \
> +     $NSS_CFLAGS $FOOTPRINT_CFLAGS"
>  CPPFLAGS="$ENV_CPPFLAGS $ANSI_CPPFLAGS $OS_CPPFLAGS"
>  LDFLAGS="$ENV_LDFLAGS $COVERAGE_LDFLAGS $OS_LDFLAGS"
> 
> @@ -439,6 +457,7 @@
>  AC_MSG_RESULT([  ANSI defined CPPFLAGS    = ${ANSI_CPPFLAGS}])
>  AC_MSG_RESULT([  Coverage     CFLAGS      = ${COVERAGE_CFLAGS}])
>  AC_MSG_RESULT([  Coverage     LDFLAGS     = ${COVERAGE_LDFLAGS}])
> +AC_MSG_RESULT([  Small Footprint CFLAGS   = ${FOOTPRINT_CFLAGS}])
>  AC_MSG_RESULT([  Fatal War.   CFLAGS      = ${WERROR_CFLAGS}])
>  AC_MSG_RESULT([  Final        CFLAGS      = ${CFLAGS}])
>  AC_MSG_RESULT([  Final        CPPFLAGS    = ${CPPFLAGS}])
> Index: lib/util.h
> ===================================================================
> --- lib/util.h        (revision 2405)
> +++ lib/util.h        (working copy)
> @@ -53,8 +53,10 @@
>       }                                                       \
>  }
> 
> +#ifndef IPC_REQUEST_SIZE
>  #define IPC_REQUEST_SIZE        8192*128
>  #define IPC_RESPONSE_SIZE       8192*128
>  #define IPC_DISPATCH_SIZE       8192*128
> +#endif /* IPC_REQUEST_SIZE */
> 
>  #endif /* AIS_UTIL_H_DEFINED */
> _______________________________________________
> Openais mailing list
> [email protected]
> https://lists.linux-foundation.org/mailman/listinfo/openais

_______________________________________________
Openais mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/openais

Reply via email to