Patch "mm/hugetlb: add hugetlb_folio_subpool() helpers" has been added to the 6.1-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/hugetlb: add hugetlb_folio_subpool() helpers

to the 6.1-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-hugetlb-add-hugetlb_folio_subpool-helpers.patch
and it can be found in the queue-6.1 subdirectory.

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



commit b63950dc421fb0ba0d198e754ded83610eb96da9
Author: Sidhartha Kumar <sidhartha.kumar@xxxxxxxxxx>
Date:   Thu Sep 22 10:42:05 2022 -0500

    mm/hugetlb: add hugetlb_folio_subpool() helpers
    
    [ Upstream commit 149562f7509404c382c32c3fa8a6ba356135e5cf ]
    
    Allow hugetlbfs_migrate_folio to check and read subpool information by
    passing in a folio.
    
    Link: https://lkml.kernel.org/r/20220922154207.1575343-4-sidhartha.kumar@xxxxxxxxxx
    Signed-off-by: Sidhartha Kumar <sidhartha.kumar@xxxxxxxxxx>
    Reviewed-by: Mike Kravetz <mike.kravetz@xxxxxxxxxx>
    Cc: Arnd Bergmann <arnd@xxxxxxxx>
    Cc: Colin Cross <ccross@xxxxxxxxxx>
    Cc: David Howells <dhowells@xxxxxxxxxx>
    Cc: "Eric W . Biederman" <ebiederm@xxxxxxxxxxxx>
    Cc: Hugh Dickins <hughd@xxxxxxxxxx>
    Cc: kernel test robot <lkp@xxxxxxxxx>
    Cc: Matthew Wilcox <willy@xxxxxxxxxxxxx>
    Cc: Muchun Song <songmuchun@xxxxxxxxxxxxx>
    Cc: Peter Xu <peterx@xxxxxxxxxx>
    Cc: Vlastimil Babka <vbabka@xxxxxxx>
    Cc: William Kucharski <william.kucharski@xxxxxxxxxx>
    Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
    Stable-dep-of: b76b46902c2d ("mm/hugetlb: fix missing hugetlb_lock for resv uncharge")
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
index 4fe4b3393e71c..330729445d8ab 100644
--- a/fs/hugetlbfs/inode.c
+++ b/fs/hugetlbfs/inode.c
@@ -1108,10 +1108,10 @@ static int hugetlbfs_migrate_folio(struct address_space *mapping,
 	if (rc != MIGRATEPAGE_SUCCESS)
 		return rc;
 
-	if (hugetlb_page_subpool(&src->page)) {
-		hugetlb_set_page_subpool(&dst->page,
-					hugetlb_page_subpool(&src->page));
-		hugetlb_set_page_subpool(&src->page, NULL);
+	if (hugetlb_folio_subpool(src)) {
+		hugetlb_set_folio_subpool(dst,
+					hugetlb_folio_subpool(src));
+		hugetlb_set_folio_subpool(src, NULL);
 	}
 
 	if (mode != MIGRATE_SYNC_NO_COPY)
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index 0c5326fd3c47a..02d9a8af3704e 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -754,18 +754,29 @@ extern unsigned int default_hstate_idx;
 
 #define default_hstate (hstates[default_hstate_idx])
 
+static inline struct hugepage_subpool *hugetlb_folio_subpool(struct folio *folio)
+{
+	return (void *)folio_get_private_1(folio);
+}
+
 /*
  * hugetlb page subpool pointer located in hpage[1].private
  */
 static inline struct hugepage_subpool *hugetlb_page_subpool(struct page *hpage)
 {
-	return (void *)page_private(hpage + SUBPAGE_INDEX_SUBPOOL);
+	return hugetlb_folio_subpool(page_folio(hpage));
+}
+
+static inline void hugetlb_set_folio_subpool(struct folio *folio,
+					struct hugepage_subpool *subpool)
+{
+	folio_set_private_1(folio, (unsigned long)subpool);
 }
 
 static inline void hugetlb_set_page_subpool(struct page *hpage,
 					struct hugepage_subpool *subpool)
 {
-	set_page_private(hpage + SUBPAGE_INDEX_SUBPOOL, (unsigned long)subpool);
+	hugetlb_set_folio_subpool(page_folio(hpage), subpool);
 }
 
 static inline struct hstate *hstate_file(struct file *f)




[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