From owner-svn-src-stable@freebsd.org Tue Mar 14 20:39:08 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6DD5AD0D0A3; Tue, 14 Mar 2017 20:39:08 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3A270948; Tue, 14 Mar 2017 20:39:08 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v2EKd7sE034522; Tue, 14 Mar 2017 20:39:07 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v2EKd7Qk034518; Tue, 14 Mar 2017 20:39:07 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201703142039.v2EKd7Qk034518@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Tue, 14 Mar 2017 20:39:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r315284 - in stable/11/sys: compat/linuxkpi/common/include/linux conf dev/drm2 sys X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Mar 2017 20:39:08 -0000 Author: mjg Date: Tue Mar 14 20:39:06 2017 New Revision: 315284 URL: https://svnweb.freebsd.org/changeset/base/315284 Log: MFC r312888: Introduce __read_mostly and __exclusive_cache_line macros. The intended use is to annotate frequently used globals which either rarely change (and thus can be grouped in the same cacheline) or are an atomic counter (which means it may benefit from being the only variable in the cacheline). Linker script support is provided only for amd64. Architectures without it risk having other variables put in, i.e. as if they were not annotated. This is harmless from correctness point of view. Modified: stable/11/sys/compat/linuxkpi/common/include/linux/compiler.h stable/11/sys/conf/ldscript.amd64 stable/11/sys/dev/drm2/drm_os_freebsd.h stable/11/sys/sys/systm.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/compat/linuxkpi/common/include/linux/compiler.h ============================================================================== --- stable/11/sys/compat/linuxkpi/common/include/linux/compiler.h Tue Mar 14 20:31:10 2017 (r315283) +++ stable/11/sys/compat/linuxkpi/common/include/linux/compiler.h Tue Mar 14 20:39:06 2017 (r315284) @@ -67,7 +67,6 @@ #define typeof(x) __typeof(x) #define uninitialized_var(x) x = x -#define __read_mostly __attribute__((__section__(".data.read_mostly"))) #define __always_unused __unused #define __must_check __result_use_check Modified: stable/11/sys/conf/ldscript.amd64 ============================================================================== --- stable/11/sys/conf/ldscript.amd64 Tue Mar 14 20:31:10 2017 (r315283) +++ stable/11/sys/conf/ldscript.amd64 Tue Mar 14 20:39:06 2017 (r315284) @@ -145,6 +145,17 @@ SECTIONS .got : { *(.got) } . = DATA_SEGMENT_RELRO_END (24, .); .got.plt : { *(.got.plt) } + . = ALIGN(64); + .data.read_mostly : + { + *(.data.read_mostly) + } + . = ALIGN(64); + .data.exclusive_cache_line : + { + *(.data.exclusive_cache_line) + } + . = ALIGN(64); .data : { *(.data .data.* .gnu.linkonce.d.*) Modified: stable/11/sys/dev/drm2/drm_os_freebsd.h ============================================================================== --- stable/11/sys/dev/drm2/drm_os_freebsd.h Tue Mar 14 20:31:10 2017 (r315283) +++ stable/11/sys/dev/drm2/drm_os_freebsd.h Tue Mar 14 20:39:06 2017 (r315284) @@ -80,7 +80,6 @@ typedef void irqreturn_t; #define __init #define __exit -#define __read_mostly #define BUILD_BUG_ON(x) CTASSERT(!(x)) #define BUILD_BUG_ON_NOT_POWER_OF_2(x) Modified: stable/11/sys/sys/systm.h ============================================================================== --- stable/11/sys/sys/systm.h Tue Mar 14 20:31:10 2017 (r315283) +++ stable/11/sys/sys/systm.h Tue Mar 14 20:39:06 2017 (r315284) @@ -131,6 +131,12 @@ void kassert_panic(const char *fmt, ...) #define SCHEDULER_STOPPED() __predict_false(curthread->td_stopsched) /* + * Align variables. + */ +#define __read_mostly __section(".data.read_mostly") +#define __exclusive_cache_line __aligned(CACHE_LINE_SIZE) \ + __section(".data.exclusive_cache_line") +/* * XXX the hints declarations are even more misplaced than most declarations * in this file, since they are needed in one file (per arch) and only used * in two files.