Merge tag 'execve-v6.1-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/kees...
[platform/kernel/linux-starfive.git] / mm / huge_memory.c
index 1cc4a5f..03fc7e5 100644 (file)
@@ -2455,7 +2455,16 @@ static void __split_huge_page_tail(struct page *head, int tail,
                        page_tail);
        page_tail->mapping = head->mapping;
        page_tail->index = head->index + tail;
-       page_tail->private = 0;
+
+       /*
+        * page->private should not be set in tail pages with the exception
+        * of swap cache pages that store the swp_entry_t in tail pages.
+        * Fix up and warn once if private is unexpectedly set.
+        */
+       if (!folio_test_swapcache(page_folio(head))) {
+               VM_WARN_ON_ONCE_PAGE(page_tail->private != 0, head);
+               page_tail->private = 0;
+       }
 
        /* Page flags must be visible before we make the page non-compound. */
        smp_wmb();