Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src Briefly describe __read_mostly and __cachline_aligned.



details:   https://anonhg.NetBSD.org/src/rev/b0242a9b2524
branches:  trunk
changeset: 759818:b0242a9b2524
user:      jruoho <jruoho%NetBSD.org@localhost>
date:      Fri Dec 17 08:13:09 2010 +0000

description:
Briefly describe __read_mostly and __cachline_aligned.

diffstat:

 distrib/sets/lists/comp/mi |   8 +++++++-
 share/man/man3/Makefile    |   6 ++++--
 share/man/man3/attribute.3 |  38 +++++++++++++++++++++++++++++++++++---
 3 files changed, 46 insertions(+), 6 deletions(-)

diffs (134 lines):

diff -r a5f5283bf121 -r b0242a9b2524 distrib/sets/lists/comp/mi
--- a/distrib/sets/lists/comp/mi        Fri Dec 17 07:25:33 2010 +0000
+++ b/distrib/sets/lists/comp/mi        Fri Dec 17 08:13:09 2010 +0000
@@ -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
diff -r a5f5283bf121 -r b0242a9b2524 share/man/man3/Makefile
--- a/share/man/man3/Makefile   Fri Dec 17 07:25:33 2010 +0000
+++ b/share/man/man3/Makefile   Fri Dec 17 08:13:09 2010 +0000
@@ -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 \
diff -r a5f5283bf121 -r b0242a9b2524 share/man/man3/attribute.3
--- a/share/man/man3/attribute.3        Fri Dec 17 07:25:33 2010 +0000
+++ b/share/man/man3/attribute.3        Fri Dec 17 08:13:09 2010 +0000
@@ -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 ,



Home | Main Index | Thread Index | Old Index