From: Dave Hansen <dave.hansen@intel.com>
To: "Hellstrom, Thomas" <thomas.hellstrom@intel.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"Edgecombe, Rick P" <rick.p.edgecombe@intel.com>,
"dave.hansen@linux.intel.com" <dave.hansen@linux.intel.com>
Cc: "Yu, Yu-cheng" <yu-cheng.yu@intel.com>,
"riel@surriel.com" <riel@surriel.com>,
"luto@kernel.org" <luto@kernel.org>,
"x86@kernel.org" <x86@kernel.org>,
"Cui, Ling" <ling.cui@intel.com>,
"peterz@infradead.org" <peterz@infradead.org>,
"bp@alien8.de" <bp@alien8.de>,
"mingo@redhat.com" <mingo@redhat.com>,
"tglx@kernel.org" <tglx@kernel.org>
Subject: Re: [PATCH] x86/mm: Revert INVLPGB optimization for set_memory code
Date: Wed, 22 Apr 2026 07:01:49 -0700 [thread overview]
Message-ID: <f39520d8-838f-4d3d-aad4-e6bd79f20971@intel.com> (raw)
In-Reply-To: <9febe0ec0332ee7a728adb558409497766e3e603.camel@intel.com>
On 4/22/26 00:59, Hellstrom, Thomas wrote:
> On Tue, 2026-04-21 at 11:46 -0700, Dave Hansen wrote:
>> On 4/21/26 11:42, Edgecombe, Rick P wrote:
>>> Makes sense. And I see the merit in just trying to revert the
>>> change. But I
>>> think a change to fix the optimization is also temptingly small:
>>
>> Yeah, it is tempting. It's probably what I would have done if this
>> wasn't easy to revert, or if it wasn't _just_ an optimization.
>>
>> But once -rc1 hits, we should definitely revisit the optimization.
>
> Are there any timings available for how bad a global TLB flush affects
> system performance vs a single IPI invalidating a limited set of TLB
> entries that aren't likely to be re-populated soon?
> An uneducated guess would probably always favor the latter.
Not in a while. I ran a bunch of numbers a decade or so ago and that's
where the /sys/kernel/debug/x86/tlb_single_page_flush_ceiling default
came from. But that was mostly focused on userspace and before PCIDs if
I remember right.
Rik also looked at some things recently on the AMD side when he was
trying to figure out when to use INVLPGB versus IPIs.
> The set_pages_array_wc() is unfortunately a rather common operation
> when allocating integrated graphics buffer objects. At least until a
> pool of WC pages has been established by the graphics drivers. And I
> think when this is happening it's reasonable to accept a predictable
> allocation delay vs to have the full TLB invalidated across all cores
> repeatedly?
Heh, I'd worry about shattering the direct map first. That costs a
performance penalty on everything, all the time, forever, before I
worried about a few measly one-off global TLB flushes.
There are a million ways to make all of this better. For instance,
during boot, the drm_gem_get_pages() are *probably* physically
contiguous, despite being stored in a ->pages[] array. The cpa code
could look for that. It could also be more careful about INVLPG versus
full flushes when shattering large pages.
But it would need an actual investigation with actual data before we
could make reasonable progress.
next prev parent reply other threads:[~2026-04-22 14:02 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-21 15:19 [PATCH] x86/mm: Revert INVLPGB optimization for set_memory code Dave Hansen
2026-04-21 15:20 ` Dave Hansen
2026-04-21 15:25 ` Hellstrom, Thomas
2026-04-21 18:42 ` Edgecombe, Rick P
2026-04-21 18:46 ` Dave Hansen
2026-04-22 7:59 ` Hellstrom, Thomas
2026-04-22 14:01 ` Dave Hansen [this message]
2026-04-22 19:15 ` [tip: x86/urgent] " tip-bot2 for Dave Hansen
2026-04-24 13:46 ` tip-bot2 for Dave Hansen
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=f39520d8-838f-4d3d-aad4-e6bd79f20971@intel.com \
--to=dave.hansen@intel.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=ling.cui@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rick.p.edgecombe@intel.com \
--cc=riel@surriel.com \
--cc=tglx@kernel.org \
--cc=thomas.hellstrom@intel.com \
--cc=x86@kernel.org \
--cc=yu-cheng.yu@intel.com \
/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