Skip to contentSkip to conversation

mm-khugepaged-use-the-number-of-pages-in-the-folio-to-check-the-reference-count.patch removed from -mm tree

merged mm-stable Andrew Morton 1 participant 1 message Sep 4, 2024

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: mm: khugepaged: use the number of pages in the folio to check the reference count
has been removed from the -mm tree. Its filename was
mm-khugepaged-use-the-number-of-pages-in-the-folio-to-check-the-reference-count.patch

This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: Baolin Wang <[email protected]>
Subject: mm: khugepaged: use the number of pages in the folio to check the reference count
Date: Tue, 20 Aug 2024 17:49:14 +0800

Use the number of pages in the folio to check the reference count as preparation for supporting shmem mTHP collapse.

---

 mm/khugepaged.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
mm/khugepaged.c renamed from mm/khugepaged.c~mm-khugepaged-use-the-number-of-pages-in-the-folio-to-check-the-reference-count +4 -4
@@ -1988,9 +1988,9 @@ static int collapse_file(struct mm_struc
 		VM_BUG_ON_FOLIO(folio != xa_load(xas.xa, index), folio);
 
 		/*
-		 * We control three references to the folio:
+		 * We control 2 + nr_pages references to the folio:
 		 *  - we hold a pin on it;
-		 *  - one reference from page cache;
+		 *  - nr_pages reference from page cache;
 		 *  - one from lru_isolate_folio;
 		 * If those are the only references, then any new usage
 		 * of the folio will have to fetch it from the page
@@ -1998,7 +1998,7 @@ static int collapse_file(struct mm_struc
 		 * truncate, so any new usage will be blocked until we
 		 * unlock folio after collapse/during rollback.
 		 */
-		if (folio_ref_count(folio) != 3) {
+		if (folio_ref_count(folio) != 2 + folio_nr_pages(folio)) {
 			result = SCAN_PAGE_COUNT;
 			xas_unlock_irq(&xas);
 			folio_putback_lru(folio);
@@ -2181,7 +2181,7 @@ immap_locked:
 		folio_clear_active(folio);
 		folio_clear_unevictable(folio);
 		folio_unlock(folio);
-		folio_put_refs(folio, 3);
+		folio_put_refs(folio, 2 + folio_nr_pages(folio));
 	}
 
 	goto out;

_

Patches currently in -mm which might be from [email protected] are