Re: [PATCH] x86/mm/pat: take cpa_lock around large-page collapse
From: Dave Hansen
Date: Fri Jul 10 2026 - 13:13:32 EST
On 6/26/26 09:32, Denis V. Lunev wrote:
> + /*
> + * debug_pagealloc bypasses cpa_lock, so __change_page_attr() walks
> + * unserialized and freeing collapsed PTE-tables could race it; skip
> + * the optional merge there.
> + */
> + if (debug_pagealloc_enabled())
> + return;
Wow, that debug_pagealloc hack is ancient and came with the original
introduction of cpa_lock:
> commit ad5ca55f6bdb47c957b681c7358bb3719ba4ee82
> Author: Suresh Siddha <suresh.b.siddha@xxxxxxxxx>
> Date: Tue Sep 23 14:00:42 2008 -0700
>
> x86, cpa: srlz cpa(), global flush tlb after splitting big page and before doing cpa
My only question is *why*!?!? Why add extra locking complexity and rules
to optimize debug_pagealloc, which is already horrendously slow.
I kinda think we should just _remove_ the locking which is conditional
on debug_pagealloc_enabled().