Commit ed3bad2e authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge branch 'akpm' (patches from Andrew)

Merge misc fixes from Andrew Morton:
 "10 patches.

  Subsystems affected by this patch series: MAINTAINERS and mm (shmem,
  pagealloc, tracing, memcg, memory-failure, vmscan, kfence, and
  hugetlb)"

* emailed patches from Andrew Morton <akpm@linux-foundation.org>:
  hugetlb: don't pass page cache pages to restore_reserve_on_error
  kfence: fix is_kfence_address() for addresses below KFENCE_POOL_SIZE
  mm: vmscan: fix missing psi annotation for node_reclaim()
  mm/hwpoison: retry with shake_page() for unhandlable pages
  mm: memcontrol: fix occasional OOMs due to proportional memory.low reclaim
  MAINTAINERS: update ClangBuiltLinux IRC chat
  mmflags.h: add missing __GFP_ZEROTAGS and __GFP_SKIP_KASAN_POISON names
  mm/page_alloc: don't corrupt pcppage_migratetype
  Revert "mm: swap: check if swap backing device is congested or not"
  Revert "mm/shmem: fix shmem_swapin() race with swapoff"
parents 8ba9fbe1 c7b1850d
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -4508,7 +4508,7 @@ L: clang-built-linux@googlegroups.com
S:	Supported
W:	https://clangbuiltlinux.github.io/
B:	https://github.com/ClangBuiltLinux/linux/issues
C:	irc://chat.freenode.net/clangbuiltlinux
C:	irc://irc.libera.chat/clangbuiltlinux
F:	Documentation/kbuild/llvm.rst
F:	include/linux/compiler-clang.h
F:	scripts/clang-tools/
+4 −3
Original line number Diff line number Diff line
@@ -51,10 +51,11 @@ extern atomic_t kfence_allocation_gate;
static __always_inline bool is_kfence_address(const void *addr)
{
	/*
	 * The non-NULL check is required in case the __kfence_pool pointer was
	 * never initialized; keep it in the slow-path after the range-check.
	 * The __kfence_pool != NULL check is required to deal with the case
	 * where __kfence_pool == NULL && addr < KFENCE_POOL_SIZE. Keep it in
	 * the slow-path after the range-check!
	 */
	return unlikely((unsigned long)((char *)addr - __kfence_pool) < KFENCE_POOL_SIZE && addr);
	return unlikely((unsigned long)((char *)addr - __kfence_pool) < KFENCE_POOL_SIZE && __kfence_pool);
}

/**
+15 −14
Original line number Diff line number Diff line
@@ -612,12 +612,15 @@ static inline bool mem_cgroup_disabled(void)
	return !cgroup_subsys_enabled(memory_cgrp_subsys);
}

static inline unsigned long mem_cgroup_protection(struct mem_cgroup *root,
static inline void mem_cgroup_protection(struct mem_cgroup *root,
					 struct mem_cgroup *memcg,
						  bool in_low_reclaim)
					 unsigned long *min,
					 unsigned long *low)
{
	*min = *low = 0;

	if (mem_cgroup_disabled())
		return 0;
		return;

	/*
	 * There is no reclaim protection applied to a targeted reclaim.
@@ -653,13 +656,10 @@ static inline unsigned long mem_cgroup_protection(struct mem_cgroup *root,
	 *
	 */
	if (root == memcg)
		return 0;

	if (in_low_reclaim)
		return READ_ONCE(memcg->memory.emin);
		return;

	return max(READ_ONCE(memcg->memory.emin),
		   READ_ONCE(memcg->memory.elow));
	*min = READ_ONCE(memcg->memory.emin);
	*low = READ_ONCE(memcg->memory.elow);
}

void mem_cgroup_calculate_protection(struct mem_cgroup *root,
@@ -1147,11 +1147,12 @@ static inline void memcg_memory_event_mm(struct mm_struct *mm,
{
}

static inline unsigned long mem_cgroup_protection(struct mem_cgroup *root,
static inline void mem_cgroup_protection(struct mem_cgroup *root,
					 struct mem_cgroup *memcg,
						  bool in_low_reclaim)
					 unsigned long *min,
					 unsigned long *low)
{
	return 0;
	*min = *low = 0;
}

static inline void mem_cgroup_calculate_protection(struct mem_cgroup *root,
+3 −1
Original line number Diff line number Diff line
@@ -48,7 +48,9 @@
	{(unsigned long)__GFP_WRITE,		"__GFP_WRITE"},		\
	{(unsigned long)__GFP_RECLAIM,		"__GFP_RECLAIM"},	\
	{(unsigned long)__GFP_DIRECT_RECLAIM,	"__GFP_DIRECT_RECLAIM"},\
	{(unsigned long)__GFP_KSWAPD_RECLAIM,	"__GFP_KSWAPD_RECLAIM"}\
	{(unsigned long)__GFP_KSWAPD_RECLAIM,	"__GFP_KSWAPD_RECLAIM"},\
	{(unsigned long)__GFP_ZEROTAGS,		"__GFP_ZEROTAGS"},	\
	{(unsigned long)__GFP_SKIP_KASAN_POISON,"__GFP_SKIP_KASAN_POISON"}\

#define show_gfp_flags(flags)						\
	(flags) ? __print_flags(flags, "|",				\
+14 −5
Original line number Diff line number Diff line
@@ -2476,7 +2476,7 @@ void restore_reserve_on_error(struct hstate *h, struct vm_area_struct *vma,
		if (!rc) {
			/*
			 * This indicates there is an entry in the reserve map
			 * added by alloc_huge_page.  We know it was added
			 * not added by alloc_huge_page.  We know it was added
			 * before the alloc_huge_page call, otherwise
			 * HPageRestoreReserve would be set on the page.
			 * Remove the entry so that a subsequent allocation
@@ -4660,6 +4660,8 @@ static vm_fault_t hugetlb_cow(struct mm_struct *mm, struct vm_area_struct *vma,
	spin_unlock(ptl);
	mmu_notifier_invalidate_range_end(&range);
out_release_all:
	/* No restore in case of successful pagetable update (Break COW) */
	if (new_page != old_page)
		restore_reserve_on_error(h, vma, haddr, new_page);
	put_page(new_page);
out_release_old:
@@ -4776,7 +4778,7 @@ static vm_fault_t hugetlb_no_page(struct mm_struct *mm,
	pte_t new_pte;
	spinlock_t *ptl;
	unsigned long haddr = address & huge_page_mask(h);
	bool new_page = false;
	bool new_page, new_pagecache_page = false;

	/*
	 * Currently, we are forced to kill the process in the event the
@@ -4799,6 +4801,7 @@ static vm_fault_t hugetlb_no_page(struct mm_struct *mm,
		goto out;

retry:
	new_page = false;
	page = find_lock_page(mapping, idx);
	if (!page) {
		/* Check for page in userfault range */
@@ -4842,6 +4845,7 @@ static vm_fault_t hugetlb_no_page(struct mm_struct *mm,
					goto retry;
				goto out;
			}
			new_pagecache_page = true;
		} else {
			lock_page(page);
			if (unlikely(anon_vma_prepare(vma))) {
@@ -4926,6 +4930,8 @@ static vm_fault_t hugetlb_no_page(struct mm_struct *mm,
	spin_unlock(ptl);
backout_unlocked:
	unlock_page(page);
	/* restore reserve for newly allocated pages not in page cache */
	if (new_page && !new_pagecache_page)
		restore_reserve_on_error(h, vma, haddr, page);
	put_page(page);
	goto out;
@@ -5135,6 +5141,7 @@ int hugetlb_mcopy_atomic_pte(struct mm_struct *dst_mm,
	int ret = -ENOMEM;
	struct page *page;
	int writable;
	bool new_pagecache_page = false;

	if (is_continue) {
		ret = -EFAULT;
@@ -5228,6 +5235,7 @@ int hugetlb_mcopy_atomic_pte(struct mm_struct *dst_mm,
		ret = huge_add_to_page_cache(page, mapping, idx);
		if (ret)
			goto out_release_nounlock;
		new_pagecache_page = true;
	}

	ptl = huge_pte_lockptr(h, dst_mm, dst_pte);
@@ -5291,6 +5299,7 @@ int hugetlb_mcopy_atomic_pte(struct mm_struct *dst_mm,
	if (vm_shared || is_continue)
		unlock_page(page);
out_release_nounlock:
	if (!new_pagecache_page)
		restore_reserve_on_error(h, dst_vma, dst_addr, page);
	put_page(page);
	goto out;
Loading