Thread (10 messages) 10 messages, 4 authors, 2021-01-16

Re: [External] Re: [PATCH 2/5] hugetlb: convert page_huge_active() to HP_Migratable flag

From: Muchun Song <hidden>
Date: 2021-01-16 04:38:35
Also in: lkml

On Sat, Jan 16, 2021 at 12:26 PM Matthew Wilcox [off-list ref] wrote:
On Fri, Jan 15, 2021 at 04:31:02PM -0800, Mike Kravetz wrote:
quoted
+++ b/fs/hugetlbfs/inode.c
@@ -735,7 +735,7 @@ static long hugetlbfs_fallocate(struct file *file, int mode, loff_t offset,

              mutex_unlock(&hugetlb_fault_mutex_table[hash]);

-             set_page_huge_active(page);
+             hugetlb_set_page_flag(page, HP_Migratable);
I had understood the request to be more like ...

                SetHPageMigratable(page);
quoted
+++ b/include/linux/hugetlb.h
@@ -480,9 +480,13 @@ unsigned long hugetlb_get_unmapped_area(struct file *file, unsigned long addr,
  * HP_Restore_Reserve - Set when a hugetlb page consumes a reservation at
  *   allocation time.  Cleared when page is fully instantiated.  Free
  *   routine checks flag to restore a reservation on error paths.
+ * HP_Migratable - Set after a newly allocated page is added to the page
+ *   cache and/or page tables.  Indicates the page is a candidate for
+ *   migration.
  */
 enum hugetlb_page_flags {
      HP_Restore_Reserve = 0,
+     HP_Migratable,
 };
and name these HPG_restore_reserve and HPG_migratable

and generate the calls to hugetlb_set_page_flag etc from macros, eg:

#define TESTHPAGEFLAG(uname, lname)                                     \
static __always_inline bool HPage##uname(struct page *page)             \
{ return test_bit(HPG_##lname, &page->private); }
...
#define HPAGEFLAG(uname, lname)                                         \
        TESTHPAGEFLAG(uname, lname)                                     \
        SETHPAGEFLAG(uname, lname)                                      \
        CLEARHPAGEFLAG(uname, lname)

HPAGEFLAG(RestoreReserve, restore_reserve)
HPAGEFLAG(Migratable, migratable)

just to mirror page-flags.h more closely.
I prefer this suggestion. I also made the same suggestion in the
previous RFC version.

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help