Patch "mm: Account dirty folios properly during splits" has been added to the 5.19-stable tree

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

 



This is a note to let you know that I've just added the patch titled

    mm: Account dirty folios properly during splits

to the 5.19-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     mm-account-dirty-folios-properly-during-splits.patch
and it can be found in the queue-5.19 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 2440fb7182cde1a88a207a47584146fd8264e4ff
Author: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx>
Date:   Tue Jun 28 20:15:29 2022 -0400

    mm: Account dirty folios properly during splits
    
    [ Upstream commit fb5c2029f8221e904e604938171c4a8ef169aadb ]
    
    If the last folio in a file is split as a result of truncation,
    we simply clear the dirty bits for the pages we're discarding.
    That causes NR_FILE_DIRTY (among other counters) to be thrown off
    and eventually Linux will hang in balance_dirty_pages_ratelimited()
    
    Reported-by: Dave Chinner <dchinner@xxxxxxxxxx>
    Tested-by: Dave Chinner <dchinner@xxxxxxxxxx>
    Tested-by: Darrick J. Wong <djwong@xxxxxxxxxx>
    Fixes: d68eccad3706 ("mm/filemap: Allow large folios to be added to the page cache")
    Signed-off-by: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index 834f288b3769..15965084816d 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -18,6 +18,7 @@
 #include <linux/shrinker.h>
 #include <linux/mm_inline.h>
 #include <linux/swapops.h>
+#include <linux/backing-dev.h>
 #include <linux/dax.h>
 #include <linux/khugepaged.h>
 #include <linux/freezer.h>
@@ -2440,11 +2441,15 @@ static void __split_huge_page(struct page *page, struct list_head *list,
 		__split_huge_page_tail(head, i, lruvec, list);
 		/* Some pages can be beyond EOF: drop them from page cache */
 		if (head[i].index >= end) {
-			ClearPageDirty(head + i);
-			__delete_from_page_cache(head + i, NULL);
+			struct folio *tail = page_folio(head + i);
+
 			if (shmem_mapping(head->mapping))
 				shmem_uncharge(head->mapping->host, 1);
-			put_page(head + i);
+			else if (folio_test_clear_dirty(tail))
+				folio_account_cleaned(tail,
+					inode_to_wb(folio->mapping->host));
+			__filemap_remove_folio(tail, NULL);
+			folio_put(tail);
 		} else if (!PageAnon(page)) {
 			__xa_store(&head->mapping->i_pages, head[i].index,
 					head + i, 0);



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux