diff --git a/configure.ac b/configure.ac index d016c142..fd751513 100644 --- a/configure.ac +++ b/configure.ac @@ -192,6 +192,10 @@ AC_ARG_ENABLE([coverage], [ --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" ]) @@ -353,6 +357,12 @@ else COVERAGE_LDFLAGS="" fi + +if test "x${enable_small_memory_footprint}" = xyes ; then + AC_DEFINE_UNQUOTED([HAVE_SMALL_MEMORY_FOOTPRINT], 1, [have small_memory_footprint]) + PACKAGE_FEATURES="$PACKAGE_FEATURES small-memory-footprint" +fi + if test "x${enable_ansi}" = xyes && \ cc_supports_flag -std=iso9899:199409 ; then AC_MSG_NOTICE([Enabling ANSI Compatibility]) diff --git a/include/corosync/corodefs.h b/include/corosync/corodefs.h index 481d8fe8..4af7c8a4 100644 --- a/include/corosync/corodefs.h +++ b/include/corosync/corodefs.h @@ -60,7 +60,11 @@ enum corosync_service_types { AMF_V2_SERVICE = 17 }; -#define PROCESSOR_COUNT_MAX 384 +#ifdef HAVE_SMALL_MEMORY_FOOTPRINT +#define PROCESSOR_COUNT_MAX 16 +#else +#define PROCESSOR_COUNT_MAX 384 +#endif /* HAVE_SMALL_MEMORY_FOOTPRINT */ #define TOTEMIP_ADDRLEN (sizeof(struct in6_addr)) diff --git a/include/corosync/engine/coroapi.h b/include/corosync/engine/coroapi.h index 092585d7..e0d800ba 100644 --- a/include/corosync/engine/coroapi.h +++ b/include/corosync/engine/coroapi.h @@ -65,16 +65,17 @@ struct corosync_tpg_group { #define TOTEMIP_ADDRLEN (sizeof(struct in6_addr)) -#define PROCESSOR_COUNT_MAX 384 #define INTERFACE_MAX 2 -#ifndef MESSAGE_SIZE_MAX +#ifdef HAVE_SMALL_MEMORY_FOOTPRINT +#define PROCESSOR_COUNT_MAX 16 +#define MESSAGE_SIZE_MAX 1024*64 +#define MESSAGE_QUEUE_MAX 512 +#else +#define PROCESSOR_COUNT_MAX 384 #define MESSAGE_SIZE_MAX 1024*1024 /* (1MB) */ -#endif /* MESSAGE_SIZE_MAX */ - -#ifndef MESSAGE_QUEUE_MAX -#define MESSAGE_QUEUE_MAX MESSAGE_SIZE_MAX / totem_config->net_mtu -#endif /* MESSAGE_QUEUE_MAX */ +#define MESSAGE_QUEUE_MAX MESSAGE_SIZE_MAX / totem_config->net_mtu +#endif /* HAVE_SMALL_MEMORY_FOOTPRINT */ #define TOTEM_AGREED 0 #define TOTEM_SAFE 1 diff --git a/include/corosync/totem/totem.h b/include/corosync/totem/totem.h index 51c0a2c2..0ef672d3 100644 --- a/include/corosync/totem/totem.h +++ b/include/corosync/totem/totem.h @@ -36,15 +36,16 @@ #define TOTEM_H_DEFINED #include "totemip.h" -#ifndef MESSAGE_SIZE_MAX -#define MESSAGE_SIZE_MAX 1024*1024 /* (1MB) */ -#endif /* MESSAGE_SIZE_MAX */ - -#ifndef MESSAGE_QUEUE_MAX -#define MESSAGE_QUEUE_MAX MESSAGE_SIZE_MAX / totem_config->net_mtu -#endif /* MESSAGE_QUEUE_MAX */ - +#ifdef HAVE_SMALL_MEMORY_FOOTPRINT +#define PROCESSOR_COUNT_MAX 16 +#define MESSAGE_SIZE_MAX 1024*64 +#define MESSAGE_QUEUE_MAX 512 +#else #define PROCESSOR_COUNT_MAX 384 +#define MESSAGE_SIZE_MAX 1024*1024 /* (1MB) */ +#define MESSAGE_QUEUE_MAX MESSAGE_SIZE_MAX / totem_config->net_mtu +#endif /* HAVE_SMALL_MEMORY_FOOTPRINT */ + #define FRAME_SIZE_MAX 10000 #define TRANSMITS_ALLOWED 16 #define SEND_THREADS_MAX 16 diff --git a/lib/util.h b/lib/util.h index 326f0c07..4a44bba5 100644 --- a/lib/util.h +++ b/lib/util.h @@ -53,8 +53,14 @@ static inline cs_error_t hdb_error_to_cs (int res) \ } \ } +#ifdef HAVE_SMALL_MEMORY_FOOTPRINT +#define IPC_REQUEST_SIZE 1024*64 +#define IPC_RESPONSE_SIZE 1024*64 +#define IPC_DISPATCH_SIZE 1024*64 +#else #define IPC_REQUEST_SIZE 8192*128 #define IPC_RESPONSE_SIZE 8192*128 #define IPC_DISPATCH_SIZE 8192*128 +#endif /* HAVE_SMALL_MEMORY_FOOTPRINT */ #endif /* AIS_UTIL_H_DEFINED */