diff options
| author | Aleksei Bavshin <a.bavshin@nginx.com> | 2025-01-14 10:32:24 -0800 |
|---|---|---|
| committer | Sergey Kandaurov <s.kandaurov@f5.com> | 2025-12-23 22:40:33 +0400 |
| commit | 8d0ebfcd0b31bd2ad33eec2b6c205708397a84b8 (patch) | |
| tree | f82f960a359ac4a27176c4f4be92527be78bc2cd /src | |
| parent | 79e9053f0b278c871b5fabfab7fc515d7a20d3da (diff) | |
| download | nginx-8d0ebfcd0b31bd2ad33eec2b6c205708397a84b8.tar.gz nginx-8d0ebfcd0b31bd2ad33eec2b6c205708397a84b8.tar.bz2 | |
Core: improved NGX_ALIGNMENT detection on some x86_64 platforms.
Previously, the default pool alignment used sizeof(unsigned long), with
the expectation that this would match to a platform word size. Certain
64-bit platforms prove this assumption wrong by keeping the 32-bit long
type, which is fully compliant with the C standard.
This introduces a possibility of suboptimal misaligned access to the
data allocated with ngx_palloc() on the affected platforms, which is
addressed here by changing the default NGX_ALIGNMENT to a pointer size.
As we override the detection in auto/os/conf for all the machine types
except x86, and Unix-like 64-bit systems prefer the 64-bit long, the
impact of the change should be limited to Win64 x64.
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/ngx_config.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/core/ngx_config.h b/src/core/ngx_config.h index 1861be601..707ab216b 100644 --- a/src/core/ngx_config.h +++ b/src/core/ngx_config.h @@ -94,7 +94,7 @@ typedef intptr_t ngx_flag_t; #ifndef NGX_ALIGNMENT -#define NGX_ALIGNMENT sizeof(unsigned long) /* platform word */ +#define NGX_ALIGNMENT sizeof(uintptr_t) /* platform word */ #endif #define ngx_align(d, a) (((d) + (a - 1)) & ~(a - 1)) |
