Re: [PATCH] kbuild: AutoFDO: Enable -salvage-stale-profile
From: Doug Anderson
Date: Thu Nov 05 2026 - 18:23:34 EST
Hi,
On Thu, Nov 5, 2026 at 1:30 PM Doug Anderson <dianders@xxxxxxxxxxxx> wrote:
>
> > While I haven't looked into this specific bug yet and am unsure if it
> > is unique to FS-AFDO, I recommend using -fno-sample-profile-use-profi
> > to disable Profi for now.
>
> Interesting. I can suggest that to the team digging into it and see if
> it solves the problem. My AI agent says it will though. It claims that
> the default flipped recently and "-fno-sample-profile-use-profi" will
> restore the old (tested) behavior.
>
> Should I send a patch adding that flag?
I went ahead and posted the patch:
https://lore.kernel.org/r/20261105151159.1.I0b27923381ef34cc99cdf8b65fea2e1bafce6370@changeid
Obviously that patch and this patch conflict because they touch the
same lines of code. If folks think we should still move forward with
both patches, I'm happy to rebase.
> > Regarding the "--mllvm=-salvage-stale-profile" flag, I also have
> > reservations about adding it for the following reasons:
> > 1. It is heuristic-based and not enabled by default. I am unsure how
> > thoroughly it has been tested, so we should assess it further before
> > enabling it.
>
> FWIW, we did find that Android seems to enable this globally across
> its userspace, which suggests it has been fairly well tested. You can
> see the change here, which landed about 1.5 years ago.
>
> https://android-review.git.corp.google.com/c/platform/build/soong/+/3524291
>
> A few notes:
>
> * That change _also_ adds
> "--salvage-stale-profile-max-callsites=2000". Internally, there has
> been debate about whether adding that would be a good idea, too.
The conclusion of the internal debate is that, yes, we should add
`--salvage-stale-profile-max-callsites=2000` too. So if we decide to
move forward with this patch, I'll send a v2 that adds that flag as
well. For now I'll hold off until there is consensus. :-)
-Doug