A few simplifications for softdirty memory tracker code
Subsystems (2)
cover A few simplifications for softdirty memory tracker code
Hi, here are a few simplifications for softdirty memory tracker code, in particular we dropped off x86-32 support since it seems noone needed it here on x86 platform.
As Andrew requested I've rebased patches on top of current linux-next repo.
Also at first I wanted to rip off _PAGE_PSE bit which we use in swap ptes to track dirty status of swapped pages and reuse _PAGE_BIT_SOFT_DIRTY instead. It's still possible but requires additional shrinking of maximal swap size and I don't know if it's acceptible or not. Currently we have
#ifdef CONFIG_NUMA_BALANCING
/* Automatic NUMA balancing needs to be distinguishable from swap entries */ #define SWP_OFFSET_SHIFT (_PAGE_BIT_PROTNONE + 2)
#else
#define SWP_OFFSET_SHIFT (_PAGE_BIT_PROTNONE + 1)
#endif
If I reuse _PAGE_BIT_SOFT_DIRTY I'll have to increase this shift up to bit 11, which, again, I think is too much, right?
Comments are highly appreciated!
Cyrill
--
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/2 mm: pgtable -- Drop unneeded preprocessor ifdef
_PAGE_BIT_FILE (bit 6) is always less than _PAGE_BIT_PROTNONE (bit 8), so drop redundant #ifdef.
--- arch/x86/include/asm/pgtable-2level.h | 10 ---------- arch/x86/include/asm/pgtable_64.h | 8 -------- 2 files changed, 18 deletions(-)
arch/x86/include/asm/pgtable-2level.h +0 -10
@@ -115,13 +115,8 @@ static __always_inline pte_t pgoff_to_pt*/ #define PTE_FILE_MAX_BITS 29#define PTE_FILE_SHIFT1 (_PAGE_BIT_PRESENT + 1) -#if _PAGE_BIT_FILE < _PAGE_BIT_PROTNONE#define PTE_FILE_SHIFT2 (_PAGE_BIT_FILE + 1)#define PTE_FILE_SHIFT3 (_PAGE_BIT_PROTNONE + 1) -#else -#define PTE_FILE_SHIFT2 (_PAGE_BIT_PROTNONE + 1) -#define PTE_FILE_SHIFT3 (_PAGE_BIT_FILE + 1) -#endif #define PTE_FILE_BITS1 (PTE_FILE_SHIFT2 - PTE_FILE_SHIFT1 - 1)#define PTE_FILE_BITS2 (PTE_FILE_SHIFT3 - PTE_FILE_SHIFT2 - 1)
@@ -153,13 +148,8 @@ static __always_inline pte_t pgoff_to_pt#endif /* CONFIG_MEM_SOFT_DIRTY */ /* Encode and de-code a swap entry */ -#if _PAGE_BIT_FILE < _PAGE_BIT_PROTNONE#define SWP_TYPE_BITS (_PAGE_BIT_FILE - _PAGE_BIT_PRESENT - 1)#define SWP_OFFSET_SHIFT (_PAGE_BIT_PROTNONE + 1) -#else -#define SWP_TYPE_BITS (_PAGE_BIT_PROTNONE - _PAGE_BIT_PRESENT - 1) -#define SWP_OFFSET_SHIFT (_PAGE_BIT_FILE + 1) -#endif #define MAX_SWAPFILES_CHECK () BUILD_BUG_ON(MAX_SWAPFILES_SHIFT > SWP_TYPE_BITS)
arch/x86/include/asm/pgtable_64.h +0 -8
@@ -143,7 +143,6 @@ static inline int pgd_large(pgd_t pgd) {#define pte_unmap (pte) ((void)(pte))/* NOP */ /* Encode and de-code a swap entry */ -#if _PAGE_BIT_FILE < _PAGE_BIT_PROTNONE#define SWP_TYPE_BITS (_PAGE_BIT_FILE - _PAGE_BIT_PRESENT - 1)#ifdef CONFIG_NUMA_BALANCING /* Automatic NUMA balancing needs to be distinguishable from swap entries */
@@ -151,13 +150,6 @@ static inline int pgd_large(pgd_t pgd) {#else #define SWP_OFFSET_SHIFT (_PAGE_BIT_PROTNONE + 1)#endif -#else -#ifdef CONFIG_NUMA_BALANCING -#error Incompatible format for automatic NUMA balancing -#endif -#define SWP_TYPE_BITS (_PAGE_BIT_PROTNONE - _PAGE_BIT_PRESENT - 1) -#define SWP_OFFSET_SHIFT (_PAGE_BIT_FILE + 1) -#endif #define MAX_SWAPFILES_CHECK () BUILD_BUG_ON(MAX_SWAPFILES_SHIFT > SWP_TYPE_BITS)
--
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/2 mm: pgtable -- Require X86_64 for soft-dirty tracker
In reply to Cyrill GorcunovTracking dirty status on 2 level pages requires very ugly macros and taking into account how old the machines who can operate without PAE mode only are, lets drop soft dirty tracker from them for code simplicity (note I can't drop all the macros from 2 level pages by now since _PAGE_BIT_PROTNONE and _PAGE_BIT_FILE are still used even without tracker).
Linus proposed to completely rip off softdirty support on x86-32 (even with PAE) and since for CRIU we're not planning to support native x86-32 mode, lets do that.
(Softdirty tracker is relatively new feature which mostly used
by CRIU so I don't expect if such API change would cause problems on userspace).
--- arch/x86/Kconfig | 2 - arch/x86/include/asm/pgtable-2level.h | 49 ---------------------------------- 2 files changed, 1 insertion(+), 50 deletions(-)
arch/x86/Kconfig +1 -1
@@ -106,7 +106,7 @@ config X86 select HAVE_ARCH_SECCOMP_FILTER select BUILDTIME_EXTABLE_SORT select GENERIC_CMOS_UPDATE - select HAVE_ARCH_SOFT_DIRTY + select HAVE_ARCH_SOFT_DIRTY if X86_64 select CLOCKSOURCE_WATCHDOG select GENERIC_CLOCKEVENTS select ARCH_CLOCKSOURCE_DATA
arch/x86/include/asm/pgtable-2level.h +0 -49
61 lines not on this page · raw message
--
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>
Andrew Morton
maintainerRe: [patch 2/2] mm: pgtable -- Require X86_64 for soft-dirty tracker
Quoted 7 lines · On Fri, 25 Apr 2014 12:10:32 +0400 Cyrill Gorcunov <[email protected]> wrote:
Tracking dirty status on 2 level pages requires very ugly macros and taking into account how old the machines who can operate without PAE mode only are, lets drop soft dirty tracker from them for code simplicity (note I can't drop all the macros from 2 level pages by now since
_PAGE_BIT_PROTNONEand_PAGE_BIT_FILEare still used even without tracker).
Quoted 7 lines
Linus proposed to completely rip off softdirty support on x86-32 (even with PAE) and since for CRIU we're not planning to support native x86-32 mode, lets do that.
(Softdirty tracker is relatively new feature which mostly used
by CRIU so I don't expect if such API change would cause problems on userspace).
i386 allnoconfig:
In file included from /usr/src/25/arch/x86/include/asm/pgtable.h:886,
from include/linux/mm.h:51,
from include/linux/suspend.h:8,
from arch/x86/kernel/asm-offsets.c:12:include/asm-generic/pgtable.h:414: error: redefinition of 'pte_soft_dirty' /usr/src/25/arch/x86/include/asm/pgtable.h:300: note: previous definition of 'pte_soft_dirty' was here include/asm-generic/pgtable.h:419: error: redefinition of 'pmd_soft_dirty' /usr/src/25/arch/x86/include/asm/pgtable.h:305: note: previous definition of 'pmd_soft_dirty' was here include/asm-generic/pgtable.h:424: error: redefinition of 'pte_mksoft_dirty' /usr/src/25/arch/x86/include/asm/pgtable.h:310: note: previous definition of 'pte_mksoft_dirty' was here include/asm-generic/pgtable.h:429: error: redefinition of 'pmd_mksoft_dirty' /usr/src/25/arch/x86/include/asm/pgtable.h:315: note: previous definition of 'pmd_mksoft_dirty' was here include/asm-generic/pgtable.h:434: error: redefinition of 'pte_swp_mksoft_dirty' /usr/src/25/arch/x86/include/asm/pgtable.h:868: note: previous definition of 'pte_swp_mksoft_dirty' was here include/asm-generic/pgtable.h:439: error: redefinition of 'pte_swp_soft_dirty' /usr/src/25/arch/x86/include/asm/pgtable.h:874: note: previous definition of 'pte_swp_soft_dirty' was here include/asm-generic/pgtable.h:444: error: redefinition of 'pte_swp_clear_soft_dirty' /usr/src/25/arch/x86/include/asm/pgtable.h:880: note: previous definition of 'pte_swp_clear_soft_dirty' was here include/asm-generic/pgtable.h:449: error: redefinition of 'pte_file_clear_soft_dirty' /usr/src/25/arch/x86/include/asm/pgtable.h:320: note: previous definition of 'pte_file_clear_soft_dirty' was here include/asm-generic/pgtable.h:454: error: redefinition of 'pte_file_mksoft_dirty' /usr/src/25/arch/x86/include/asm/pgtable.h:325: note: previous definition of 'pte_file_mksoft_dirty' was here include/asm-generic/pgtable.h:459: error: redefinition of 'pte_file_soft_dirty' /usr/src/25/arch/x86/include/asm/pgtable.h:330: note: previous definition of 'pte_file_soft_dirty' was here
PATCH 2/2 mm: pgtable -- Require X86_64 for soft-dirty tracker, v2
Quoted 13 lines · Andrew Morton
Quoted 11 lines · On Fri, 25 Apr 2014 12:10:32 +0400 Cyrill Gorcunov <[email protected]> wrote:
Tracking dirty status on 2 level pages requires very ugly macros and taking into account how old the machines who can operate without PAE mode only are, lets drop soft dirty tracker from them for code simplicity (note I can't drop all the macros from 2 level pages by now since
_PAGE_BIT_PROTNONEand_PAGE_BIT_FILEare still used even without tracker).Linus proposed to completely rip off softdirty support on x86-32 (even with PAE) and since for CRIU we're not planning to support native x86-32 mode, lets do that.
Quoted 7 lines
Quoted 3 lines
(Softdirty tracker is relatively new feature which mostly used
by CRIU so I don't expect if such API change would cause problems on userspace).i386 allnoconfig:
In file included from
/usr/src/25/arch/x86/include/asm/pgtable.h:886,
Thanks! Here is an updated version.
---
From: Cyrill Gorcunov <[email protected]>
Subject: [PATCH -next] mm: pgtable -- Require X86_64 for soft-dirty tracker
Tracking dirty status on 2 level pages requires very ugly macros and taking into account how old the machines who can operate without PAE mode only are, lets drop soft dirty tracker from them for code simplicity (note I can't drop all the macros from 2 level pages by now since _PAGE_BIT_PROTNONE and _PAGE_BIT_FILE are still used even without tracker).
Linus proposed to completely rip off softdirty support on x86-32 (even with PAE) and since for CRIU we're not planning to support native x86-32 mode, lets do that.
(Softdirty tracker is relatively new feature which mostly used
by CRIU so I don't expect if such API change would cause problems on userspace).
v2 (by akpm@):
- guard helpers with CONFIG_HAVE_ARCH_SOFT_DIRTY on i386, otherwise it fails to build because we've a generic definitions in asm-generic/pgtable.h
--- arch/x86/Kconfig | 2 - arch/x86/include/asm/pgtable-2level.h | 49 ---------------------------------- arch/x86/include/asm/pgtable.h | 5 +++ 3 files changed, 6 insertions(+), 50 deletions(-)
arch/x86/Kconfig +1 -1
@@ -106,7 +106,7 @@ config X86 select HAVE_ARCH_SECCOMP_FILTER select BUILDTIME_EXTABLE_SORT select GENERIC_CMOS_UPDATE - select HAVE_ARCH_SOFT_DIRTY + select HAVE_ARCH_SOFT_DIRTY if X86_64 select CLOCKSOURCE_WATCHDOG select GENERIC_CLOCKEVENTS select ARCH_CLOCKSOURCE_DATA
arch/x86/include/asm/pgtable-2level.h +0 -49
61 lines not on this page · raw message
arch/x86/include/asm/pgtable.h +5 -0
@@ -297,6 +297,7 @@ static inline pmd_t pmd_mknotpresent(pmdreturn pmd_clear_flags (pmd, _PAGE_PRESENT); } +#ifdef CONFIG_HAVE_ARCH_SOFT_DIRTY static inline int pte_soft_dirty (pte_t pte) {return pte_flags (pte) & _PAGE_SOFT_DIRTY;
@@ -332,6 +333,8 @@ static inline int pte_file_soft_dirty(pt return pte_flags(pte) & _PAGE_SOFT_DIRTY; } +#endif /* CONFIG_HAVE_ARCH_SOFT_DIRTY */ +/* * Mask out unsupported bits in a present pgprot. Non-present pgprots * can use those bits for other purposes, so leave them be.
@@ -865,6 +868,7 @@ static inline void update_mmu_cache_pmd( { } +#ifdef CONFIG_HAVE_ARCH_SOFT_DIRTY static inline pte_t pte_swp_mksoft_dirty (pte_t pte) {VM_BUG_ON (pte_present_nonuma (pte));
@@ -882,6 +886,7 @@ static inline pte_t pte_swp_clear_soft_dVM_BUG_ON (pte_present_nonuma (pte));return pte_clear_flags (pte, _PAGE_SWP_SOFT_DIRTY); } +#endif #include <asm-generic/pgtable.h> #endif /* __ASSEMBLY__ */
--
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/2] mm: pgtable -- Require X86_64 for soft-dirty tracker
In reply to Cyrill GorcunovQuoted 7 lines · Cyrill Gorcunov
Tracking dirty status on 2 level pages requires very ugly macros and taking into account how old the machines who can operate without PAE mode only are, lets drop soft dirty tracker from them for code simplicity (note I can't drop all the macros from 2 level pages by now since
_PAGE_BIT_PROTNONEand_PAGE_BIT_FILEare still used even without tracker).
Quoted 7 lines
Linus proposed to completely rip off softdirty support on x86-32 (even with PAE) and since for CRIU we're not planning to support native x86-32 mode, lets do that.
(Softdirty tracker is relatively new feature which mostly used
by CRIU so I don't expect if such API change would cause problems on userspace).
I have to wonder which one is more likely to actually matter on whatever legacy 32-bit are going to remain. This pretty much comes down to what kind of advanced features are going to matter in deep embedded applications in the future: checkpoint/restart or NUMA. My guess is that it is actually checkpoint/restart...
How much does it actually simplify to leave this feature in for PAE? I could care less about non-PAE... NX has pretty much killed that off cold.
-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/2] mm: pgtable -- Require X86_64 for soft-dirty tracker
Quoted 16 lines · H. Peter Anvin
Quoted 7 lines · Cyrill Gorcunov
Tracking dirty status on 2 level pages requires very ugly macros and taking into account how old the machines who can operate without PAE mode only are, lets drop soft dirty tracker from them for code simplicity (note I can't drop all the macros from 2 level pages by now since
_PAGE_BIT_PROTNONEand_PAGE_BIT_FILEare still used even without tracker).Quoted 7 lines
Linus proposed to completely rip off softdirty support on x86-32 (even with PAE) and since for CRIU we're not planning to support native x86-32 mode, lets do that.
(Softdirty tracker is relatively new feature which mostly used
by CRIU so I don't expect if such API change would cause problems on userspace).
Quoted 8 lines
I have to wonder which one is more likely to actually matter on whatever legacy 32-bit are going to remain. This pretty much comes down to what kind of advanced features are going to matter in deep embedded applications in the future: checkpoint/restart or NUMA. My guess is that it is actually checkpoint/restart...
How much does it actually simplify to leave this feature in for PAE? I could care less about non-PAE... NX has pretty much killed that off cold.
At the current state -- not much I would say. Initially the idea was to drop x86-32 and use page-soft-dirty-bit (ie 11) inside swap entries dropping off page-swap-soft-dirty bit completely, this would simplify all the things but eventually I realized that if I do so the number of maximum swap entries will get more shrinked which is inacceptable I think.
Thus, currently (ie even with this patches) we can work on x86-32+PAE but desided to drop x86-32 completely to simplify things in future.
Peter, deep embedded applications I guess would be working on systems with really small amount of memory installed in a system I suppose and I doubt if they would need c/r?
If we deside to leave x86-32+PAE then don't apply this patch, I will need to update it, (The first patch is safe to apply anyway).
--
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>