Date: Sun, 21 Oct 2012 09:46:03 +0000 (UTC) From: Andre Oppermann <andre@FreeBSD.org> To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r241800 - user/andre/tcp_workqueue/sys/sys Message-ID: <201210210946.q9L9k37r040654@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: andre Date: Sun Oct 21 09:46:02 2012 New Revision: 241800 URL: http://svn.freebsd.org/changeset/base/241800 Log: Make the cache line alignment conditional on SMP as it is not needed on UP systems. This saves a few bytes on embedded platforms. Remove the semicolons at the end of the structure definitions. Modified: user/andre/tcp_workqueue/sys/sys/mutex.h Modified: user/andre/tcp_workqueue/sys/sys/mutex.h ============================================================================== --- user/andre/tcp_workqueue/sys/sys/mutex.h Sun Oct 21 09:31:48 2012 (r241799) +++ user/andre/tcp_workqueue/sys/sys/mutex.h Sun Oct 21 09:46:02 2012 (r241800) @@ -411,16 +411,32 @@ struct mtx_args { SYSUNINIT(name##_mtx_sysuninit, SI_SUB_LOCK, SI_ORDER_MIDDLE, \ mtx_destroy, (mtx)) +/* + * Helper macros to prevent global mutexes to share a cache line + * on SMP systems. + * MTX_GLB(name) abstracts the access to the structure encapsulated + * mutexes. + */ +#ifdef SMP #define MTX_GLOBAL(name) \ struct { \ struct mtx (name); \ - } __aligned(CACHE_LINE_SIZE) (name); + } __aligned(CACHE_LINE_SIZE) (name) #define MTX_GLOBAL_STATIC(name) \ static struct { \ struct mtx (name); \ - } __aligned(CACHE_LINE_SIZE) (name); - + } __aligned(CACHE_LINE_SIZE) (name) +#else /* SMP */ +#define MTX_GLOBAL(name) \ + struct { \ + struct mtx (name); \ + } (name) +#define MTX_GLOBAL_STATIC(name) \ + static struct { \ + struct mtx (name); \ + } (name) +#endif /* SMP */ #define MTX_GLB(name) (&(name.name)) /*
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201210210946.q9L9k37r040654>