Thread (36 messages) flat view 36 messages, 3 authors, 2025-05-15

Re: [PATCH v2 08/11] x86/mm/pat: remove MEMTYPE_*_MATCH

From: David Hildenbrand <hidden>
Date: 2025-05-15 14:10:40
Also in: dri-devel, intel-gfx, linux-mm, lkml

On 14.05.25 19:53, David Hildenbrand wrote:
On 13.05.25 19:48, Liam R. Howlett wrote:
quoted
* David Hildenbrand [off-list ref] [250512 08:34]:
quoted
The "memramp() shrinking" scenario no longer applies, so let's remove
that now-unnecessary handling.

Reviewed-by: Lorenzo Stoakes <redacted>
Acked-by: Ingo Molnar <mingo@kernel.org> # x86 bits
Signed-off-by: David Hildenbrand <redacted>
small comment, but this looks good.

Reviewed-by: Liam R. Howlett <redacted>
Thanks!
quoted
quoted
---
   arch/x86/mm/pat/memtype_interval.c | 44 ++++--------------------------
   1 file changed, 6 insertions(+), 38 deletions(-)
diff --git a/arch/x86/mm/pat/memtype_interval.c b/arch/x86/mm/pat/memtype_interval.c
index 645613d59942a..9d03f0dbc4715 100644
--- a/arch/x86/mm/pat/memtype_interval.c
+++ b/arch/x86/mm/pat/memtype_interval.c
@@ -49,26 +49,15 @@ INTERVAL_TREE_DEFINE(struct memtype, rb, u64, subtree_max_end,
   
   static struct rb_root_cached memtype_rbroot = RB_ROOT_CACHED;
   
-enum {
-	MEMTYPE_EXACT_MATCH	= 0,
-	MEMTYPE_END_MATCH	= 1
-};
-
-static struct memtype *memtype_match(u64 start, u64 end, int match_type)
+static struct memtype *memtype_match(u64 start, u64 end)
   {
   	struct memtype *entry_match;
   
   	entry_match = interval_iter_first(&memtype_rbroot, start, end-1);
   
   	while (entry_match != NULL && entry_match->start < end) {
I think this could use interval_tree_for_each_span() instead.
Fancy, let me look at this. Probably I'll send another patch on top of
this series to do that conversion. (as you found, patch #9 moves that code)
Hmmm, I think interval_tree_for_each_span() does not apply here.

Unless I am missing something important, interval_tree_for_each_span() 
does not work in combination with INTERVAL_TREE_DEFINE where we want to 
use a custom type as tree nodes (-> struct memtype).

interval_tree_for_each_span() only works with the basic "struct 
interval_tree_node" implementation ... which is probably also why there 
are only a handful (3) of interval_tree_for_each_span() users, all in 
iommufd context?

But staring at interval_tree.h vs. interval_tree_generic.h, I am a bit 
confused ...

-- 
Cheers,

David / dhildenb
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help