aboutsummaryrefslogtreecommitdiff
path: root/src/os/unix/ngx_posix_init.c
diff options
context:
space:
mode:
authorPiotr Sikora <piotr@aviatrix.com>2024-02-26 20:00:40 +0000
committerPiotr Sikora <piotr@aviatrix.com>2024-02-26 20:00:40 +0000
commit1bc19fe2db3afc7a72eb0a91e554aee9160e0d00 (patch)
tree56705869fee3caeff386a8102dc16caa07753957 /src/os/unix/ngx_posix_init.c
parent818f98da1c46785bc23a99efff653febb1e35ac2 (diff)
downloadnginx-1bc19fe2db3afc7a72eb0a91e554aee9160e0d00.tar.gz
nginx-1bc19fe2db3afc7a72eb0a91e554aee9160e0d00.zip
Detect cache line size at runtime on macOS.
Notably, Apple Silicon CPUs have 128 byte cache line size, which is twice the default configured for generic aarch64. Signed-off-by: Piotr Sikora <piotr@aviatrix.com>
Diffstat (limited to 'src/os/unix/ngx_posix_init.c')
-rw-r--r--src/os/unix/ngx_posix_init.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/os/unix/ngx_posix_init.c b/src/os/unix/ngx_posix_init.c
index 7824735d0..6ac931c0c 100644
--- a/src/os/unix/ngx_posix_init.c
+++ b/src/os/unix/ngx_posix_init.c
@@ -51,7 +51,10 @@ ngx_os_init(ngx_log_t *log)
}
ngx_pagesize = getpagesize();
- ngx_cacheline_size = NGX_CPU_CACHE_LINE;
+
+ if (ngx_cacheline_size == 0) {
+ ngx_cacheline_size = NGX_CPU_CACHE_LINE;
+ }
for (n = ngx_pagesize; n >>= 1; ngx_pagesize_shift++) { /* void */ }