From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5F12876025 for ; Sat, 11 Jul 2026 08:56:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783760210; cv=none; b=mVs1COA6DmDnFKTmpmg36Ne7d782ZHeTMnt6I9uv11zm1pDXfdraPMOO5FD1nw+Qg6KdJJ3GrwavViv2btKfc8S01xF532KLcolQ8fHFM2UduMchRZiAzk0EcTvTmn2K3HXGwi0TbbRiicWeAcQg0sz8V7Rfzr+pUeIyqwxgmQQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783760210; c=relaxed/simple; bh=Q44yiwoOfMijLc6WI6NrDOXhrwoEcXggvFlhPdpo4Bs=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=h2eDRe8M0rZkppJcrWA6yA2VyG4JVh44SEB1CcZ8IojpJhxk1Y7g5Z1q7UGGgID3Ae4Hi9UrMTIxAMZ3EbUOpf5hNALppfsasbXZebZMmMkO7Jm3sFNrAQ7tHrw6POs0Km3LXE1UPCMPsuklsEiZqeH9hLGhRJPF5ALb0eroD0c= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=dL5ywX37; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="dL5ywX37" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 92BC11F000E9; Sat, 11 Jul 2026 08:56:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1783760208; bh=o81WP0dsRYLedNOkHQC5qMAbdkC5wBHulXIJWDD44r8=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=dL5ywX37ysV5CuBM+SqKWAxoGY1839oU5nxrhk2ZdH7B+GwCRJT2y2YXsdBNO5F9I 0S4EvKimNu7s+KiR//4B6gELoPCri/POMr+LADuiZQsiZ5ZmSmASxr5xP5SbHSfnTZ GRz8IY8zMVGVk517KT92sYD1Rb4sPINlBJ7y7xCyEwwaPe7g2pDKgW17oLbJxkyPwI 2IpITdMf0JGLU82UL/HvFJ/YSauNfWoArcysPbCNLM/ri6q1/gA5tiCNv1LpETgj8w 2bmywYYmE6tLtUe32iYxqdZJvupwBnuJqNr48ZAU0pLg9zMll/mXv6IKXRaP08kCeK voKQAaGZZsaJQ== Date: Sat, 11 Jul 2026 11:56:40 +0300 From: Mike Rapoport To: Dave Hansen Cc: "Denis V. Lunev" , Dave Hansen , Andy Lutomirski , Peter Zijlstra , x86@kernel.org, Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Juergen Gross , Kiryl Shutsemau , linux-kernel@vger.kernel.org Subject: Re: [PATCH] x86/mm/pat: take cpa_lock around large-page collapse Message-ID: References: <20260626163213.2284080-1-den@openvz.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 > > 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.