Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 17 Nov 1996 23:41:10 +1100
From:      Bruce Evans <bde@zeta.org.au>
To:        cvs-all@freefall.freebsd.org, CVS-committers@freefall.freebsd.org, cvs-sys@freefall.freebsd.org, dyson@freefall.freebsd.org
Subject:   Re: cvs commit:  src/sys/vm vm_kern.c vm_page.c
Message-ID:  <199611171241.XAA17549@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help

>  Modified:    sys/vm    vm_kern.c vm_page.c
>  Log:
>  Improve the locality of reference for variables in vm_page and
>  vm_kern by moving them from .bss to .data.  With this change,
>  there is a measurable perf improvement in fork/exec.

This can be done without cluttering the sources by compiling with
-fno-common.  This causes mixtures of global and static variables to be
laid out in the order of definition.  Also, modules begin on 16-byte
boundaries, so groups of up to 4 32-bit variables can be laid out so
that they are in the same (i486 and Pentium) cache line.  Unfortunately:
1. modules don't begin on 32-bit boundaries on Pentiums, so groups of
   8 32-bit variables can't be guaranteed to be in the same cache line.
2. gcc only aligns variables to 32-bit boundaries, so long long alignment
   is wrong about half the time except for data laid out by hand.
3. most sources aren't written with cache lines in mind.
4. -fno-common puts lots of little-used variables (mostly inside large
   arrays and structs?) together with often-used variables.  You can
   certainly do better by laying out individual modules by hand and
   depending on little-used bloat being put in the bss.  The optimization
   probably has to cross module boundaries.  E.g., `cnt' is now defined
   in vm_meter.c where it is little used.  All the vm variables (including
   the machine-dependent ones) should probably be allocated contiguously.

Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199611171241.XAA17549>