Use an alternative to _PAGE_PROTNONE for _PAGE_NUMA
Subsystems (3)
cover Use an alternative to _PAGE_PROTNONE for _PAGE_NUMA
Aliasing _PAGE_NUMA and _PAGE_PROTNONE had some convenient properties but it ultimately gave Xen a headache and pisses almost everybody off that looks closely at it. Two discussions on "why this makes sense" is one discussion too many so rather than having a third there is this series.
Conceptually it's simple -- use an unused physical address bit for _PAGE_NUMA and make it a 64-bit only feature on x86. This had been avoided before because if the physical address space expands we are back to square one but lets worry about that when it happens unless the x86 maintainers or hardware people warn us that we're about to run headlong into a wall.
Testing was minimal -- short lived JVM and autonumabench tests that trigger the relevant paths for NUMA balancing. Functionally it did not die miserably. Performance looks as expected with no major changes.
arch/x86/Kconfig | 2 +- arch/x86/include/asm/pgtable.h | 8 +++---- arch/x86/include/asm/pgtable_types.h | 44 ++++++++++++++++++++---------------- mm/memory.c | 12 ---------- 4 files changed, 29 insertions(+), 37 deletions(-)
Signature · 7 lines
1.8.4.5 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH 1/3 x86: Require x86-64 for automatic NUMA balancing
Automatic NUMA balancing currently depends on reusing the PROT_NONE bit which has caused problems on Xen. In preparation for using one of the unused physical address bits this patch requires x86-64 for automatic NUMA balancing. 32-bit support for NUMA on x86 is no longer interesting and the loss of automatic NUMA balancing support should be no surprise.
--- arch/x86/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/Kconfig +1 -1
@@ -26,7 +26,7 @@ config X86 select ARCH_MIGHT_HAVE_PC_SERIO select HAVE_AOUT if X86_32 select HAVE_UNSTABLE_SCHED_CLOCK - select ARCH_SUPPORTS_NUMA_BALANCING + select ARCH_SUPPORTS_NUMA_BALANCING if X86_64 select ARCH_SUPPORTS_INT128 if X86_64 select ARCH_WANTS_PROT_NUMA_PROT_NONE select HAVE_IDE
Signature · 7 lines
1.8.4.5 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH 2/3 x86: Define _PAGE_NUMA with unused physical address bits PMD and PTE levels
In reply to Mel Gorman_PAGE_NUMA is currently an alias of _PROT_PROTNONE to trap NUMA hinting faults. As the bit is shared care is taken that _PAGE_NUMA is only used in places where _PAGE_PROTNONE could not reach but this still causes problems on Xen and conceptually difficult.
Fundamentally, we only need the _PAGE_NUMA bit to tell the difference between an entry that is really unmapped and a page that is protected for NUMA hinting faults. Due to physical address limitations bits 52:62 are free so we can currently use them. As the present bit is cleared when making a NUMA PTE, the hinting faults will still be trapped. It means that 32-bit NUMA cannot use automatic NUMA balancing but it is improbable that anyone cares about that configuration.
In the future there will be a problem when the physical address space expands because the bits may no longer be free. There is also the risk that the hardware people are planning to use these bits for some other purpose. When/if this happens then an option would be to use bit 11 and disable kmemcheck if automatic NUMA balancing is enabled assuming bit 11 has not been used for something else in the meantime.
--- arch/x86/include/asm/pgtable.h | 8 +++---- arch/x86/include/asm/pgtable_types.h | 44 ++++++++++++++++++++---------------- 2 files changed, 28 insertions(+), 24 deletions(-)
arch/x86/include/asm/pgtable.h +4 -4
@@ -447,8 +447,8 @@ static inline int pte_same(pte_t a, pte_t b)static inline int pte_present (pte_t a) { -return pte_flags (a) & (_PAGE_PRESENT | _PAGE_PROTNONE | - _PAGE_NUMA); +return (pte_flags (a) & (_PAGE_PRESENT | _PAGE_PROTNONE | + _PAGE_NUMA)) !=0 ; }#define pte_accessible pte_accessible
@@ -477,8 +477,8 @@ static inline int pmd_present(pmd_t pmd)* the _PAGE_PSE flag will remain set at all times while the * _PAGE_PRESENT bit is clear). */ -return pmd_flags (pmd) & (_PAGE_PRESENT | _PAGE_PROTNONE | _PAGE_PSE | - _PAGE_NUMA); +return (pmd_flags (pmd) & (_PAGE_PRESENT | _PAGE_PROTNONE | _PAGE_PSE | + _PAGE_NUMA)) !=0 ; }static inline int pmd_none (pmd_t pmd)
arch/x86/include/asm/pgtable_types.h +24 -20
62 lines not on this page · raw message
Signature · 7 lines
1.8.4.5 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH 3/3 mm: Allow FOLL_NUMA on FOLL_FORCE
In reply to Mel GormanAs _PAGE_NUMA is no longer aliased to _PAGE_PROTNONE there should be no confusion between them. It should be possible to kick away the special casing in __get_user_pages.
--- mm/memory.c | 12 ------------ 1 file changed, 12 deletions(-)
mm/memory.c +0 -12
@@ -1714,18 +1714,6 @@ long __get_user_pages(struct task_struct *tsk, struct mm_struct *mm, vm_flags &= (gup_flags &FOLL_FORCE ) ? (VM_MAYREAD |VM_MAYWRITE ) : (VM_READ |VM_WRITE ); -/* -* If FOLL_FORCE and FOLL_NUMA are both set, handle_mm_fault -* would be called on PROT_NONE ranges. We must never invoke -* handle_mm_fault on PROT_NONE ranges or the NUMA hinting -* page faults would unprotect the PROT_NONE ranges if -* _PAGE_NUMA and _PAGE_PROTNONE are sharing the same pte/pmd -* bitflag. So to avoid that, don't set FOLL_NUMA if -* FOLL_FORCE is set. -*/ -if (!(gup_flags &FOLL_FORCE )) - gup_flags |=FOLL_NUMA ; - i =0 ; do {
Signature · 7 lines
1.8.4.5 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH 2/3] x86: Define _PAGE_NUMA with unused physical address bits PMD and PTE levels
In reply to Mel GormanQuoted 4 lines · Mel Gorman
_PAGE_NUMAis currently an alias of_PROT_PROTNONEto trap NUMA hinting faults. As the bit is shared care is taken that_PAGE_NUMAis only used in places where_PAGE_PROTNONEcould not reach but this still causes problems on Xen and conceptually difficult.
The problem with Xen guests occurred because mprotect() /was/ confusing PROTNONE mappings with _PAGE_NUMA and clearing the non-existant NUMA hints.
David
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH 2/3] x86: Define _PAGE_NUMA with unused physical address bits PMD and PTE levels
Quoted 9 lines · David Vrabel
Quoted 4 lines · Mel Gorman
_PAGE_NUMAis currently an alias of_PROT_PROTNONEto trap NUMA hinting faults. As the bit is shared care is taken that_PAGE_NUMAis only used in places where_PAGE_PROTNONEcould not reach but this still causes problems on Xen and conceptually difficult.The problem with Xen guests occurred because
mprotect()/was/ confusing PROTNONE mappings with_PAGE_NUMAand clearing the non-existant NUMA hints.
I didn't bother spelling it out in case I gave the impression that I was blaming Xen for the problem. As the bit is now changes, does it help the Xen problem or cause another collision of some sort? There is no guarantee _PAGE_NUMA will remain as bit 62 but at worst it'll use bit 11 and NUMA_BALANCING will depend in !KMEMCHECK.
Signature · 8 lines
Mel Gorman SUSE Labs -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH 2/3] x86: Define _PAGE_NUMA with unused physical address bits PMD and PTE levels
Quoted 7 lines · Mel Gorman
Quoted 6 lines · David Vrabel
Quoted 4 lines · Mel Gorman
_PAGE_NUMAis currently an alias of_PROT_PROTNONEto trap NUMA hinting faults. As the bit is shared care is taken that_PAGE_NUMAis only used in places where_PAGE_PROTNONEcould not reach but this still causes problems on Xen and conceptually difficult.
Quoted 8 lines
Quoted 2 lines
The problem with Xen guests occurred because
mprotect()/was/ confusing PROTNONE mappings with_PAGE_NUMAand clearing the non-existant NUMA hints.I didn't bother spelling it out in case I gave the impression that I was blaming Xen for the problem. As the bit is now changes, does it help the Xen problem or cause another collision of some sort? There is no guarantee
_PAGE_NUMAwill remain as bit 62 but at worst it'll use bit 11 andNUMA_BALANCINGwill depend in !KMEMCHECK.
Fwiw, we're using bit 11 for soft-dirty tracking, so i really hope worst case never happen. (At the moment I'm trying to figure out if with this set it would be possible to clean up ugly macros in pgoff_to_pte for 2 level pages).
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH 2/3] x86: Define _PAGE_NUMA with unused physical address bits PMD and PTE levels
Quoted 17 lines · Cyrill Gorcunov
Quoted 7 lines · Mel Gorman
Quoted 6 lines · David Vrabel
Quoted 4 lines · Mel Gorman
_PAGE_NUMAis currently an alias of_PROT_PROTNONEto trap NUMA hinting faults. As the bit is shared care is taken that_PAGE_NUMAis only used in places where_PAGE_PROTNONEcould not reach but this still causes problems on Xen and conceptually difficult.Quoted 8 lines
Quoted 2 lines
The problem with Xen guests occurred because
mprotect()/was/ confusing PROTNONE mappings with_PAGE_NUMAand clearing the non-existant NUMA hints.I didn't bother spelling it out in case I gave the impression that I was blaming Xen for the problem. As the bit is now changes, does it help the Xen problem or cause another collision of some sort? There is no guarantee
_PAGE_NUMAwill remain as bit 62 but at worst it'll use bit 11 andNUMA_BALANCINGwill depend in !KMEMCHECK.
Quoted 3 lines
Fwiw, we're using bit 11 for soft-dirty tracking, so i really hope worst case never happen. (At the moment I'm trying to figure out if with this set it would be possible to clean up ugly macros in
pgoff_to_ptefor 2 level pages).
I had considered the soft-dirty tracking usage of the same bit. I thought I'd be able to swizzle around it or a further worst case of having soft-dirty and automatic NUMA balancing mutually exclusive. Unfortunately upon examination it's not obvious how to have both of them share a bit and I suspect any attempt to will break CRIU. In my current tree, NUMA_BALANCING cannot be set if MEM_SOFT_DIRTY which is not particularly satisfactory. Next on the list is examining if _PAGE_BIT_IOMAP can be used.
Signature · 8 lines
Mel Gorman SUSE Labs -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH 2/3] x86: Define _PAGE_NUMA with unused physical address bits PMD and PTE levels
Quoted 10 lines · Mel Gorman
Quoted 9 lines
Quoted 5 lines
I didn't bother spelling it out in case I gave the impression that I was blaming Xen for the problem. As the bit is now changes, does it help the Xen problem or cause another collision of some sort? There is no guarantee
_PAGE_NUMAwill remain as bit 62 but at worst it'll use bit 11 andNUMA_BALANCINGwill depend in !KMEMCHECK.Fwiw, we're using bit 11 for soft-dirty tracking, so i really hope worst case never happen. (At the moment I'm trying to figure out if with this set it would be possible to clean up ugly macros in
pgoff_to_ptefor 2 level pages).
Quoted 7 lines
I had considered the soft-dirty tracking usage of the same bit. I thought I'd be able to swizzle around it or a further worst case of having soft-dirty and automatic NUMA balancing mutually exclusive. Unfortunately upon examination it's not obvious how to have both of them share a bit and I suspect any attempt to will break CRIU. In my current tree,
NUMA_BALANCINGcannot be set ifMEM_SOFT_DIRTYwhich is not particularly satisfactory. Next on the list is examining if_PAGE_BIT_IOMAPcan be used.
Thanks for info, Mel! It seems indeed if no more space left on x86-64 (in the very worst case which I still think won't happen anytime soon) we'll have to make them mut. exclusive. But for now (with 62 bit used for numa) they can live together, right?
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
H. Peter Anvin
reviewerRe: [PATCH 2/3] x86: Define _PAGE_NUMA with unused physical address bits PMD and PTE levels
In reply to Mel GormanQuoted 9 lines · Mel Gorman
I had considered the soft-dirty tracking usage of the same bit. I thought I'd be able to swizzle around it or a further worst case of having soft-dirty and automatic NUMA balancing mutually exclusive. Unfortunately upon examination it's not obvious how to have both of them share a bit and I suspect any attempt to will break CRIU. In my current tree,
NUMA_BALANCINGcannot be set ifMEM_SOFT_DIRTYwhich is not particularly satisfactory. Next on the list is examining if_PAGE_BIT_IOMAPcan be used.
Didn't we smoke the last user of _PAGE_BIT_IOMAP?
-hpa
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH 2/3] x86: Define _PAGE_NUMA with unused physical address bits PMD and PTE levels
Quoted 11 lines · H. Peter Anvin
Quoted 8 lines · Mel Gorman
I had considered the soft-dirty tracking usage of the same bit. I thought I'd be able to swizzle around it or a further worst case of having soft-dirty and automatic NUMA balancing mutually exclusive. Unfortunately upon examination it's not obvious how to have both of them share a bit and I suspect any attempt to will break CRIU. In my current tree,
NUMA_BALANCINGcannot be set ifMEM_SOFT_DIRTYwhich is not particularly satisfactory. Next on the list is examining if_PAGE_BIT_IOMAPcan be used.Didn't we smoke the last user of
_PAGE_BIT_IOMAP?
Seems so, at least for non-kernel pages (not considering this bit references in xen code, which i simply don't know but i guess it's used for kernel pages only).
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
H. Peter Anvin
reviewerRe: [PATCH 2/3] x86: Define _PAGE_NUMA with unused physical address bits PMD and PTE levels
Quoted 11 lines · Cyrill Gorcunov
Quoted 10 lines · H. Peter Anvin
Quoted 8 lines · Mel Gorman
I had considered the soft-dirty tracking usage of the same bit. I thought I'd be able to swizzle around it or a further worst case of having soft-dirty and automatic NUMA balancing mutually exclusive. Unfortunately upon examination it's not obvious how to have both of them share a bit and I suspect any attempt to will break CRIU. In my current tree,
NUMA_BALANCINGcannot be set ifMEM_SOFT_DIRTYwhich is not particularly satisfactory. Next on the list is examining if_PAGE_BIT_IOMAPcan be used.
Quoted 5 lines
Quoted 1 line
Didn't we smoke the last user of
_PAGE_BIT_IOMAP?Seems so, at least for non-kernel pages (not considering this bit references in xen code, which i simply don't know but i guess it's used for kernel pages only).
David Vrabel has a patchset which I presumed would be pulled through the Xen tree this merge window:
[PATCHv5 0/8] x86/xen: fixes for mapping high MMIO regions (and remove _PAGE_IOMAP)
That frees up this bit.
-hpa
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH 2/3] x86: Define _PAGE_NUMA with unused physical address bits PMD and PTE levels
In reply to Mel Gormanarch/x86/include/asm/pgtable_types.h line 35
Quoted 8 lines · Mel Gorman
arch/x86/include/asm/pgtable_types.h +8
-0+/* +* Software bits ignored by the page table walker +* At the time of writing, different levels have bits that are ignored. Due +* to physical address limitations, bits 52:62 should be ignored for the PMD +* and PTE levels and are available for use by software. Be aware that this +* may change if the physical address space expands. +*/ +#define _PAGE_BIT_NUMA 62
Doesn't moving it up to the high bits break pte_modify()'s assumptions?
I was thinking of this nugget from change_pte_range():
ptent = ptep_modify_prot_start(mm, addr, pte);
if (pte_numa(ptent))
ptent = pte_mknonnuma(ptent);
ptent = pte_modify(ptent, newprot);pte_modify() pulls off all the high bits out of 'ptent' and only adds them back if they're in newprot (which as far as I can tell comes from the VMA). So I _think_ it'll axe the _PAGE_NUMA out of 'ptent'.
Re: [PATCH 2/3] x86: Define _PAGE_NUMA with unused physical address bits PMD and PTE levels
In reply to H. Peter AnvinQuoted 11 lines · H. Peter Anvin
Quoted 9 lines · Mel Gorman
I had considered the soft-dirty tracking usage of the same bit. I thought I'd be able to swizzle around it or a further worst case of having soft-dirty and automatic NUMA balancing mutually exclusive. Unfortunately upon examination it's not obvious how to have both of them share a bit and I suspect any attempt to will break CRIU. In my current tree,
NUMA_BALANCINGcannot be set ifMEM_SOFT_DIRTYwhich is not particularly satisfactory. Next on the list is examining if_PAGE_BIT_IOMAPcan be used.
Quoted 2 lines
Didn't we smoke the last user of
_PAGE_BIT_IOMAP?
There are still some users of _PAGE_IOMAP with Xen being the main user. For x86 on bare metal it looks like userspace should never have a PTE with _PAGE_IO set so it should be usable as _PAGE_NUMA. Patches that do that are currently being tested but a side-effect was that I had to disable support on Xen as Xen appears to use it to distinguish between Xen PTEs and MFNs. It's unclear what automatic NUMA balancing on Xen even means -- are NUMA nodes always mapped to the physical topology? What is sensible behaviour if guest and host both run it? etc. If they need it, we can then examine what the proper way to support _PAGE_NUMA on Xen is.
Signature · 8 lines
Mel Gorman SUSE Labs -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH 2/3] x86: Define _PAGE_NUMA with unused physical address bits PMD and PTE levels
In reply to H. Peter AnvinQuoted 18 lines · H. Peter Anvin
Quoted 11 lines · Cyrill Gorcunov
Quoted 10 lines · H. Peter Anvin
Quoted 8 lines · Mel Gorman
I had considered the soft-dirty tracking usage of the same bit. I thought I'd be able to swizzle around it or a further worst case of having soft-dirty and automatic NUMA balancing mutually exclusive. Unfortunately upon examination it's not obvious how to have both of them share a bit and I suspect any attempt to will break CRIU. In my current tree,
NUMA_BALANCINGcannot be set ifMEM_SOFT_DIRTYwhich is not particularly satisfactory. Next on the list is examining if_PAGE_BIT_IOMAPcan be used.Quoted 5 lines
Quoted 1 line
Didn't we smoke the last user of
_PAGE_BIT_IOMAP?Seems so, at least for non-kernel pages (not considering this bit references in xen code, which i simply don't know but i guess it's used for kernel pages only).
Quoted 8 lines
David Vrabel has a patchset which I presumed would be pulled through the Xen tree this merge window:
[PATCHv5 0/8] x86/xen: fixes for mapping high MMIO regions (and remove
_PAGE_IOMAP)That frees up this bit.
Thanks, I was not aware of that patch. Based on it, I intend to force automatic NUMA balancing to depend on !XEN and see what the reaction is. If support for Xen is really required then it potentially be re-enabled if/when that series is merged assuming they do not need the bit for something else.
Signature · 8 lines
Mel Gorman SUSE Labs -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH 2/3] x86: Define _PAGE_NUMA with unused physical address bits PMD and PTE levels
Quoted 25 lines · Mel Gorman
Quoted 24 lines · H. Peter Anvin
Quoted 11 lines · Cyrill Gorcunov
Quoted 10 lines · H. Peter Anvin
Quoted 8 lines · Mel Gorman
I had considered the soft-dirty tracking usage of the same bit. I thought I'd be able to swizzle around it or a further worst case of having soft-dirty and automatic NUMA balancing mutually exclusive. Unfortunately upon examination it's not obvious how to have both of them share a bit and I suspect any attempt to will break CRIU. In my current tree,
NUMA_BALANCINGcannot be set ifMEM_SOFT_DIRTYwhich is not particularly satisfactory. Next on the list is examining if_PAGE_BIT_IOMAPcan be used.Quoted 5 lines
Quoted 1 line
Didn't we smoke the last user of
_PAGE_BIT_IOMAP?Seems so, at least for non-kernel pages (not considering this bit references in xen code, which i simply don't know but i guess it's used for kernel pages only).
David Vrabel has a patchset which I presumed would be pulled through the Xen tree this merge window:
[PATCHv5 0/8] x86/xen: fixes for mapping high MMIO regions (and remove
_PAGE_IOMAP)
Quoted 8 lines
Quoted 2 lines
That frees up this bit.
Thanks, I was not aware of that patch. Based on it, I intend to force automatic NUMA balancing to depend on !XEN and see what the reaction is. If support for Xen is really required then it potentially be re-enabled if/when that series is merged assuming they do not need the bit for something else.
Amazon EC2 does have large memory instance types with NUMA exposed to the guest (e.g. c3.8xlarge, i2.8xlarge, etc), so it'd be preferable (to me anyway) if we didn't require !XEN.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH 2/3] x86: Define _PAGE_NUMA with unused physical address bits PMD and PTE levels
In reply to Cyrill GorcunovQuoted 11 lines · Cyrill Gorcunov
Quoted 10 lines · H. Peter Anvin
Quoted 8 lines · Mel Gorman
I had considered the soft-dirty tracking usage of the same bit. I thought I'd be able to swizzle around it or a further worst case of having soft-dirty and automatic NUMA balancing mutually exclusive. Unfortunately upon examination it's not obvious how to have both of them share a bit and I suspect any attempt to will break CRIU. In my current tree,
NUMA_BALANCINGcannot be set ifMEM_SOFT_DIRTYwhich is not particularly satisfactory. Next on the list is examining if_PAGE_BIT_IOMAPcan be used.
Quoted 1 line
Quoted 1 line
Didn't we smoke the last user of
_PAGE_BIT_IOMAP?
Not yet.
A last minute regression with mapping of I/O regions from userspace was found so I had to drop the series from 3.15. It should be back for 3.16.
Quoted 2 lines
Seems so, at least for non-kernel pages (not considering this bit references in xen code, which i simply don't know but i guess it's used for kernel pages only).
Xen uses it for all I/O mappings, both kernel and for userspace.
David
H. Peter Anvin
reviewerRe: [PATCH 2/3] x86: Define _PAGE_NUMA with unused physical address bits PMD and PTE levels
In reply to Steven Noonan<snark>
Of course, it would also be preferable if Amazon (or anything else) didn't need Xen PV :(
Quoted 52 lines · Steven Noonan
Quoted 6 lines · Mel Gorman
Quoted 5 lines · H. Peter Anvin
Quoted 4 lines · Cyrill Gorcunov
Quoted 3 lines · H. Peter Anvin
Quoted 2 lines · Mel Gorman
I had considered the soft-dirty tracking usage of the same bit.
I thought I'd
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
be able to swizzle around it or a further worst case of having
soft-dirty and
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
automatic NUMA balancing mutually exclusive. Unfortunately upon
examination
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
it's not obvious how to have both of them share a bit and I
suspect any
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
attempt to will break CRIU. In my current tree,
NUMA_BALANCINGcannot be
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
set if
MEM_SOFT_DIRTYwhich is not particularly satisfactory.Next on the
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
list is examining if
_PAGE_BIT_IOMAPcan be used.Didn't we smoke the last user of
_PAGE_BIT_IOMAP?Seems so, at least for non-kernel pages (not considering this bit
references in
Quoted 1 line
Quoted 1 line
Quoted 1 line
xen code, which i simply don't know but i guess it's used for
kernel pages only).
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
David Vrabel has a patchset which I presumed would be pulled through
the
Quoted 3 lines
Quoted 3 lines
Xen tree this merge window:
[PATCHv5 0/8] x86/xen: fixes for mapping high MMIO regions (and
remove
Quoted 6 lines
Quoted 4 lines
_PAGE_IOMAP)That frees up this bit.
Thanks, I was not aware of that patch. Based on it, I intend to
force
Quoted 1 line
automatic NUMA balancing to depend on !XEN and see what the reaction
is. If
Quoted 1 line
support for Xen is really required then it potentially be re-enabled
if/when
Quoted 1 line
that series is merged assuming they do not need the bit for something
else.
Quoted 1 line
Amazon EC2 does have large memory instance types with NUMA exposed to the guest (e.g. c3.8xlarge, i2.8xlarge, etc), so it'd be preferable (to me anyway) if we didn't require !XEN.
Signature · 7 lines
Sent from my mobile phone. Please pardon brevity and lack of formatting. -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH 2/3] x86: Define _PAGE_NUMA with unused physical address bits PMD and PTE levels
.snip..
Quoted 16 lines
Quoted 16 lines
Quoted 1 line
Quoted 1 line
David Vrabel has a patchset which I presumed would be pulled through
the
Quoted 3 lines
Quoted 3 lines
Xen tree this merge window:
[PATCHv5 0/8] x86/xen: fixes for mapping high MMIO regions (and
remove
Quoted 6 lines
Quoted 4 lines
_PAGE_IOMAP)That frees up this bit.
Thanks, I was not aware of that patch. Based on it, I intend to
force
Quoted 1 line
automatic NUMA balancing to depend on !XEN and see what the reaction
is. If
Quoted 1 line
support for Xen is really required then it potentially be re-enabled
Quoted 8 lines
Quoted 8 lines
if/when
Quoted 1 line
that series is merged assuming they do not need the bit for something
else.
Quoted 1 line
Amazon EC2 does have large memory instance types with NUMA exposed to the guest (e.g. c3.8xlarge, i2.8xlarge, etc), so it'd be preferable (to me anyway) if we didn't require !XEN.
What about the patch that David Vrabel posted:
http://osdir.com/ml/general/2014-03/msg41979.html
Has anybody taken it for a spin?
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
H. Peter Anvin
reviewerRe: [PATCH 2/3] x86: Define _PAGE_NUMA with unused physical address bits PMD and PTE levels
Quoted 11 lines · Konrad Rzeszutek Wilk
Quoted 4 lines
Quoted 4 lines
Amazon EC2 does have large memory instance types with NUMA exposed to the guest (e.g. c3.8xlarge, i2.8xlarge, etc), so it'd be preferable (to me anyway) if we didn't require !XEN.
What about the patch that David Vrabel posted:
http://osdir.com/ml/general/2014-03/msg41979.html
Has anybody taken it for a spin?
Oh lovely, more pvops in low level paths. I'm so thrilled.
Incidentally, I wasn't even Cc:'d on that patch and was only added to the thread by Linus, but never saw the early bits of the thread including the actual patch.
-hpa
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH 2/3] x86: Define _PAGE_NUMA with unused physical address bits PMD and PTE levels
Quoted 10 lines · H. Peter Anvin
Quoted 9 lines · Konrad Rzeszutek Wilk
Quoted 4 lines
Quoted 4 lines
Amazon EC2 does have large memory instance types with NUMA exposed to the guest (e.g. c3.8xlarge, i2.8xlarge, etc), so it'd be preferable (to me anyway) if we didn't require !XEN.
What about the patch that David Vrabel posted:
Quoted 9 lines
Quoted 2 lines
Has anybody taken it for a spin?
Oh lovely, more pvops in low level paths. I'm so thrilled.
Incidentally, I wasn't even Cc:'d on that patch and was only added to the thread by Linus, but never saw the early bits of the thread including the actual patch.
I posted an alternative to that patch that confines the damage to the NUMA pte helpers.
Signature · 2 lines
Mel Gorman SUSE Labs
Re: [PATCH 2/3] x86: Define _PAGE_NUMA with unused physical address bits PMD and PTE levels
In reply to H. Peter AnvinQuoted 10 lines · H. Peter Anvin
Quoted 9 lines · Konrad Rzeszutek Wilk
Quoted 4 lines
Quoted 4 lines
Amazon EC2 does have large memory instance types with NUMA exposed to the guest (e.g. c3.8xlarge, i2.8xlarge, etc), so it'd be preferable (to me anyway) if we didn't require !XEN.
What about the patch that David Vrabel posted:
Quoted 8 lines
Quoted 2 lines
Has anybody taken it for a spin?
Oh lovely, more pvops in low level paths. I'm so thrilled.
Incidentally, I wasn't even Cc:'d on that patch and was only added to the thread by Linus, but never saw the early bits of the thread including the actual patch.
I did resend a version CC'd to all the x86 maintainers and included some performance figures for native (~1 extra clock cycle).
I've included it again below.
My preference would be take this patch as it fixes it for both NUMA rebalancing and any future uses that want to set/clear _PAGE_PRESENT.
David
8<--------------
x86: use pv-ops in {pte, pmd}_{set,clear}_flags()
Instead of using native functions to operate on the PTEs in pte_set_flags(), pte_clear_flags(), pmd_set_flags(), pmd_clear_flags() use the PV aware ones.
This fixes a regression in Xen PV guests introduced by 1667918b6483 (mm: numa: clear numa hinting information on mprotect).
This has negligible performance impact on native since the pte_val() and __pte() (etc.) calls are patched at runtime when running on bare metal. Measurements on a 3 GHz AMD 4284 give approx. 0.3 ns (~1 clock cycle) of additional time for each function.
Xen PV guest page tables require that their entries use machine addresses if the preset bit (_PAGE_PRESENT) is set, and (for successful migration) non-present PTEs must use pseudo-physical addresses. This is because on migration MFNs only present PTEs are translated to PFNs (canonicalised) so they may be translated back to the new MFN in the destination domain (uncanonicalised).
pte_mknonnuma(), pmd_mknonnuma(), pte_mknuma() and pmd_mknuma() set and clear the _PAGE_PRESENT bit using pte_set_flags(), pte_clear_flags(), etc.
In a Xen PV guest, these functions must translate MFNs to PFNs when clearing _PAGE_PRESENT and translate PFNs to MFNs when setting _PAGE_PRESENT.
--- arch/x86/include/asm/pgtable.h | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-)
arch/x86/include/asm/pgtable.h +6 -6
@@ -174,16 +174,16 @@ static inline int has_transparent_hugepage(void)static inline pte_t pte_set_flags (pte_t pte,pteval_t set) { -pteval_t v =native_pte_val (pte); +pteval_t v =pte_val (pte); -return native_make_pte (v | set); +return __pte (v | set); }static inline pte_t pte_clear_flags (pte_t pte,pteval_t clear) { -pteval_t v =native_pte_val (pte); +pteval_t v =pte_val (pte); -return native_make_pte (v & ~clear); +return __pte (v & ~clear); }static inline pte_t pte_mkclean (pte_t pte)
@@ -248,14 +248,14 @@ static inline pte_t pte_mkspecial(pte_t pte)static inline pmd_t pmd_set_flags (pmd_t pmd,pmdval_t set) { -pmdval_t v =native_pmd_val (pmd); +pmdval_t v =pmd_val (pmd);return __pmd (v | set); }static inline pmd_t pmd_clear_flags (pmd_t pmd,pmdval_t clear) { -pmdval_t v =native_pmd_val (pmd); +pmdval_t v =pmd_val (pmd);return __pmd (v & ~clear); }
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH 2/3] x86: Define _PAGE_NUMA with unused physical address bits PMD and PTE levels
In reply to Konrad Rzeszutek WilkQuoted 26 lines · Konrad Rzeszutek Wilk
.snip..
Quoted 16 lines
Quoted 16 lines
Quoted 1 line
Quoted 1 line
David Vrabel has a patchset which I presumed would be pulled through
the
Quoted 3 lines
Quoted 3 lines
Xen tree this merge window:
[PATCHv5 0/8] x86/xen: fixes for mapping high MMIO regions (and
remove
Quoted 6 lines
Quoted 4 lines
_PAGE_IOMAP)That frees up this bit.
Thanks, I was not aware of that patch. Based on it, I intend to
force
Quoted 1 line
automatic NUMA balancing to depend on !XEN and see what the reaction
is. If
Quoted 1 line
support for Xen is really required then it potentially be re-enabled
Quoted 8 lines
Quoted 8 lines
if/when
Quoted 1 line
that series is merged assuming they do not need the bit for something
else.
Quoted 1 line
Amazon EC2 does have large memory instance types with NUMA exposed to the guest (e.g. c3.8xlarge, i2.8xlarge, etc), so it'd be preferable (to me anyway) if we didn't require !XEN.
Quoted 5 lines
What about the patch that David Vrabel posted:
http://osdir.com/ml/general/2014-03/msg41979.html
Has anybody taken it for a spin?
Alternatively "[PATCH 4/5] mm: use paravirt friendly ops for NUMA hinting ptes" which modifies the NUMA pte helpers instead of the main set/clear ones.
Signature · 8 lines
Mel Gorman SUSE Labs -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH 2/3] x86: Define _PAGE_NUMA with unused physical address bits PMD and PTE levels
In reply to H. Peter AnvinQuoted 3 lines · H. Peter Anvin
<snark>
Of course, it would also be preferable if Amazon (or anything else) didn't need Xen PV :(
Well Amazon doesn't expose NUMA on PV, only on HVM guests.
Quoted 54 lines · Steven Noonan
Quoted 44 lines · Mel Gorman
Quoted 6 lines · H. Peter Anvin
Quoted 5 lines · Cyrill Gorcunov
Quoted 4 lines · H. Peter Anvin
Quoted 3 lines · Mel Gorman
Quoted 2 lines
I had considered the soft-dirty tracking usage of the same bit.
I thought I'd
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
be able to swizzle around it or a further worst case of having
soft-dirty and
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
automatic NUMA balancing mutually exclusive. Unfortunately upon
examination
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
it's not obvious how to have both of them share a bit and I
suspect any
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
attempt to will break CRIU. In my current tree,
NUMA_BALANCINGcannot be
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
set if
MEM_SOFT_DIRTYwhich is not particularly satisfactory.Next on the
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
list is examining if
_PAGE_BIT_IOMAPcan be used.Didn't we smoke the last user of
_PAGE_BIT_IOMAP?Seems so, at least for non-kernel pages (not considering this bit
references in
Quoted 1 line
Quoted 1 line
Quoted 1 line
xen code, which i simply don't know but i guess it's used for
kernel pages only).
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
David Vrabel has a patchset which I presumed would be pulled through
the
Quoted 3 lines
Quoted 3 lines
Xen tree this merge window:
[PATCHv5 0/8] x86/xen: fixes for mapping high MMIO regions (and
remove
Quoted 6 lines
Quoted 4 lines
_PAGE_IOMAP)That frees up this bit.
Thanks, I was not aware of that patch. Based on it, I intend to
force
Quoted 1 line
automatic NUMA balancing to depend on !XEN and see what the reaction
is. If
Quoted 1 line
support for Xen is really required then it potentially be re-enabled
Quoted 8 lines
if/when
Quoted 1 line
that series is merged assuming they do not need the bit for something
else.
Quoted 1 line
Amazon EC2 does have large memory instance types with NUMA exposed to the guest (e.g. c3.8xlarge, i2.8xlarge, etc), so it'd be preferable (to me anyway) if we didn't require !XEN.
Quoted 8 lines
--
Sent from my mobile phone. Please pardon brevity and lack of formatting.--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
H. Peter Anvin
reviewerRe: [PATCH 2/3] x86: Define _PAGE_NUMA with unused physical address bits PMD and PTE levels
Quoted 7 lines · Steven Noonan
Quoted 3 lines · H. Peter Anvin
<snark>
Of course, it would also be preferable if Amazon (or anything else) didn't need Xen PV :(
Well Amazon doesn't expose NUMA on PV, only on HVM guests.
Yes, but Amazon is one of the main things keeping Xen PV alive as far as I can tell, which means the support gets built in, and so on.
-hpa
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH 2/3] x86: Define _PAGE_NUMA with unused physical address bits PMD and PTE levels
Quoted 11 lines · H. Peter Anvin
Quoted 7 lines · Steven Noonan
Quoted 3 lines · H. Peter Anvin
<snark>
Of course, it would also be preferable if Amazon (or anything else) didn't need Xen PV :(
Well Amazon doesn't expose NUMA on PV, only on HVM guests.
Yes, but Amazon is one of the main things keeping Xen PV alive as far as I can tell, which means the support gets built in, and so on.
Taking the snarkiness aside, the issue here is that even on guests without NUMA exposed the problem shows up. That is the 'mknuma' are still being called even if the guest topology is not NUMA!
Which brings a question - why isn't the mknuma and its friends gatted by an jump_label machinery or such?
Mel, any particular reasons why it couldn't be done this way?
Quoted 9 lines
-hpa
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH 2/3] x86: Define _PAGE_NUMA with unused physical address bits PMD and PTE levels
Quoted 13 lines · Konrad Rzeszutek Wilk
Quoted 11 lines · H. Peter Anvin
Quoted 7 lines · Steven Noonan
Quoted 3 lines · H. Peter Anvin
<snark>
Of course, it would also be preferable if Amazon (or anything else) didn't need Xen PV :(
Well Amazon doesn't expose NUMA on PV, only on HVM guests.
Yes, but Amazon is one of the main things keeping Xen PV alive as far as I can tell, which means the support gets built in, and so on.
Quoted 8 lines
Taking the snarkiness aside, the issue here is that even on guests without NUMA exposed the problem shows up. That is the 'mknuma' are still being called even if the guest topology is not NUMA!
Which brings a question - why isn't the mknuma and its friends gatted by an
jump_labelmachinery or such?Mel, any particular reasons why it couldn't be done this way?
Hmm,. I thought we disabled all that when there was only the 1 node. All this should be driven from task_tick_numa() which only gets called when numabalancing_enabled, and that _should_ be false when nr_nodes == 1.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH 2/3] x86: Define _PAGE_NUMA with unused physical address bits PMD and PTE levels
In reply to Mel GormanQuoted 29 lines · Mel Gorman
Quoted 28 lines · Konrad Rzeszutek Wilk
.snip..
Quoted 16 lines
Quoted 16 lines
Quoted 1 line
Quoted 1 line
David Vrabel has a patchset which I presumed would be pulled through
the
Quoted 3 lines
Quoted 3 lines
Xen tree this merge window:
[PATCHv5 0/8] x86/xen: fixes for mapping high MMIO regions (and
remove
Quoted 6 lines
Quoted 4 lines
_PAGE_IOMAP)That frees up this bit.
Thanks, I was not aware of that patch. Based on it, I intend to
force
Quoted 1 line
automatic NUMA balancing to depend on !XEN and see what the reaction
is. If
Quoted 1 line
support for Xen is really required then it potentially be re-enabled
Quoted 8 lines
Quoted 8 lines
if/when
Quoted 1 line
that series is merged assuming they do not need the bit for something
else.
Quoted 1 line
Amazon EC2 does have large memory instance types with NUMA exposed to the guest (e.g. c3.8xlarge, i2.8xlarge, etc), so it'd be preferable (to me anyway) if we didn't require !XEN.
What about the patch that David Vrabel posted:
Quoted 7 lines
Quoted 3 lines
http://osdir.com/ml/general/2014-03/msg41979.html
Has anybody taken it for a spin?
Alternatively "[PATCH 4/5] mm: use paravirt friendly ops for NUMA hinting ptes" which modifies the NUMA pte helpers instead of the main set/clear ones.
Ah nice! Looking forward to it being posted as non-RFC and could you also please CC '[email protected]' on it?
Thank you!
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH 2/3] x86: Define _PAGE_NUMA with unused physical address bits PMD and PTE levels
Quoted 32 lines · Konrad Rzeszutek Wilk
Quoted 31 lines · Mel Gorman
Quoted 30 lines · Konrad Rzeszutek Wilk
.snip..
Quoted 16 lines
Quoted 16 lines
Quoted 1 line
Quoted 1 line
David Vrabel has a patchset which I presumed would be pulled through
the
Quoted 3 lines
Quoted 3 lines
Xen tree this merge window:
[PATCHv5 0/8] x86/xen: fixes for mapping high MMIO regions (and
remove
Quoted 6 lines
Quoted 4 lines
_PAGE_IOMAP)That frees up this bit.
Thanks, I was not aware of that patch. Based on it, I intend to
force
Quoted 1 line
automatic NUMA balancing to depend on !XEN and see what the reaction
is. If
Quoted 1 line
support for Xen is really required then it potentially be re-enabled
Quoted 8 lines
Quoted 8 lines
if/when
Quoted 1 line
that series is merged assuming they do not need the bit for something
else.
Quoted 1 line
Amazon EC2 does have large memory instance types with NUMA exposed to the guest (e.g. c3.8xlarge, i2.8xlarge, etc), so it'd be preferable (to me anyway) if we didn't require !XEN.
What about the patch that David Vrabel posted:
Quoted 9 lines
Quoted 5 lines
Quoted 1 line
Has anybody taken it for a spin?
Alternatively "[PATCH 4/5] mm: use paravirt friendly ops for NUMA hinting ptes" which modifies the NUMA pte helpers instead of the main set/clear ones.
Ah nice! Looking forward to it being posted as non-RFC and could you also please CC '[email protected]' on it?
Yes I will. Unless the x86 maintainers push for it on the grounds that it is a functional fix for xen, I'm going to wait until after the merge window to resend it. That'd give it some chance of being tested in -next before hitting mainline.
Signature · 8 lines
Mel Gorman SUSE Labs -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>