From owner-svn-src-user@FreeBSD.ORG Sun Oct 21 09:46:03 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 859834CE; Sun, 21 Oct 2012 09:46:03 +0000 (UTC) (envelope-from andre@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6DD288FC0C; Sun, 21 Oct 2012 09:46:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9L9k31Y040656; Sun, 21 Oct 2012 09:46:03 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9L9k37r040654; Sun, 21 Oct 2012 09:46:03 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201210210946.q9L9k37r040654@svn.freebsd.org> From: Andre Oppermann Date: Sun, 21 Oct 2012 09:46:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r241800 - user/andre/tcp_workqueue/sys/sys X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Oct 2012 09:46:03 -0000 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)) /*