mm-commits.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: akpm@linux-foundation.org, linmiaohe@huawei.com,
	linux-mm@kvack.org, mhocko@suse.com, mike.kravetz@oracle.com,
	mm-commits@vger.kernel.org, naoya.horiguchi@nec.com,
	osalvador@suse.de, songmuchun@bytedance.com,
	torvalds@linux-foundation.org, willy@infradead.org
Subject: [patch 07/13] hugetlb: pass head page to remove_hugetlb_page()
Date: Fri, 04 Jun 2021 20:01:27 -0700	[thread overview]
Message-ID: <20210605030127.7uSeM1M5a%akpm@linux-foundation.org> (raw)
In-Reply-To: <20210604200040.d8d0406caf195525620c0f3d@linux-foundation.org>

From: Naoya Horiguchi <naoya.horiguchi@nec.com>
Subject: hugetlb: pass head page to remove_hugetlb_page()

When memory_failure() or soft_offline_page() is called on a tail page of
some hugetlb page, "BUG: unable to handle page fault" error can be
triggered.

remove_hugetlb_page() dereferences page->lru, so it's assumed that the
page points to a head page, but one of the caller,
dissolve_free_huge_page(), provides remove_hugetlb_page() with 'page'
which could be a tail page.  So pass 'head' to it, instead.

Link: https://lkml.kernel.org/r/20210526235257.2769473-1-nao.horiguchi@gmail.com
Fixes: 6eb4e88a6d27 ("hugetlb: create remove_hugetlb_page() to separate functionality")
Signed-off-by: Naoya Horiguchi <naoya.horiguchi@nec.com>
Reviewed-by: Mike Kravetz <mike.kravetz@oracle.com>
Reviewed-by: Muchun Song <songmuchun@bytedance.com>
Acked-by: Michal Hocko <mhocko@suse.com>
Reviewed-by: Oscar Salvador <osalvador@suse.de>
Cc: Miaohe Lin <linmiaohe@huawei.com>
Cc: Matthew Wilcox <willy@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 mm/hugetlb.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/mm/hugetlb.c~hugetlb-pass-head-page-to-remove_hugetlb_page
+++ a/mm/hugetlb.c
@@ -1793,7 +1793,7 @@ retry:
 			SetPageHWPoison(page);
 			ClearPageHWPoison(head);
 		}
-		remove_hugetlb_page(h, page, false);
+		remove_hugetlb_page(h, head, false);
 		h->max_huge_pages--;
 		spin_unlock_irq(&hugetlb_lock);
 		update_and_free_page(h, head);
_

  parent reply	other threads:[~2021-06-05  3:01 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-05  3:00 incoming Andrew Morton
2021-06-05  3:01 ` [patch 01/13] Revert "MIPS: make userspace mapping young by default" Andrew Morton
2021-06-05  3:01 ` [patch 02/13] kfence: use TASK_IDLE when awaiting allocation Andrew Morton
2021-06-05  3:01 ` [patch 03/13] pid: take a reference when initializing `cad_pid` Andrew Morton
2021-06-05  3:01 ` [patch 04/13] mm/debug_vm_pgtable: fix alignment for pmd/pud_advanced_tests() Andrew Morton
2021-06-05  3:01 ` [patch 05/13] mm/page_alloc: fix counting of free pages after take off from buddy Andrew Morton
2021-06-05  3:01 ` [patch 06/13] drivers/base/memory: fix trying offlining memory blocks with memory holes on aarch64 Andrew Morton
2021-06-05  3:01 ` Andrew Morton [this message]
2021-06-05  3:01 ` [patch 08/13] proc: add .gitignore for proc-subset-pid selftest Andrew Morton
2021-06-05  3:01 ` [patch 09/13] mm/kasan/init.c: fix doc warning Andrew Morton
2021-06-05  3:01 ` [patch 10/13] mm, hugetlb: fix simple resv_huge_pages underflow on UFFDIO_COPY Andrew Morton
2021-06-05  3:01 ` [patch 11/13] lib: crc64: fix kernel-doc warning Andrew Morton
2021-06-05  3:01 ` [patch 12/13] ocfs2: fix data corruption by fallocate Andrew Morton
2021-06-05  3:01 ` [patch 13/13] mailmap: use private address for Michel Lespinasse Andrew Morton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210605030127.7uSeM1M5a%akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=linmiaohe@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=mike.kravetz@oracle.com \
    --cc=mm-commits@vger.kernel.org \
    --cc=naoya.horiguchi@nec.com \
    --cc=osalvador@suse.de \
    --cc=songmuchun@bytedance.com \
    --cc=torvalds@linux-foundation.org \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).