Re: [PATCH 2/9] mm: Call the hugetlb destructor directly

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

 



On 15.08.23 05:26, Matthew Wilcox (Oracle) wrote:
Indirect calls are expensive, thanks to Spectre.  Convert this one to
a direct call, and pass a folio instead of the head page to save a few
more instructions.

Signed-off-by: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx>
---
  include/linux/hugetlb.h |  3 ++-
  include/linux/mm.h      |  6 +-----
  mm/hugetlb.c            | 26 ++++++++++++--------------
  mm/page_alloc.c         |  8 +++++---
  4 files changed, 20 insertions(+), 23 deletions(-)

diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index 0a393bc02f25..9555859537a3 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -26,6 +26,8 @@ typedef struct { unsigned long pd; } hugepd_t;
  #define __hugepd(x) ((hugepd_t) { (x) })
  #endif
+void free_huge_page(struct folio *folio);
+
  #ifdef CONFIG_HUGETLB_PAGE
#include <linux/mempolicy.h>
@@ -165,7 +167,6 @@ int get_huge_page_for_hwpoison(unsigned long pfn, int flags,
  				bool *migratable_cleared);
  void folio_putback_active_hugetlb(struct folio *folio);
  void move_hugetlb_state(struct folio *old_folio, struct folio *new_folio, int reason);
-void free_huge_page(struct page *page);
  void hugetlb_fix_reserve_counts(struct inode *inode);
  extern struct mutex *hugetlb_fault_mutex_table;
  u32 hugetlb_fault_mutex_hash(struct address_space *mapping, pgoff_t idx);
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 19493d6a2bb8..7fb529dbff31 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -1278,13 +1278,9 @@ typedef void compound_page_dtor(struct page *);
  enum compound_dtor_id {
  	NULL_COMPOUND_DTOR,
  	COMPOUND_PAGE_DTOR,
-#ifdef CONFIG_HUGETLB_PAGE
  	HUGETLB_PAGE_DTOR,
-#endif
-#ifdef CONFIG_TRANSPARENT_HUGEPAGE
  	TRANSHUGE_PAGE_DTOR,
-#endif
-	NR_COMPOUND_DTORS,
+	NR_COMPOUND_DTORS
  };
static inline void folio_set_compound_dtor(struct folio *folio,
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index e327a5a7602c..bc340f5dbbd4 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -1875,13 +1875,12 @@ struct hstate *size_to_hstate(unsigned long size)
  	return NULL;
  }
-void free_huge_page(struct page *page)
+void free_huge_page(struct folio *folio)

free_huge_page" but passing a folio, hm. Maybe something like "free_hugetlb_folio" would be better.


Apart from that LGTM.

--
Cheers,

David / dhildenb




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux