hc
2024-10-22 8ac6c7a54ed1b98d142dce24b11c6de6a1e239a5
kernel/include/linux/hugetlb.h
....@@ -7,6 +7,7 @@
77 #include <linux/fs.h>
88 #include <linux/hugetlb_inline.h>
99 #include <linux/cgroup.h>
10
+#include <linux/page_ref.h>
1011 #include <linux/list.h>
1112 #include <linux/kref.h>
1213 #include <linux/pgtable.h>
....@@ -148,7 +149,7 @@
148149 vm_flags_t vm_flags);
149150 long hugetlb_unreserve_pages(struct inode *inode, long start, long end,
150151 long freed);
151
-bool isolate_huge_page(struct page *page, struct list_head *list);
152
+int isolate_hugetlb(struct page *page, struct list_head *list);
152153 void putback_active_hugepage(struct page *page);
153154 void move_hugetlb_state(struct page *oldpage, struct page *newpage, int reason);
154155 void free_huge_page(struct page *page);
....@@ -334,9 +335,9 @@
334335 return NULL;
335336 }
336337
337
-static inline bool isolate_huge_page(struct page *page, struct list_head *list)
338
+static inline int isolate_hugetlb(struct page *page, struct list_head *list)
338339 {
339
- return false;
340
+ return -EBUSY;
340341 }
341342
342343 static inline void putback_active_hugepage(struct page *page)
....@@ -552,7 +553,10 @@
552553 if (!page_size_log)
553554 return &default_hstate;
554555
555
- return size_to_hstate(1UL << page_size_log);
556
+ if (page_size_log < BITS_PER_LONG)
557
+ return size_to_hstate(1UL << page_size_log);
558
+
559
+ return NULL;
556560 }
557561
558562 static inline struct hstate *hstate_vma(struct vm_area_struct *vma)
....@@ -963,4 +967,16 @@
963967 #define flush_hugetlb_tlb_range(vma, addr, end) flush_tlb_range(vma, addr, end)
964968 #endif
965969
970
+#ifdef CONFIG_ARCH_WANT_HUGE_PMD_SHARE
971
+static inline bool hugetlb_pmd_shared(pte_t *pte)
972
+{
973
+ return page_count(virt_to_page(pte)) > 1;
974
+}
975
+#else
976
+static inline bool hugetlb_pmd_shared(pte_t *pte)
977
+{
978
+ return false;
979
+}
980
+#endif
981
+
966982 #endif /* _LINUX_HUGETLB_H */