Azat Khuzhin
22611781b0
Fix jemalloc assertion due to non-monotonic CLOCK_MONOTONIC_COARSE
...
Recently one tricky assertion of jemalloc had been discovered [1]:
Failed assertion: "nstime_compare(&decay->epoch, new_time) <= 0"
[1]: https://github.com/ClickHouse/ClickHouse/issues/66193
And as it turns out it is really possible for CLOCK_MONOTONIC_COARSE to
go backwards, in a nutshell it can be done with ADJ_FREQUENCY, you can
find example here [2]. And I can't trigger this issue for non-coarse
clocks.
[2]: https://gist.github.com/azat/7ea7f50ed75591b1af2d675a240ea94c?permalink_comment_id=5119222#gistcomment-5119222
But, jemalloc do not call clock_gettime() that frequently (I've verified
it), so it can use non-coarse version - CLOCK_MONOTONIC
I've also measured the latency of CLOCK_MONOTONIC and
CLOCK_MONOTONIC_COARSE, and it is 20ns vs 4ns per call [3], so make this
change affect performance you need really frequently calls of
clock_gettime.
[3]: https://gist.github.com/azat/622fa1f9a5d8e7d546ee9d294501961d?permalink_comment_id=5119245#gistcomment-5119245
Interesting, that this bug started to appears only after jemalloc heap
profiler had been enabled by default [4], no clue why (I would believe
more in a more frequent calls to clock_adjtime(ADJ_FREQUENCY), but I
can't verify this)
[4]: https://github.com/ClickHouse/ClickHouse/pull/65702
To be continued...
Fixes: https://github.com/ClickHouse/ClickHouse/issues/66193
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2024-07-14 08:21:13 +02:00
Azat Khuzhin
1f049e8bac
Bump jemalloc to fix possible assertion
...
This patch also updates the jemalloc version.
Note, that I've enabled page_id for jemalloc
PR_SET_VMA/PR_SET_VMA_ANON_NAME, that requires linux 5.17+ (but ignores
EINVAL anyway).
v2: add -isystem to fix reserved name for JEMALLOC_OVERRIDE___LIBC_PVALLOC
Refs: https://github.com/jemalloc/jemalloc/pull/2304
Refs: https://github.com/ClickHouse/ClickHouse/issues/31531
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-07-12 07:57:27 +03:00
Azat Khuzhin
4d3c4c7c8c
jemalloc: update provisioned headers for linux aarch64
...
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-02-17 21:25:58 +03:00
Azat Khuzhin
1becc6ca02
jemalloc: jemalloc_preamble.h is common
2020-06-23 01:47:56 +03:00
Azat Khuzhin
6704c42a9e
jemalloc: fix HAVE_CPU_SPINWAIT for linux aarch64
...
Fixes : #11163
2020-06-22 23:24:43 +03:00
Azat Khuzhin
a8749c5d5c
jemalloc: aarch64 does not have pause
2020-05-27 02:19:13 +03:00
Azat Khuzhin
9f1cefd8df
jemalloc: disable secure_getenv()
2020-05-27 02:19:13 +03:00
Azat Khuzhin
82f2b1a986
jemalloc: merge jemalloc_internal_defs.h.in for aarch64
...
- keep LG_PAGE/LG_HUGEPAGE
- use upstream JEMALLOC_PURGE_MADVISE_FREE
2020-05-27 02:19:13 +03:00
Azat Khuzhin
2590ee64d9
jemalloc: merge jemalloc_preamble.h for aarch64
2020-05-27 02:19:13 +03:00
Azat Khuzhin
5da41d5cd6
Configure jemalloc options via cmake
2020-05-21 11:43:29 +03:00
Azat Khuzhin
58ffa4c59c
Enable percpu_arena:percpu for jemalloc
...
This will reduce memory fragmentation due to thread pool.
2020-05-21 01:01:28 +03:00
alexey-milovidov
8a313e9f31
Revert "Update JEMalloc just in case"
2020-03-10 20:28:14 +03:00
Alexey Milovidov
b75927e4ed
Update JEMalloc just in case
2020-03-08 01:59:56 +03:00
Amos Bird
937d0ab8fb
Fix misconfigured jemalloc
2019-12-17 14:22:29 +08:00
Amos Bird
b0d4baccc8
Enable musl and jemalloc for arm.
...
Can generate better arm packages.
2019-10-14 00:06:54 +08:00