Commit 8291eaaf authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'mm-stable-2022-05-27' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

Pull more MM updates from Andrew Morton:

 - Two follow-on fixes for the post-5.19 series "Use pageblock_order for
   cma and alloc_contig_range alignment", from Zi Yan.

 - A series of z3fold cleanups and fixes from Miaohe Lin.

 - Some memcg selftests work from Michal Koutný <mkoutny@suse.com>

 - Some swap fixes and cleanups from Miaohe Lin

 - Several individual minor fixups

* tag 'mm-stable-2022-05-27' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm: (25 commits)
  mm/shmem.c: suppress shift warning
  mm: Kconfig: reorganize misplaced mm options
  mm: kasan: fix input of vmalloc_to_page()
  mm: fix is_pinnable_page against a cma page
  mm: filter out swapin error entry in shmem mapping
  mm/shmem: fix infinite loop when swap in shmem error at swapoff time
  mm/madvise: free hwpoison and swapin error entry in madvise_free_pte_range
  mm/swapfile: fix lost swap bits in unuse_pte()
  mm/swapfile: unuse_pte can map random data if swap read fails
  selftests: memcg: factor out common parts of memory.{low,min} tests
  selftests: memcg: remove protection from top level memcg
  selftests: memcg: adjust expected reclaim values of protected cgroups
  selftests: memcg: expect no low events in unprotected sibling
  selftests: memcg: fix compilation
  mm/z3fold: fix z3fold_page_migrate races with z3fold_map
  mm/z3fold: fix z3fold_reclaim_page races with z3fold_free
  mm/z3fold: always clear PAGE_CLAIMED under z3fold page lock
  mm/z3fold: put z3fold page back into unbuddied list when reclaim or migration fails
  revert "mm/z3fold.c: allow __GFP_HIGHMEM in z3fold_alloc"
  mm/z3fold: throw warning on failure of trylock_page in z3fold_alloc
  ...
parents 77fb622d fa020a2b
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -5062,6 +5062,7 @@ L: linux-mm@kvack.org
S:	Maintained
F:	mm/memcontrol.c
F:	mm/swap_cgroup.c
F:	tools/testing/selftests/cgroup/memcg_protection.m
F:	tools/testing/selftests/cgroup/test_kmem.c
F:	tools/testing/selftests/cgroup/test_memcontrol.c
+7 −2
Original line number Diff line number Diff line
@@ -1594,8 +1594,13 @@ static inline bool page_needs_cow_for_dma(struct vm_area_struct *vma,
#ifdef CONFIG_MIGRATION
static inline bool is_pinnable_page(struct page *page)
{
	return !(is_zone_movable_page(page) || is_migrate_cma_page(page)) ||
		is_zero_pfn(page_to_pfn(page));
#ifdef CONFIG_CMA
	int mt = get_pageblock_migratetype(page);

	if (mt == MIGRATE_CMA || mt == MIGRATE_ISOLATE)
		return false;
#endif
	return !(is_zone_movable_page(page) || is_zero_pfn(page_to_pfn(page)));
}
#else
static inline bool is_pinnable_page(struct page *page)
+6 −1
Original line number Diff line number Diff line
@@ -55,6 +55,10 @@ static inline int current_is_kswapd(void)
 * actions on faults.
 */

#define SWP_SWAPIN_ERROR_NUM 1
#define SWP_SWAPIN_ERROR     (MAX_SWAPFILES + SWP_HWPOISON_NUM + \
			     SWP_MIGRATION_NUM + SWP_DEVICE_NUM + \
			     SWP_PTE_MARKER_NUM)
/*
 * PTE markers are used to persist information onto PTEs that are mapped with
 * file-backed memories.  As its name "PTE" hints, it should only be applied to
@@ -120,7 +124,8 @@ static inline int current_is_kswapd(void)

#define MAX_SWAPFILES \
	((1 << MAX_SWAPFILES_SHIFT) - SWP_DEVICE_NUM - \
	SWP_MIGRATION_NUM - SWP_HWPOISON_NUM - SWP_PTE_MARKER_NUM)
	SWP_MIGRATION_NUM - SWP_HWPOISON_NUM - \
	SWP_PTE_MARKER_NUM - SWP_SWAPIN_ERROR_NUM)

/*
 * Magic header for a swap area. The first part of the union is
+10 −0
Original line number Diff line number Diff line
@@ -108,6 +108,16 @@ static inline void *swp_to_radix_entry(swp_entry_t entry)
	return xa_mk_value(entry.val);
}

static inline swp_entry_t make_swapin_error_entry(struct page *page)
{
	return swp_entry(SWP_SWAPIN_ERROR, page_to_pfn(page));
}

static inline int is_swapin_error_entry(swp_entry_t entry)
{
	return swp_type(entry) == SWP_SWAPIN_ERROR;
}

#if IS_ENABLED(CONFIG_DEVICE_PRIVATE)
static inline swp_entry_t make_readable_device_private_entry(pgoff_t offset)
{
+0 −54
Original line number Diff line number Diff line
@@ -1842,60 +1842,6 @@ config DEBUG_PERF_USE_VMALLOC

endmenu

config VM_EVENT_COUNTERS
	default y
	bool "Enable VM event counters for /proc/vmstat" if EXPERT
	help
	  VM event counters are needed for event counts to be shown.
	  This option allows the disabling of the VM event counters
	  on EXPERT systems.  /proc/vmstat will only show page counts
	  if VM event counters are disabled.

config SLUB_DEBUG
	default y
	bool "Enable SLUB debugging support" if EXPERT
	depends on SLUB && SYSFS
	select STACKDEPOT if STACKTRACE_SUPPORT
	help
	  SLUB has extensive debug support features. Disabling these can
	  result in significant savings in code size. This also disables
	  SLUB sysfs support. /sys/slab will not exist and there will be
	  no support for cache validation etc.

config COMPAT_BRK
	bool "Disable heap randomization"
	default y
	help
	  Randomizing heap placement makes heap exploits harder, but it
	  also breaks ancient binaries (including anything libc5 based).
	  This option changes the bootup default to heap randomization
	  disabled, and can be overridden at runtime by setting
	  /proc/sys/kernel/randomize_va_space to 2.

	  On non-ancient distros (post-2000 ones) N is usually a safe choice.

config MMAP_ALLOW_UNINITIALIZED
	bool "Allow mmapped anonymous memory to be uninitialized"
	depends on EXPERT && !MMU
	default n
	help
	  Normally, and according to the Linux spec, anonymous memory obtained
	  from mmap() has its contents cleared before it is passed to
	  userspace.  Enabling this config option allows you to request that
	  mmap() skip that if it is given an MAP_UNINITIALIZED flag, thus
	  providing a huge performance boost.  If this option is not enabled,
	  then the flag will be ignored.

	  This is taken advantage of by uClibc's malloc(), and also by
	  ELF-FDPIC binfmt's brk and stack allocator.

	  Because of the obvious security issues, this option should only be
	  enabled on embedded devices where you control what is run in
	  userspace.  Since that isn't generally a problem on no-MMU systems,
	  it is normally safe to say Y here.

	  See Documentation/admin-guide/mm/nommu-mmap.rst for more information.

config SYSTEM_DATA_VERIFICATION
	def_bool n
	select SYSTEM_TRUSTED_KEYRING
Loading