Re: amusing SLUB compaction bug when CC_OPTIMIZE_FOR_SIZE

From: Hugh Dickins
Date: Tue Oct 25 2022 - 11:46:01 EST


On Tue, 25 Oct 2022, Vlastimil Babka wrote:
> On 10/25/22 06:19, Hugh Dickins wrote:
> > On Mon, 24 Oct 2022, Vlastimil Babka wrote:
>
> >>
> >> [1] https://lore.kernel.org/all/aec59f53-0e53-1736-5932-25407125d4d4@xxxxxxx/
> >
> > Ignore me, don't let me distract if you're happy with Matthew's patch
> > (I know little of PageMovable, and I haven't tried to understand it);
> > but it did look to me more like 6.2 material,
>
> Yes, it is targetted towards 6.2 now.

That's good.

>
> > and I was surprised that
> > you dropped the simple align(4) approach for 6.1.
> >
> > Because of Hyeonggon's rcu_leak_callback() observation? That was a
> > good catch, but turned out to be irrelevant, because it was only for
> > an RCU debugging option, which would never be set up on a struct page
> > (well, maybe it would in a dynamically-allocated-struct-page future).
>
> It was mainly due to David's observation:
>
> https://lore.kernel.org/all/c1c8920a56014a179dbb82d483f2ad28@xxxxxxxxxxxxxxxx/
>
> I did also conclude that align(4) indeed overrides anything set via
> CONFIG_FUNCTION_ALIGNMENT (and passed by -falign-functions) in a way that a
> globally configured larger alignment can be made smaller by this macro, and
> it was all too risky and last minute to me, while Joel's series wasn't
> targetted to 6.1 anyway so there was no urgency.

Oh, I had thought it was heading for 6.1. Yes, you have good reason
to drop the alignment trick there - thanks for verifying David's point.
I hadn't seen followup, and assumed that the earlier i915 example gave
assurance that alignment was usable (but maybe that's part of why the
i915 folks stopped doing it that way).

Thanks,
Hugh

>
> And yeah it looks like a gcc bug to me.
>
> > Hugh