numa: parenthesise the page-align arithmetic (#313)
`(uintptr_t)p+n+4095 & ~(uintptr_t)4095` is CORRECT — `+` binds tighter than `&` in C, so the rounding happens before the mask, which is what was meant. But gcc -Wall warns (`suggest parentheses around '+' in operand of '&'`), and this repo builds clean at -Wall -Wextra. Warning-free is a property worth more than the two characters it costs to keep: it is what makes a NEW warning visible instead of scrolling past in a wall of noise. No behaviour change; the emitted code is identical. Co-Authored-By: ZacharyZcR <#313> Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -1178,7 +1178,7 @@ static void numa_slab_bind(void *p, size_t n){
|
||||
if(g_numa_nodes<2 || !p || !n) return;
|
||||
unsigned long mask=(1UL<<g_numa_nodes)-1;
|
||||
uintptr_t a=(uintptr_t)p & ~(uintptr_t)4095;
|
||||
size_t len=((uintptr_t)p+n+4095 & ~(uintptr_t)4095) - a;
|
||||
size_t len=(((uintptr_t)p+n+4095) & ~(uintptr_t)4095) - a;
|
||||
syscall(SYS_mbind,a,len,3/*MPOL_INTERLEAVE*/,&mask,
|
||||
(unsigned long)(g_numa_nodes+1),(unsigned)2/*MPOL_MF_MOVE*/);
|
||||
#else
|
||||
|
||||
Reference in New Issue
Block a user