Module Name:    src
Committed By:   jruoho
Date:           Fri Dec 17 08:13:10 UTC 2010

Modified Files:
        src/distrib/sets/lists/comp: mi
        src/share/man/man3: Makefile attribute.3

Log Message:
Briefly describe __read_mostly and __cachline_aligned.


To generate a diff of this commit:
cvs rdiff -u -r1.1552 -r1.1553 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.62 -r1.63 src/share/man/man3/Makefile
cvs rdiff -u -r1.6 -r1.7 src/share/man/man3/attribute.3

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/distrib/sets/lists/comp/mi
diff -u src/distrib/sets/lists/comp/mi:1.1552 src/distrib/sets/lists/comp/mi:1.1553
--- src/distrib/sets/lists/comp/mi:1.1552	Fri Dec 17 07:10:37 2010
+++ src/distrib/sets/lists/comp/mi	Fri Dec 17 08:13:09 2010
@@ -1,4 +1,4 @@
-#	$NetBSD: mi,v 1.1552 2010/12/17 07:10:37 jruoho Exp $
+#	$NetBSD: mi,v 1.1553 2010/12/17 08:13:09 jruoho Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -4908,12 +4908,14 @@
 ./usr/share/man/cat3/__aligned.0		comp-c-catman		.cat
 ./usr/share/man/cat3/__arraycount.0		comp-c-catman		.cat
 ./usr/share/man/cat3/__builtin_object_size.0	comp-c-catman		.cat
+./usr/share/man/cat3/__cacheline_aligned.0	comp-c-catman		.cat
 ./usr/share/man/cat3/__constfunc.0		comp-c-catman		.cat
 ./usr/share/man/cat3/__dead.0			comp-c-catman		.cat
 ./usr/share/man/cat3/__insn_barrier.0		comp-c-catman		.cat
 ./usr/share/man/cat3/__noinline.0		comp-c-catman		.cat
 ./usr/share/man/cat3/__packed.0			comp-c-catman		.cat
 ./usr/share/man/cat3/__pure.0			comp-c-catman		.cat
+./usr/share/man/cat3/__read_mostly.0		comp-c-catman		.cat
 ./usr/share/man/cat3/__section.0		comp-c-catman		.cat
 ./usr/share/man/cat3/__svc_getcallercreds.0	comp-c-catman		.cat
 ./usr/share/man/cat3/__unused.0			comp-c-catman		.cat
@@ -10993,12 +10995,14 @@
 ./usr/share/man/html3/__aligned.html		comp-c-htmlman		html
 ./usr/share/man/html3/__arraycount.html		comp-c-htmlman		html
 ./usr/share/man/html3/__builtin_object_size.html	comp-c-htmlman		html
+./usr/share/man/html3/__cacheline_aligned.html	comp-c-htmlman		html
 ./usr/share/man/html3/__constfunc.html		comp-c-htmlman		html
 ./usr/share/man/html3/__dead.html		comp-c-htmlman		html
 ./usr/share/man/html3/__insn_barrier.html	comp-c-htmlman		html
 ./usr/share/man/html3/__noinline.html		comp-c-htmlman		html
 ./usr/share/man/html3/__packed.html		comp-c-htmlman		html
 ./usr/share/man/html3/__pure.html		comp-c-htmlman		html
+./usr/share/man/html3/__read_mostly.html	comp-c-htmlman		html
 ./usr/share/man/html3/__section.html		comp-c-htmlman		html
 ./usr/share/man/html3/__svc_getcallercreds.html	comp-c-htmlman		html
 ./usr/share/man/html3/__unused.html		comp-c-htmlman		html
@@ -16878,12 +16882,14 @@
 ./usr/share/man/man3/__aligned.3		comp-c-man		.man
 ./usr/share/man/man3/__arraycount.3		comp-c-man		.man
 ./usr/share/man/man3/__builtin_object_size.3	comp-c-man		.man
+./usr/share/man/man3/__cacheline_aligned.3	comp-c-man		.man
 ./usr/share/man/man3/__constfunc.3		comp-c-man		.man
 ./usr/share/man/man3/__dead.3			comp-c-man		.man
 ./usr/share/man/man3/__insn_barrier.3		comp-c-man		.man
 ./usr/share/man/man3/__noinline.3		comp-c-man		.man
 ./usr/share/man/man3/__packed.3			comp-c-man		.man
 ./usr/share/man/man3/__pure.3			comp-c-man		.man
+./usr/share/man/man3/__read_mostly.3		comp-c-man		.man
 ./usr/share/man/man3/__section.3		comp-c-man		.man
 ./usr/share/man/man3/__svc_getcallercreds.3	comp-c-man		.man
 ./usr/share/man/man3/__unused.3			comp-c-man		.man

Index: src/share/man/man3/Makefile
diff -u src/share/man/man3/Makefile:1.62 src/share/man/man3/Makefile:1.63
--- src/share/man/man3/Makefile:1.62	Fri Dec 17 07:10:38 2010
+++ src/share/man/man3/Makefile	Fri Dec 17 08:13:09 2010
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.62 2010/12/17 07:10:38 jruoho Exp $
+#	$NetBSD: Makefile,v 1.63 2010/12/17 08:13:09 jruoho Exp $
 #	@(#)Makefile	8.2 (Berkeley) 12/13/93
 
 MAN=	_DIAGASSERT.3 __CONCAT.3 __UNCONST.3 CMSG_DATA.3 \
@@ -23,7 +23,9 @@
 	attribute.3 __used.3 \
 	attribute.3 __packed.3 \
 	attribute.3 __aligned.3 \
-	attribute.3 __section.3
+	attribute.3 __section.3 \
+	attribute.3 __read_mostly.3 \
+	attribute.3 __cacheline_aligned.3
 MLINKS+=bitstring.3 bit_alloc.3 \
 	bitstring.3 bit_clear.3 \
 	bitstring.3 bit_decl.3 \

Index: src/share/man/man3/attribute.3
diff -u src/share/man/man3/attribute.3:1.6 src/share/man/man3/attribute.3:1.7
--- src/share/man/man3/attribute.3:1.6	Thu Dec 16 17:50:39 2010
+++ src/share/man/man3/attribute.3	Fri Dec 17 08:13:09 2010
@@ -1,4 +1,4 @@
-.\" $NetBSD: attribute.3,v 1.6 2010/12/16 17:50:39 jruoho Exp $
+.\" $NetBSD: attribute.3,v 1.7 2010/12/17 08:13:09 jruoho Exp $
 .\"
 .\" Copyright (c) 2010 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -52,6 +52,10 @@
 .Pp
 .Fn __aligned "x"
 .Fn __section "section"
+.Pp
+.Ic __read_mostly
+.Pp
+.Ic __cacheline_aligned
 .Sh DESCRIPTION
 The
 .Tn GNU
@@ -218,9 +222,37 @@
 .Fn __section ,
 it is possible to override this behavior, perhaps in order to place
 some variables into particular sections specific to unique hardware.
-Generally the use cases of
+.It Ic __read_mostly
+The
+.Ic __read_mostly
+macro uses
 .Fn __section
-are very limited.
+to place a variable or function into the
+.Dq .data.read_mostly
+section of the (kernel)
+.Xr elf 5 .
+The use of
+.Ic __read_mostly
+allows infrequently modified data to be grouped together;
+it is expected that the cachelines of rarely and frequently modified
+data structures are this way separated.
+Candidates for
+.Ic __read_mostly
+include variables that are initialized once,
+read very often, and seldom written to.
+.It Ic __cacheline_aligned
+The
+.Ic __cacheline_aligned
+macro behaves like
+.Ic __read_mostly ,
+but the used section is
+.Dq .data.cacheline_aligned
+instead.
+It also uses
+.Fn __aligned
+to set the minimum alignment into a predefined coherency unit.
+This should ensure that frequently used data structures are
+aligned on cacheline boundaries.
 .El
 .Sh SEE ALSO
 .Xr gcc 1 ,

Reply via email to