The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Mike Rapoport <rppt@kernel.org>
To: Dave Hansen <dave.hansen@intel.com>
Cc: "Denis V. Lunev" <den@openvz.org>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	Andy Lutomirski <luto@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	x86@kernel.org, Thomas Gleixner <tglx@kernel.org>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	"H. Peter Anvin" <hpa@zytor.com>, Juergen Gross <jgross@suse.com>,
	Kiryl Shutsemau <kas@kernel.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] x86/mm/pat: take cpa_lock around large-page collapse
Date: Sat, 11 Jul 2026 11:56:40 +0300	[thread overview]
Message-ID: <alIFSAFIP0EGpjb2@kernel.org> (raw)
In-Reply-To: <aab44f08-89f8-47fe-bee4-0ab6b25968c6@intel.com>

On Fri, Jul 10, 2026 at 10:13:21AM -0700, Dave Hansen wrote:
> 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@intel.com>
> > 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.

My guess would be that the logic was to lock only when a split is possible
and since debug_pagealloc does not split anything, skip the lock.
 
> I kinda think we should just _remove_ the locking which is conditional
> on debug_pagealloc_enabled().

I agree.

-- 
Sincerely yours,
Mike.

      reply	other threads:[~2026-07-11  8:56 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-26 16:32 [PATCH] x86/mm/pat: take cpa_lock around large-page collapse Denis V. Lunev
2026-07-02 17:47 ` Denis V. Lunev
2026-07-03 13:01 ` Kiryl Shutsemau
2026-07-10 16:15 ` Denis V. Lunev
2026-07-10 17:15   ` Dave Hansen
2026-07-11  8:47     ` Mike Rapoport
2026-07-10 17:13 ` Dave Hansen
2026-07-11  8:56   ` Mike Rapoport [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alIFSAFIP0EGpjb2@kernel.org \
    --to=rppt@kernel.org \
    --cc=bp@alien8.de \
    --cc=dave.hansen@intel.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=den@openvz.org \
    --cc=hpa@zytor.com \
    --cc=jgross@suse.com \
    --cc=kas@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=tglx@kernel.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox