[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMZfGtWt9g9a3cQUj-E8JS5yVe_V7Gj7eY9+61djeXJ2zdgFKg@mail.gmail.com>
Date: Sat, 16 Jan 2021 12:36:55 +0800
From: Muchun Song <songmuchun@...edance.com>
To: Matthew Wilcox <willy@...radead.org>,
Mike Kravetz <mike.kravetz@...cle.com>
Cc: LKML <linux-kernel@...r.kernel.org>,
Linux Memory Management List <linux-mm@...ck.org>,
Michal Hocko <mhocko@...nel.org>,
Naoya Horiguchi <n-horiguchi@...jp.nec.com>,
David Hildenbrand <david@...hat.com>,
Oscar Salvador <osalvador@...e.de>,
Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [External] Re: [PATCH 2/5] hugetlb: convert page_huge_active() to
HP_Migratable flag
On Sat, Jan 16, 2021 at 12:26 PM Matthew Wilcox <willy@...radead.org> wrote:
>
> On Fri, Jan 15, 2021 at 04:31:02PM -0800, Mike Kravetz wrote:
> > +++ 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);
>
> > +++ 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.
Powered by blists - more mailing lists