incoming
Subsystems (17)
Andrew Morton
maintainerThe post-linux-next material.
7 patches, based on debe436e77c72fcee804fb867f275e6d31aa999c.
Subsystems affected by this patch series:
mm/debug
mm/slab-generic
mm/migration
mm/memcg
mm/kasan
Subsystem: mm/debug
Yixuan Cao <[email protected]>:
mm/page_owner.c: modify the type of argument "order" in some functions
Subsystem: mm/slab-generic
Ingo Molnar <[email protected]>:
mm: allow only SLUB on PREEMPT_RT
Subsystem: mm/migration
Baolin Wang <[email protected]>:
mm: migrate: simplify the file-backed pages validation when migrating its mapping
Alistair Popple <[email protected]>:
mm/migrate.c: remove MIGRATE_PFN_LOCKED
Subsystem: mm/memcg
Christoph Hellwig <[email protected]>:
Patch series "unexport memcg locking helpers":
mm: unexport folio_memcg_{,un}lock
mm: unexport {,un}lock_page_memcg
Subsystem: mm/kasan
Kuan-Ying Lee <[email protected]>:
kasan: add kasan mode messages when kasan init
Documentation/vm/hmm.rst | 2 arch/arm64/mm/kasan_init.c | 2 arch/powerpc/kvm/book3s_hv_uvmem.c | 4 drivers/gpu/drm/amd/amdkfd/kfd_migrate.c | 2 drivers/gpu/drm/nouveau/nouveau_dmem.c | 4 include/linux/migrate.h | 1 include/linux/page_owner.h | 12 +- init/Kconfig | 2 lib/test_hmm.c | 5 - mm/kasan/hw_tags.c | 14 ++ mm/kasan/sw_tags.c | 2 mm/memcontrol.c | 4 mm/migrate.c | 151 +++++-------------------------- mm/page_owner.c | 6 - 14 files changed, 61 insertions(+), 150 deletions(-)
Andrew Morton
maintainerPATCH 1/7 mm/page_owner.c: modify the type of argument "order" in some functions
From: Yixuan Cao <[email protected]>
Subject: mm/page_owner.c: modify the type of argument "order" in some functions
The type of "order" in struct page_owner is unsigned short. However, it is unsigned int in the following 3 functions:__reset_page_owner__set_page_owner_handle__set_page_owner_handle
The type of "order" in argument list is unsigned int, which is inconsistent.
---
include/linux/page_owner.h | 12 ++++++------ mm/page_owner.c | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-)
include/linux/page_owner.h renamed from include/linux/page_owner.h~mm-page_ownerc-modify-the-type-of-argument-order-in-some-functions +6 -6
@@ -8,9 +8,9 @@extern struct static_key_false page_owner_inited;extern struct page_ext_operations page_owner_ops; -extern void __reset_page_owner (struct page *page,unsigned int order); +extern void __reset_page_owner (struct page *page,unsigned short order);extern void __set_page_owner (struct page *page, -unsigned int order,gfp_t gfp_mask); +unsigned short order,gfp_t gfp_mask);extern void __split_page_owner (struct page *page,unsigned int nr);extern void __folio_copy_owner (struct folio *newfolio,struct folio *old);extern void __set_page_owner_migrate_reason (struct page *page,int reason);
@@ -18,14 +18,14 @@ extern void __dump_page_owner(const struextern void pagetypeinfo_showmixedcount_print (struct seq_file *m,pg_data_t *pgdat,struct zone *zone); -static inline void reset_page_owner (struct page *page,unsigned int order) +static inline void reset_page_owner (struct page *page,unsigned short order) {if (static_branch_unlikely (&page_owner_inited))__reset_page_owner (page, order); }static inline void set_page_owner (struct page *page, -unsigned int order,gfp_t gfp_mask) +unsigned short order,gfp_t gfp_mask) {if (static_branch_unlikely (&page_owner_inited))__set_page_owner (page, order, gfp_mask);
@@ -52,7 +52,7 @@ static inline void dump_page_owner(const__dump_page_owner (page); }#else -static inline void reset_page_owner (struct page *page,unsigned int order) +static inline void reset_page_owner (struct page *page,unsigned short order) { } static inline void set_page_owner(struct page *page,
@@ -60,7 +60,7 @@ static inline void set_page_owner(struct { }static inline void split_page_owner (struct page *page, -unsigned int order) +unsigned short order) { }static inline void folio_copy_owner (struct folio *newfolio,struct folio *folio)
mm/page_owner.c renamed from mm/page_owner.c~mm-page_ownerc-modify-the-type-of-argument-order-in-some-functions +3 -3
@@ -125,7 +125,7 @@ static noinline depot_stack_handle_t savreturn handle; } -void __reset_page_owner (struct page *page,unsigned int order) +void __reset_page_owner (struct page *page,unsigned short order) {int i;struct page_ext *page_ext;
@@ -149,7 +149,7 @@ void __reset_page_owner(struct page *pagstatic inline void __set_page_owner_handle (struct page_ext *page_ext,depot_stack_handle_t handle, -unsigned int order,gfp_t gfp_mask) +unsigned short order,gfp_t gfp_mask) {struct page_owner *page_owner;int i;
@@ -169,7 +169,7 @@ static inline void __set_page_owner_hand } } -noinline void __set_page_owner(struct page *page, unsigned int order, +noinline void __set_page_owner(struct page *page, unsigned short order,gfp_t gfp_mask) {struct page_ext *page_ext =lookup_page_ext (page);
_
Andrew Morton
maintainerPATCH 2/7 mm: allow only SLUB on PREEMPT_RT
In reply to Andrew MortonFrom: Ingo Molnar <[email protected]>
Subject: mm: allow only SLUB on PREEMPT_RT
Memory allocators may disable interrupts or preemption as part of the allocation and freeing process. For PREEMPT_RT it is important that these sections remain deterministic and short and therefore don't depend on the size of the memory to allocate/ free or the inner state of the algorithm.
Until v3.12-RT the SLAB allocator was an option but involved several changes to meet all the requirements. The SLUB design fits better with PREEMPT_RT model and so the SLAB patches were dropped in the 3.12-RT patchset. Comparing the two allocator, SLUB outperformed SLAB in both throughput (time needed to allocate and free memory) and the maximal latency of the system measured with cyclictest during hackbench.
SLOB was never evaluated since it was unlikely that it preforms better than SLAB. During a quick test, the kernel crashed with SLOB enabled during boot.
Disable SLAB and SLOB on PREEMPT_RT.
---
init/Kconfig | 2 ++ 1 file changed, 2 insertions(+)
init/Kconfig renamed from init/Kconfig~mm-allow-only-slub-on-preempt_rt +2 -0
@@ -1896,6 +1896,7 @@ choice config SLAB bool "SLAB" + depends on !PREEMPT_RT select HAVE_HARDENED_USERCOPY_ALLOCATOR help The regular slab allocator that is established and known to work
@@ -1916,6 +1917,7 @@ config SLUB config SLOB depends on EXPERT bool "SLOB (Simple Allocator)" + depends on !PREEMPT_RT help SLOB replaces the stock allocator with a drastically simpler allocator. SLOB is generally more space efficient but
_
Andrew Morton
maintainerPATCH 3/7 mm: migrate: simplify the file-backed pages validation when migrating its mapping
In reply to Andrew MortonFrom: Baolin Wang <[email protected]>
Subject: mm: migrate: simplify the file-backed pages validation when migrating its mapping
There is no need to validate the file-backed page's refcount before trying to freeze the page's expected refcount, instead we can rely on the folio_ref_freeze() to validate if the page has the expected refcount before migrating its mapping.
Moreover we are always under the page lock when migrating the page mapping, which means nowhere else can remove it from the page cache, so we can remove the xas_load() validation under the i_pages lock.
---
mm/migrate.c | 6 ------ 1 file changed, 6 deletions(-)
mm/migrate.c renamed from mm/migrate.c~mm-migrate-simplify-the-file-backed-pages-validation-when-migrating-its-mapping +0 -6
@@ -404,12 +404,6 @@ int folio_migrate_mapping(struct address newzone =folio_zone (newfolio);xas_lock_irq (&xas); -if (folio_ref_count (folio) != expected_count || -xas_load (&xas) != folio) { -xas_unlock_irq (&xas); -return -EAGAIN ; - } -if (!folio_ref_freeze (folio, expected_count)) {xas_unlock_irq (&xas);return -EAGAIN ;
_
Andrew Morton
maintainerPATCH 4/7 mm/migrate.c: remove MIGRATE_PFN_LOCKED
In reply to Andrew MortonFrom: Alistair Popple <[email protected]>
Subject: mm/migrate.c: remove MIGRATE_PFN_LOCKED
MIGRATE_PFN_LOCKED is used to indicate to migrate_vma_prepare() that a source page was already locked during migrate_vma_collect(). If it wasn't then the a second attempt is made to lock the page. However if the first attempt failed it's unlikely a second attempt will succeed, and the retry adds complexity. So clean this up by removing the retry and MIGRATE_PFN_LOCKED flag.
Destination pages are also meant to have the MIGRATE_PFN_LOCKED flag set, but nothing actually checks that.
---
Documentation/vm/hmm.rst | 2 arch/powerpc/kvm/book3s_hv_uvmem.c | 4 drivers/gpu/drm/amd/amdkfd/kfd_migrate.c | 2 drivers/gpu/drm/nouveau/nouveau_dmem.c | 4 include/linux/migrate.h | 1 lib/test_hmm.c | 5 mm/migrate.c | 145 ++++----------------- 7 files changed, 35 insertions(+), 128 deletions(-)
arch/powerpc/kvm/book3s_hv_uvmem.c renamed from arch/powerpc/kvm/book3s_hv_uvmem.c~mm-migratec-remove-migrate_pfn_locked +2 -2
@@ -560,7 +560,7 @@ static int __kvmppc_svm_page_out(struct gpa, 0, page_shift);if (ret ==U_SUCCESS ) - *mig.dst =migrate_pfn (pfn) |MIGRATE_PFN_LOCKED ; + *mig.dst =migrate_pfn (pfn);else {unlock_page (dpage);__free_page (dpage);
@@ -774,7 +774,7 @@ static int kvmppc_svm_page_in(struct vm_ } } - *mig.dst =migrate_pfn (page_to_pfn (dpage)) |MIGRATE_PFN_LOCKED ; + *mig.dst =migrate_pfn (page_to_pfn (dpage));migrate_vma_pages (&mig); out_finalize:migrate_vma_finalize (&mig);
Documentation/vm/hmm.rst renamed from Documentation/vm/hmm.rst~mm-migratec-remove-migrate_pfn_locked +1 -1
@@ -360,7 +360,7 @@ between device driver specific code and system memory page, locks the page with ``lock_page()``, and fills in the ``dst`` array entry with:: - dst[i] = migrate_pfn(page_to_pfn(dpage)) | MIGRATE_PFN_LOCKED; + dst[i] = migrate_pfn(page_to_pfn(dpage)); Now that the driver knows that this page is being migrated, it can invalidate device private MMU mappings and copy device private memory
drivers/gpu/drm/amd/amdkfd/kfd_migrate.c renamed from drivers/gpu/drm/amd/amdkfd/kfd_migrate.c~mm-migratec-remove-migrate_pfn_locked +0 -2
@@ -317,7 +317,6 @@ svm_migrate_copy_to_vram(struct amdgpu_d migrate->dst[i] =svm_migrate_addr_to_pfn (adev, dst[i]);svm_migrate_get_vram_page (prange, migrate->dst[i]); migrate->dst[i] =migrate_pfn (migrate->dst[i]); - migrate->dst[i] |=MIGRATE_PFN_LOCKED ; src[i] =dma_map_page (dev, spage,0 ,PAGE_SIZE ,DMA_TO_DEVICE ); r =dma_mapping_error (dev, src[i]);
@@ -610,7 +609,6 @@ svm_migrate_copy_to_ram(struct amdgpu_de dst[i] >> PAGE_SHIFT, page_to_pfn(dpage)); migrate->dst[i] =migrate_pfn (page_to_pfn (dpage)); - migrate->dst[i] |=MIGRATE_PFN_LOCKED ; j++; }
drivers/gpu/drm/nouveau/nouveau_dmem.c renamed from drivers/gpu/drm/nouveau/nouveau_dmem.c~mm-migratec-remove-migrate_pfn_locked +2 -2
@@ -166,7 +166,7 @@ static vm_fault_t nouveau_dmem_fault_cop goto error_dma_unmap;mutex_unlock (&svmm->mutex); - args->dst[0 ] =migrate_pfn (page_to_pfn (dpage)) |MIGRATE_PFN_LOCKED ; + args->dst[0 ] =migrate_pfn (page_to_pfn (dpage));return 0 ; error_dma_unmap:
@@ -602,7 +602,7 @@ static unsigned long nouveau_dmem_migrat ((paddr >>PAGE_SHIFT ) <<NVIF_VMM_PFNMAP_V0_ADDR_SHIFT );if (src &MIGRATE_PFN_WRITE ) *pfn |=NVIF_VMM_PFNMAP_V0_W ; -return migrate_pfn (page_to_pfn (dpage)) |MIGRATE_PFN_LOCKED ; +return migrate_pfn (page_to_pfn (dpage)); out_dma_unmap:dma_unmap_page (dev, *dma_addr,PAGE_SIZE ,DMA_BIDIRECTIONAL );
include/linux/migrate.h renamed from include/linux/migrate.h~mm-migratec-remove-migrate_pfn_locked +0 -1
@@ -110,7 +110,6 @@ static inline int migrate_misplaced_page*/ #define MIGRATE_PFN_VALID (1UL << 0)#define MIGRATE_PFN_MIGRATE (1UL << 1) -#define MIGRATE_PFN_LOCKED (1UL << 2)#define MIGRATE_PFN_WRITE (1UL << 3)#define MIGRATE_PFN_SHIFT 6
lib/test_hmm.c renamed from lib/test_hmm.c~mm-migratec-remove-migrate_pfn_locked +2 -3
@@ -613,8 +613,7 @@ static void dmirror_migrate_alloc_and_co*/ rpage->zone_device_data = dmirror; - *dst =migrate_pfn (page_to_pfn (dpage)) | -MIGRATE_PFN_LOCKED ; + *dst =migrate_pfn (page_to_pfn (dpage));if ((*src &MIGRATE_PFN_WRITE ) || (!spage && args->vma->vm_flags &VM_WRITE )) *dst |=MIGRATE_PFN_WRITE ;
@@ -1137,7 +1136,7 @@ static vm_fault_t dmirror_devmem_fault_alock_page (dpage);xa_erase (&dmirror->pt, addr >>PAGE_SHIFT );copy_highpage (dpage, spage); - *dst =migrate_pfn (page_to_pfn (dpage)) |MIGRATE_PFN_LOCKED ; + *dst =migrate_pfn (page_to_pfn (dpage));if (*src &MIGRATE_PFN_WRITE ) *dst |=MIGRATE_PFN_WRITE ; }
mm/migrate.c renamed from mm/migrate.c~mm-migratec-remove-migrate_pfn_locked +28 -117
219 lines not on this page · raw message
_
Andrew Morton
maintainerPATCH 5/7 mm: unexport folio_memcg_{,un}lock
In reply to Andrew MortonFrom: Christoph Hellwig <[email protected]>
Subject: mm: unexport folio_memcg_{,un}lock
Patch series "unexport memcg locking helpers".
Neither the old page-based nor the new folio-based memcg locking helpers are used in modular code at all, so drop the exports.
This patch (of 2):
folio_memcg_{,un}lock are only used in built-in core mm code.
---
mm/memcontrol.c | 2 -- 1 file changed, 2 deletions(-)
mm/memcontrol.c renamed from mm/memcontrol.c~mm-unexport-folio_memcg_unlock +0 -2
@@ -2058,7 +2058,6 @@ again: memcg->move_lock_task = current; memcg->move_lock_flags = flags; } -EXPORT_SYMBOL (folio_memcg_lock);void lock_page_memcg (struct page *page) {
@@ -2092,7 +2091,6 @@ void folio_memcg_unlock(struct folio *fo {__folio_memcg_unlock (folio_memcg (folio)); } -EXPORT_SYMBOL (folio_memcg_unlock);void unlock_page_memcg (struct page *page) {
_
Andrew Morton
maintainerPATCH 6/7 mm: unexport {,un}lock_page_memcg
In reply to Andrew MortonFrom: Christoph Hellwig <[email protected]>
Subject: mm: unexport {,un}lock_page_memcg
These are only used in built-in core mm code.
---
mm/memcontrol.c | 2 -- 1 file changed, 2 deletions(-)
mm/memcontrol.c renamed from mm/memcontrol.c~mm-unexport-unlock_page_memcg +0 -2
@@ -2063,7 +2063,6 @@ void lock_page_memcg(struct page *page) {folio_memcg_lock (page_folio (page)); } -EXPORT_SYMBOL (lock_page_memcg);static void __folio_memcg_unlock (struct mem_cgroup *memcg) {
@@ -2096,7 +2095,6 @@ void unlock_page_memcg(struct page *page {folio_memcg_unlock (page_folio (page)); } -EXPORT_SYMBOL (unlock_page_memcg);struct obj_stock {#ifdef CONFIG_MEMCG_KMEM
_
Andrew Morton
maintainerPATCH 7/7 kasan: add kasan mode messages when kasan init
In reply to Andrew MortonFrom: Kuan-Ying Lee <[email protected]>
Subject: kasan: add kasan mode messages when kasan init
There are multiple kasan modes. It makes sense that we add some messages to know which kasan mode is active when booting up. see [1].
---
arch/arm64/mm/kasan_init.c | 2 +- mm/kasan/hw_tags.c | 14 +++++++++++++- mm/kasan/sw_tags.c | 2 +- 3 files changed, 15 insertions(+), 3 deletions(-)
arch/arm64/mm/kasan_init.c renamed from arch/arm64/mm/kasan_init.c~kasan-add-kasan-mode-messages-when-kasan-init +1 -1
@@ -310,7 +310,7 @@ void __init kasan_init(void)kasan_init_depth ();#if defined(CONFIG_KASAN_GENERIC )/* CONFIG_KASAN_SW_TAGS also requires kasan_init_sw_tags(). */ -pr_info ("KernelAddressSanitizer initialized\n" ); +pr_info ("KernelAddressSanitizer initialized (generic)\n" );#endif }
mm/kasan/hw_tags.c renamed from mm/kasan/hw_tags.c~kasan-add-kasan-mode-messages-when-kasan-init +13 -1
@@ -106,6 +106,16 @@ static int __init early_kasan_flag_stack }early_param ("kasan.stacktrace" , early_kasan_flag_stacktrace); +static inline const char *kasan_mode_info (void ) +{ +if (kasan_mode ==KASAN_MODE_ASYNC ) +return "async" ; +else if (kasan_mode ==KASAN_MODE_ASYMM ) +return "asymm" ; +else +return "sync" ; +} +/* kasan_init_hw_tags_cpu() is called for each CPU. */ void kasan_init_hw_tags_cpu (void ) {
@@ -177,7 +187,9 @@ void __init kasan_init_hw_tags(void)break ; } -pr_info ("KernelAddressSanitizer initialized\n" ); +pr_info ("KernelAddressSanitizer initialized (hw-tags, mode=%s, stacktrace=%s)\n" , +kasan_mode_info (), +kasan_stack_collection_enabled () ?"on" :"off" ); }void kasan_alloc_pages (struct page *page,unsigned int order,gfp_t flags)
mm/kasan/sw_tags.c renamed from mm/kasan/sw_tags.c~kasan-add-kasan-mode-messages-when-kasan-init +1 -1
@@ -42,7 +42,7 @@ void __init kasan_init_sw_tags(void)for_each_possible_cpu (cpu)per_cpu (prng_state, cpu) = (u32 )get_cycles (); -pr_info ("KernelAddressSanitizer initialized\n" ); +pr_info ("KernelAddressSanitizer initialized (sw-tags)\n" ); }/*
_