diff options
author | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2021-08-13 10:06:04 -0300 |
---|---|---|
committer | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2021-12-15 17:35:15 -0300 |
commit | 7478c9959ae409f7b3d63146943575d6ee745352 (patch) | |
tree | 79923a34afb4f9aafaf7a2fbcbfdc2a0997dad55 /include | |
parent | 5f6d8d97c69748180f0031dfa385aff75062c4d5 (diff) | |
download | glibc-7478c9959ae409f7b3d63146943575d6ee745352.tar glibc-7478c9959ae409f7b3d63146943575d6ee745352.tar.gz glibc-7478c9959ae409f7b3d63146943575d6ee745352.tar.bz2 glibc-7478c9959ae409f7b3d63146943575d6ee745352.zip |
malloc: Add THP/madvise support for sbrk
To increase effectiveness with Transparent Huge Page with madvise, the
large page size is use instead page size for sbrk increment for the
main arena.
Checked on x86_64-linux-gnu.
Reviewed-by: DJ Delorie <dj@redhat.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/libc-pointer-arith.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/include/libc-pointer-arith.h b/include/libc-pointer-arith.h index 04ba537617..55dccc10ac 100644 --- a/include/libc-pointer-arith.h +++ b/include/libc-pointer-arith.h @@ -60,4 +60,12 @@ #define PTR_ALIGN_UP(base, size) \ ((__typeof__ (base)) ALIGN_UP ((uintptr_t) (base), (size))) +/* Check if BASE is aligned on SIZE */ +#define PTR_IS_ALIGNED(base, size) \ + ((((uintptr_t) (base)) & (size - 1)) == 0) + +/* Returns the ptrdiff_t diference between P1 and P2. */ +#define PTR_DIFF(p1, p2) \ + ((ptrdiff_t)((uintptr_t)(p1) - (uintptr_t)(p2))) + #endif |