]> asedeno.scripts.mit.edu Git - linux.git/commit
x86/mm/pat: Convert the PAT tree to a generic interval tree
authorDavidlohr Bueso <dave@stgolabs.net>
Thu, 21 Nov 2019 01:15:58 +0000 (17:15 -0800)
committerIngo Molnar <mingo@kernel.org>
Thu, 21 Nov 2019 17:47:30 +0000 (18:47 +0100)
commit8d04a5f97a5fa9d7afdf46eda3a5ceaa973a1bcc
treea74ab6c50c40ff5076b008db4f7eb0f1413d4905
parent9f4813b531a0b8cc502fcfb142937fe4e9104d77
x86/mm/pat: Convert the PAT tree to a generic interval tree

With some considerations, the custom pat_rbtree implementation can be
simplified to use most of the generic interval_tree machinery:

 - The tree inorder traversal can slightly differ when there are key
   ('start') collisions in the tree due to one going left and another right.
   This, however, only affects the output of debugfs' pat_memtype_list file.

 - Generic interval trees are now fully closed [a, b], for which we need
   to adjust the last endpoint (ie: end - 1).

 - Erasing logic must remain untouched as well.

 - In order for the types to remain u64, the 'memtype_interval' calls are
   introduced, as opposed to simply using struct interval_tree.

In addition, the PAT tree might potentially also benefit by the fast overlap
detection for the insertion case when looking up the first overlapping node
in the tree.

No change in behavior is intended.

Finally, I've tested this on various servers, via sanity warnings, running
side by side with the current version and so far see no differences in the
returned pointer node when doing memtype_rb_lowest_match() lookups.

Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Link: https://lkml.kernel.org/r/20191121011601.20611-2-dave@stgolabs.net
Signed-off-by: Ingo Molnar <mingo@kernel.org>
arch/x86/mm/pat_rbtree.c