Skip to contentSkip to conversation

mm-khugepaged-expand-the-is_refcount_suitable-to-support-file-folios.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: expand the is_refcount_suitable() to support file folios
has been removed from the -mm tree. Its filename was
mm-khugepaged-expand-the-is_refcount_suitable-to-support-file-folios.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: expand the is_refcount_suitable() to support file folios
Date: Tue, 20 Aug 2024 17:49:13 +0800

Patch series "support shmem mTHP collapse", v2.

Shmem already supports mTHP allocation[1], and this patchset adds support for shmem mTHP collapse, as well as adding relevant test cases.

This patch (of 5):

Expand the is_refcount_suitable() to support reference checks for file folios, as preparation for supporting shmem mTHP collapse.

---

 mm/khugepaged.c |   11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
mm/khugepaged.c renamed from mm/khugepaged.c~mm-khugepaged-expand-the-is_refcount_suitable-to-support-file-folios +6 -5
@@ -546,12 +546,14 @@ static void release_pte_pages(pte_t *pte
 
 static bool is_refcount_suitable(struct folio *folio)
 {
-	int expected_refcount;
+	int expected_refcount = folio_mapcount(folio);
 
-	expected_refcount = folio_mapcount(folio);
-	if (folio_test_swapcache(folio))
+	if (!folio_test_anon(folio) || folio_test_swapcache(folio))
 		expected_refcount += folio_nr_pages(folio);
 
+	if (folio_test_private(folio))
+		expected_refcount++;
+
 	return folio_ref_count(folio) == expected_refcount;
 }
 
@@ -2285,8 +2287,7 @@ static int hpage_collapse_scan_file(stru
 			break;
 		}
 
-		if (folio_ref_count(folio) !=
-		    1 + folio_mapcount(folio) + folio_test_private(folio)) {
+		if (!is_refcount_suitable(folio)) {
 			result = SCAN_PAGE_COUNT;
 			break;
 		}

_

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