Repository navigation
build: link packages with mold - #70307
djgalloway wants to merge 4 commits into
Conversation
|
Full disclosure, I asked AI for recommendations on speeding up Ceph builds. I don't know the implications of how using Mold might affect Ceph runtime, if at all. I'm eager to hear @tchaikov's input. |
02edb41 to
b8ac089
Compare
|
This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved |
b8ac089 to
ea130f9
Compare
Implemented! |
jq '.[]' prints array elements as bare concatenated JSON documents, so wrapping the output in "[" ... "]" only parsed when a page had a single element (which the PR used for initial testing happened to have). Emit compact one-per-line elements and reassemble with jq -s instead, which is correct for any element count. Verified all three subcommands against a multi-file PR (ceph/ceph#70307). Signed-off-by: David Galloway <[email protected]>
3aa202b to
135db63
Compare
|
@djgalloway hi David, did you get a chance to push this change to ceph-ci? |
https://jenkins.ceph.com/job/ceph-dev-pipeline/8235/stages/ but Jenkins is backed up right now |
|
I don't know if the rgw fix is appropriate for this PR. Thoughts? |
|
This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved |
mold intentionally does not implement --copy-dt-needed-entries and exits with 'mold: fatal: unknown command line option' when passed the flag, which broke every WITH_MOLD=ON build on the ~10 libcephfs/fs test executables that use it. The flag is a workaround for a BFD-specific 'DSO missing from command line' failure that mold does not exhibit, so skip it when USING_MOLD_LINKER is set (by the WITH_MOLD cmake option). Signed-off-by: David Galloway <[email protected]>
mold resolves all archives on the command line as if wrapped in a single --start-group, so it extracts members that BFD's lazy first-pass extraction never touched. Two targets tripped over this in WITH_MOLD=ON builds: * ceph-dencoder: the cls_*_client static libs reference the librados C++ API; mold pulls in the referencing members and fails with undefined librados symbols. Link librados explicitly - the target was underlinked all along. * perf-staged-fltree: mold extracts libcrimson-gtest.a(gtest_seastar.cc.o), whose main() collides with the tool's own. Pass -z muldefs under mold so the first definition (the tool's) wins, matching BFD's behavior. Signed-off-by: David Galloway <[email protected]>
Enable mold for deb and rpm package builds with an explicit WITH_MOLD=ON/OFF instead of autodetection, per review. On the deb side mold is simply ON everywhere: focal, the only release whose toolchain cannot use mold (gcc-11 lacks -fuse-ld=mold), is no longer built from this branch, so every remaining release (jammy, noble, bookworm, trixie) builds with GCC >= 12 and mold is a plain Build-Depends. On the rpm side mold is a BuildRequires and WITH_MOLD=ON on EL9+, gated by a new mold bcond (mold comes from EPEL, so buildroots without EPEL can rpmbuild --without mold, which also flips WITH_MOLD off). Other rpm distros build with WITH_MOLD=OFF. Linking is never cached by sccache, and BFD ld runs single-threaded over ~100 debug-heavy binaries on every package build. Measured with ceph-dev-pipeline on centos9/rocky10/noble x86_64 (default and debug flavors): the package build stage is 16-36% faster with a cold sccache cache and up to 59% faster with a warm one. Signed-off-by: David Galloway <[email protected]>
6d8851a ("rgw: add tcmalloc heap profiler support via admin socket") made rgw_appmain.cc call ceph_heap_profiler_*() and ceph_using_tcmalloc(), and added the heap_profiler library to the radosgw, rgw and rgw_a_standalone targets - but not to rgw_a, whose librgw_a.a(rgw_appmain.cc.o) actually carries the references. Every other consumer of rgw_a (radosgw-es, the rgw test and bench binaries) is therefore underlinked. BFD's lazy archive extraction happens to never pull the referencing member into those links, but mold resolves archives as a single group and fails with undefined symbols. Declare the dependency on rgw_a itself so all consumers inherit it. Signed-off-by: David Galloway <[email protected]>
07a9ad3 to
7efbf93
Compare
| PRIVATE | ||
| rgw_schedulers | ||
| kmip | ||
| heap_profiler |
There was a problem hiding this comment.
@djgalloway please see this fix: #71481
it also removes the hep_profiles from 2 other places.
|
This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved |
|
@djgalloway after my experiments for #72620 I lean towards using lld as the "default linker" for ceph. |
Link package builds with mold, plus the fixes that needs.
Enablement (explicit
WITH_MOLD=ON/OFF, no autodetection, per review):-fuse-ld=mold) — is no longer built from this branch, so every remaining release (jammy, noble, bookworm, trixie) builds with GCC ≥ 12 andmoldis a plain Build-Depends indebian/control.BuildRequires: moldandWITH_MOLD=ONon EL9+, behind a newmoldbcond (mold comes from EPEL, so buildroots without EPEL canrpmbuild --without mold, which also flipsWITH_MOLDoff). Other rpm distros build withWITH_MOLD=OFF.Fixes required by mold — mold resolves all archives on the link line as a single group, so it extracts members BFD's lazy single-pass walk never touched, exposing latent link-dependency bugs; all of these are no-ops for BFD builds:
--copy-dt-needed-entries(a BFD-quirk workaround on ~10 libcephfs/fs test binaries) is skipped under mold, which hard-rejects the option and does not exhibit the quirk.ceph-dencodernow linkslibradosexplicitly: itscls_*_clientstatic libs reference the librados C++ API. Latent underlink.perf-staged-fltreegets-z muldefsunder mold: mold extractslibcrimson-gtest.a(gtest_seastar.cc.o), whosemain()collides with the tool's own; first definition (the tool's) wins, matching BFD behavior.rgw_anow declares itsheap_profilerdependency: 6d8851a addedceph_heap_profiler_*()calls torgw_appmain.ccbut only linkedheap_profilerintoradosgw/rgw/rgw_a_standalone, leaving every other consumer ofrgw_a(radosgw-es, rgw test/bench binaries) underlinked. Latent underlink.Timings
Measured with ceph-dev-pipeline on x86_64
giganticbuilders, "build" stage (compile + package) per matrix cell. Baseline is main #7311 / #7312 (2026-07-17, warm sccache). "Cold" is this branch on a new sha (#7338); "warm" is a FORCE rerun of the same sha (#7341).Notes:
CEPH_BUILD_NORMALIZE_PATHS. The cold column is today's per-push reality for rpm; making rpm paths sha-independent is a planned follow-up and would make every push look like the warm column.Checklist