Commit Graph

5 Commits

Author SHA1 Message Date
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
ddcf0f96e8 jemalloc: update provisioned headers for linux ppc64le
v2: define JEMALLOC_DEFINE_MADVISE_FREE
    https://s3.amazonaws.com/clickhouse-builds/33057/6482a1c48f22d80f704bf869857091045a3f6917/binary_ppc64le/build_log.log
v3: fix pthread_atfork
    https://github.com/ClickHouse/ClickHouse/runs/5128801105?check_suite_focus=true

Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>

f
2022-02-17 21:25:58 +03:00
Alexey Milovidov
d4e496c314 Add support for PowerPC build 2021-10-12 01:47:57 +03:00
mastertheknife
2d83cb38a3 ppc64le: Enable building with jemalloc 2021-04-01 18:25:42 +03:00