1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-19 15:33:56 +00:00

For each architecture, define CACHE_LINE_SHIFT and a derived

CACHE_LINE_SIZE constant.  These constants are intended to
over-estimate the cache line size, and be used at compile-time
when a run-time tuning alternative isn't appropriate or
available.

Defaults for all architectures are 64 bytes, except powerpc
where it is 128 bytes (used on G5 systems).

MFC after:	2 weeks
Discussed on:   arch@
This commit is contained in:
Robert Watson 2009-04-19 20:19:13 +00:00
parent 99d67eca50
commit a93fa8f2bb
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=191276
8 changed files with 39 additions and 0 deletions

View File

@ -89,6 +89,10 @@
#define ALIGN(p) _ALIGN(p)
#define ALIGNED_POINTER(p,t) _ALIGNED_POINTER(p,t)
#ifndef CACHE_LINE_SHIFT
#define CACHE_LINE_SHIFT 6
#endif
#define CACHE_LINE_SIZE (1 << CACHE_LINE_SHIFT)
/* Size of the level 1 page table units */
#define NPTEPG (PAGE_SIZE/(sizeof (pt_entry_t)))

View File

@ -81,6 +81,11 @@
#define ALIGNBYTES _ALIGNBYTES
#define ALIGN(p) _ALIGN(p)
#ifndef CACHE_LINE_SHIFT
#define CACHE_LINE_SHIFT 6
#endif
#define CACHE_LINE_SIZE (1 << CACHE_LINE_SHIFT)
#define PAGE_SHIFT 12
#define PAGE_SIZE (1 << PAGE_SHIFT) /* Page size */
#define PAGE_MASK (PAGE_SIZE - 1)

View File

@ -74,6 +74,11 @@
#define ALIGNBYTES _ALIGNBYTES
#define ALIGN(p) _ALIGN(p)
#ifndef CACHE_LINE_SHIFT
#define CACHE_LINE_SHIFT 6
#endif
#define CACHE_LINE_SIZE (1 << CACHE_LINE_SHIFT)
#define PAGE_SHIFT 12 /* LOG2(PAGE_SIZE) */
#define PAGE_SIZE (1<<PAGE_SHIFT) /* bytes/page */
#define PAGE_MASK (PAGE_SIZE-1)

View File

@ -99,6 +99,11 @@
#define ALIGN(p) _ALIGN(p)
#define ALIGNED_POINTER(p,t) _ALIGNED_POINTER(p,t)
#ifndef CACHE_LINE_SHIFT
#define CACHE_LINE_SHIFT 6
#endif
#define CACHE_LINE_SIZE (1 << CACHE_LINE_SHIFT)
#ifndef LOG2_PAGE_SIZE
#define LOG2_PAGE_SIZE 13 /* 8K pages by default. */
#endif

View File

@ -89,6 +89,11 @@
#define ALIGNBYTES _ALIGNBYTES
#define ALIGN(p) _ALIGN(p)
#ifndef CACHE_LINE_SHIFT
#define CACHE_LINE_SHIFT 6
#endif
#define CACHE_LINE_SIZE (1 << CACHE_LINE_SHIFT)
#define NBPG 4096 /* bytes/page */
#define PGOFSET (NBPG-1) /* byte offset into page */
#define PGSHIFT 12 /* LOG2(NBPG) */

View File

@ -79,6 +79,11 @@
#define ALIGNBYTES _ALIGNBYTES
#define ALIGN(p) _ALIGN(p)
#ifndef CACHE_LINE_SHIFT
#define CACHE_LINE_SHIFT 7
#endif
#define CACHE_LINE_SIZE (1 << CACHE_LINE_SHIFT)
#define PAGE_SHIFT 12
#define PAGE_SIZE (1 << PAGE_SHIFT) /* Page size */
#define PAGE_MASK (PAGE_SIZE - 1)

View File

@ -71,6 +71,11 @@
#define ALIGNBYTES _ALIGNBYTES
#define ALIGN(p) _ALIGN(p)
#ifndef CACHE_LINE_SHIFT
#define CACHE_LINE_SHIFT 6
#endif
#define CACHE_LINE_SIZE (1 << CACHE_LINE_SHIFT)
#define PAGE_SHIFT_8K 13
#define PAGE_SIZE_8K (1L<<PAGE_SHIFT_8K)
#define PAGE_MASK_8K (PAGE_SIZE_8K-1)

View File

@ -71,6 +71,11 @@
#define ALIGNBYTES _ALIGNBYTES
#define ALIGN(p) _ALIGN(p)
#ifndef CACHE_LINE_SHIFT
#define CACHE_LINE_SHIFT 6
#endif
#define CACHE_LINE_SIZE (1 << CACHE_LINE_SHIFT)
#define PAGE_SHIFT_8K 13
#define PAGE_SIZE_8K (1L<<PAGE_SHIFT_8K)
#define PAGE_MASK_8K (PAGE_SIZE_8K-1)