[folded-merged] mmthp-recheck-each-page-before-collapsing-file-thp-fix.patch removed from -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled
     Subject: mm/thp: flush file for !is_shmem PageDirty() case in collapse_file()
has been removed from the -mm tree.  Its filename was
     mmthp-recheck-each-page-before-collapsing-file-thp-fix.patch

This patch was dropped because it was folded into mmthp-recheck-each-page-before-collapsing-file-thp.patch

------------------------------------------------------
From: Song Liu <songliubraving@xxxxxx>
Subject: mm/thp: flush file for !is_shmem PageDirty() case in collapse_file()

For non-shmem file THPs, khugepaged only collapses read only .text mapping
(VM_DENYWRITE).  These pages should not be dirty except the case where the
file hasn't been flushed since first write.

Call filemap_flush() in collapse_file() to accelerate the write back in
such cases.

Also add warning if PageDirty() triggered for pages from readahead path.

Link: http://lkml.kernel.org/r/20191030200736.3455046-1-songliubraving@xxxxxx
Signed-off-by: Song Liu <songliubraving@xxxxxx>
Reported-by: syzbot+efb9e48b9fbdc49bb34a@xxxxxxxxxxxxxxxxxxxxxxxxx
Tested-by: syzbot+efb9e48b9fbdc49bb34a@xxxxxxxxxxxxxxxxxxxxxxxxx
Cc: Kirill A. Shutemov <kirill.shutemov@xxxxxxxxxxxxxxx>
Cc: Hugh Dickins <hughd@xxxxxxxxxx>
Cc: William Kucharski <william.kucharski@xxxxxxxxxx>
Cc: Johannes Weiner <hannes@xxxxxxxxxxx>
Cc: Matthew Wilcox <willy@xxxxxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 mm/khugepaged.c |   27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

--- a/mm/khugepaged.c~mmthp-recheck-each-page-before-collapsing-file-thp-fix
+++ a/mm/khugepaged.c
@@ -1601,6 +1601,33 @@ static void collapse_file(struct mm_stru
 					result = SCAN_FAIL;
 					goto xa_unlocked;
 				}
+				if (WARN_ON_ONCE(PageDirty(page))) {
+					/*
+					 * page from readahead should not
+					 * be dirty. Show warning if this
+					 * somehow happens.
+					 */
+					result = SCAN_FAIL;
+					goto out_unlock;
+				}
+			} else if (PageDirty(page)) {
+				/*
+				 * khugepaged only works on read-only fd,
+				 * so this page is dirty because it hasn't
+				 * been flushed since first write. There
+				 * won't be new dirty pages.
+				 *
+				 * Trigger async flush here and hope the
+				 * writeback is done when khugepaged
+				 * revisits this page.
+				 *
+				 * This is a one-off situation. We are not
+				 * forcing writeback in loop.
+				 */
+				xas_unlock_irq(&xas);
+				filemap_flush(mapping);
+				result = SCAN_FAIL;
+				goto xa_unlocked;
 			} else if (trylock_page(page)) {
 				get_page(page);
 				xas_unlock_irq(&xas);
_

Patches currently in -mm which might be from songliubraving@xxxxxx are

mmthp-recheck-each-page-before-collapsing-file-thp.patch
maintainers-update-information-for-memory-management.patch




[Index of Archives]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux