Thu Jul 22 04:46:29 2021 UTC ()
Minor shuffle to bring <machine/param.h> and <machine/limits.h> in before
any <sys/*.h> headers and for the COHERENCY_UNIT and CACHE_LINE_SIZE
defaults to be provided after the <machine/*.h> includes, but before the
<sys/*.h> includes.

COHERENCY_UNIT and CACHE_LINE_SIZE are used by a few <sys/*.h> filss.

I checked a handful of kernel builds produce the same binary before and
after this change.  I'll check more.


(skrll)
diff -r1.699 -r1.700 src/sys/sys/param.h

cvs diff -r1.699 -r1.700 src/sys/sys/param.h (expand / switch to unified diff)

--- src/sys/sys/param.h 2021/07/21 07:39:58 1.699
+++ src/sys/sys/param.h 2021/07/22 04:46:29 1.700
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: param.h,v 1.699 2021/07/21 07:39:58 ozaki-r Exp $ */ 1/* $NetBSD: param.h,v 1.700 2021/07/22 04:46:29 skrll Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1982, 1986, 1989, 1993 4 * Copyright (c) 1982, 1986, 1989, 1993
5 * The Regents of the University of California. All rights reserved. 5 * The Regents of the University of California. All rights reserved.
6 * (c) UNIX System Laboratories, Inc. 6 * (c) UNIX System Laboratories, Inc.
7 * All or some portions of this file are derived from material licensed 7 * All or some portions of this file are derived from material licensed
8 * to the University of California by American Telephone and Telegraph 8 * to the University of California by American Telephone and Telegraph
9 * Co. or Unix System Laboratories, Inc. and are reproduced herein with 9 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
10 * the permission of UNIX System Laboratories, Inc. 10 * the permission of UNIX System Laboratories, Inc.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions 13 * modification, are permitted provided that the following conditions
14 * are met: 14 * are met:
@@ -128,26 +128,42 @@ @@ -128,26 +128,42 @@
128#endif 128#endif
129#ifndef MAXUPRC /* max simultaneous processes */ 129#ifndef MAXUPRC /* max simultaneous processes */
130#define MAXUPRC CHILD_MAX /* POSIX 1003.1-compliant default */ 130#define MAXUPRC CHILD_MAX /* POSIX 1003.1-compliant default */
131#else 131#else
132#if (MAXUPRC - 0) < CHILD_MAX 132#if (MAXUPRC - 0) < CHILD_MAX
133#error MAXUPRC less than CHILD_MAX. See options(4) for details. 133#error MAXUPRC less than CHILD_MAX. See options(4) for details.
134#endif /* (MAXUPRC - 0) < CHILD_MAX */ 134#endif /* (MAXUPRC - 0) < CHILD_MAX */
135#endif /* !defined(MAXUPRC) */ 135#endif /* !defined(MAXUPRC) */
136 136
137/* Macros for min/max. */ 137/* Macros for min/max. */
138#define MIN(a,b) ((/*CONSTCOND*/(a)<(b))?(a):(b)) 138#define MIN(a,b) ((/*CONSTCOND*/(a)<(b))?(a):(b))
139#define MAX(a,b) ((/*CONSTCOND*/(a)>(b))?(a):(b)) 139#define MAX(a,b) ((/*CONSTCOND*/(a)>(b))?(a):(b))
140 140
 141/* Machine type dependent parameters. */
 142#include <machine/param.h>
 143#include <machine/limits.h>
 144
 145/*
 146 * Coherency unit: assumed cache line size. See also MIN_LWP_ALIGNMENT.
 147 * The MD code depends on the current values of these constants. Don't
 148 * change them without coordinating.
 149 */
 150#ifndef COHERENCY_UNIT
 151#define COHERENCY_UNIT 64
 152#endif
 153#ifndef CACHE_LINE_SIZE
 154#define CACHE_LINE_SIZE 64
 155#endif
 156
141/* More types and definitions used throughout the kernel. */ 157/* More types and definitions used throughout the kernel. */
142#ifdef _KERNEL 158#ifdef _KERNEL
143#include <sys/cdefs.h> 159#include <sys/cdefs.h>
144#include <sys/errno.h> 160#include <sys/errno.h>
145#include <sys/time.h> 161#include <sys/time.h>
146#include <sys/resource.h> 162#include <sys/resource.h>
147#include <sys/ucred.h> 163#include <sys/ucred.h>
148#include <sys/uio.h> 164#include <sys/uio.h>
149#include <uvm/uvm_param.h> 165#include <uvm/uvm_param.h>
150#ifndef NPROC 166#ifndef NPROC
151#define NPROC (20 + 16 * MAXUSERS) 167#define NPROC (20 + 16 * MAXUSERS)
152#endif 168#endif
153#ifndef MAXFILES 169#ifndef MAXFILES
@@ -163,66 +179,49 @@ @@ -163,66 +179,49 @@
163#endif 179#endif
164#ifndef VNODE_KMEM_MAXPCT 180#ifndef VNODE_KMEM_MAXPCT
165#define VNODE_KMEM_MAXPCT 60 181#define VNODE_KMEM_MAXPCT 60
166#endif 182#endif
167#ifndef BUFCACHE_VA_MAXPCT 183#ifndef BUFCACHE_VA_MAXPCT
168#define BUFCACHE_VA_MAXPCT 20 184#define BUFCACHE_VA_MAXPCT 20
169#endif 185#endif
170#define VNODE_COST 2048 /* assumed space in bytes */ 186#define VNODE_COST 2048 /* assumed space in bytes */
171#endif /* _KERNEL */ 187#endif /* _KERNEL */
172 188
173/* Signals. */ 189/* Signals. */
174#include <sys/signal.h> 190#include <sys/signal.h>
175 191
176/* Machine type dependent parameters. */ 
177#include <machine/param.h> 
178#include <machine/limits.h> 
179 
180#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */ 192#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */
181#define DEV_BSIZE (1 << DEV_BSHIFT) /* 512 */ 193#define DEV_BSIZE (1 << DEV_BSHIFT) /* 512 */
182 194
183#ifndef BLKDEV_IOSIZE 195#ifndef BLKDEV_IOSIZE
184#define BLKDEV_IOSIZE 2048 196#define BLKDEV_IOSIZE 2048
185#endif 197#endif
186 198
187#ifndef MAXPHYS 199#ifndef MAXPHYS
188#define MAXPHYS (64 * 1024) /* max raw I/O transfer size */ 200#define MAXPHYS (64 * 1024) /* max raw I/O transfer size */
189#endif 201#endif
190 202
191/* pages ("clicks") to disk blocks */ 203/* pages ("clicks") to disk blocks */
192#define ctod(x) ((x) << (PGSHIFT - DEV_BSHIFT)) 204#define ctod(x) ((x) << (PGSHIFT - DEV_BSHIFT))
193#define dtoc(x) ((x) >> (PGSHIFT - DEV_BSHIFT)) 205#define dtoc(x) ((x) >> (PGSHIFT - DEV_BSHIFT))
194 206
195/* bytes to pages */ 207/* bytes to pages */
196#define ctob(x) ((x) << PGSHIFT) 208#define ctob(x) ((x) << PGSHIFT)
197#define btoc(x) (((x) + PGOFSET) >> PGSHIFT) 209#define btoc(x) (((x) + PGOFSET) >> PGSHIFT)
198 210
199/* bytes to disk blocks */ 211/* bytes to disk blocks */
200#define dbtob(x) ((x) << DEV_BSHIFT) 212#define dbtob(x) ((x) << DEV_BSHIFT)
201#define btodb(x) ((x) >> DEV_BSHIFT) 213#define btodb(x) ((x) >> DEV_BSHIFT)
202 214
203/* 
204 * Coherency unit: assumed cache line size. See also MIN_LWP_ALIGNMENT. 
205 * The MD code depends on the current values of these constants. Don't 
206 * change them without coordinating. 
207 */ 
208#ifndef COHERENCY_UNIT 
209#define COHERENCY_UNIT 64 
210#endif 
211#ifndef CACHE_LINE_SIZE 
212#define CACHE_LINE_SIZE 64 
213#endif 
214 
215 
216#ifndef MAXCPUS 215#ifndef MAXCPUS
217#define MAXCPUS 32 216#define MAXCPUS 32
218#endif 217#endif
219#ifndef MAX_LWP_PER_PROC 218#ifndef MAX_LWP_PER_PROC
220#define MAX_LWP_PER_PROC 8000 219#define MAX_LWP_PER_PROC 8000
221#endif 220#endif
222 221
223/* 222/*
224 * Stack macros. On most architectures, the stack grows down, 223 * Stack macros. On most architectures, the stack grows down,
225 * towards lower addresses; it is the rare architecture where 224 * towards lower addresses; it is the rare architecture where
226 * it grows up, towards higher addresses. 225 * it grows up, towards higher addresses.
227 * 226 *
228 * STACK_GROW and STACK_SHRINK adjust a stack pointer by some 227 * STACK_GROW and STACK_SHRINK adjust a stack pointer by some