linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Muchun Song <songmuchun@bytedance.com>
To: Matthew Wilcox <willy@infradead.org>,
	Mike Kravetz <mike.kravetz@oracle.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Linux Memory Management List <linux-mm@kvack.org>,
	Michal Hocko <mhocko@kernel.org>,
	Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>,
	David Hildenbrand <david@redhat.com>,
	Oscar Salvador <osalvador@suse.de>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [External] Re: [PATCH 2/5] hugetlb: convert page_huge_active() to HP_Migratable flag
Date: Sat, 16 Jan 2021 12:36:55 +0800	[thread overview]
Message-ID: <CAMZfGtWt9g9a3cQUj-E8JS5yVe_V7Gj7eY9+61djeXJ2zdgFKg@mail.gmail.com> (raw)
In-Reply-To: <20210116042416.GA2260413@casper.infradead.org>

On Sat, Jan 16, 2021 at 12:26 PM Matthew Wilcox <willy@infradead.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.

  reply	other threads:[~2021-01-16  4:38 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-16  0:31 [PATCH 0/5] create hugetlb flags to consolidate state Mike Kravetz
2021-01-16  0:31 ` [PATCH 1/5] hugetlb: use page.private for hugetlb specific page flags Mike Kravetz
2021-01-16  0:31 ` [PATCH 2/5] hugetlb: convert page_huge_active() to HP_Migratable flag Mike Kravetz
2021-01-16  4:24   ` Matthew Wilcox
2021-01-16  4:36     ` Muchun Song [this message]
2021-01-16 12:06     ` Oscar Salvador
2021-01-16 21:53       ` Mike Kravetz
2021-01-16  0:31 ` [PATCH 3/5] hugetlb: only set HP_Migratable for migratable hstates Mike Kravetz
2021-01-16  0:31 ` [PATCH 4/5] hugetlb: convert PageHugeTemporary() to HP_Temporary flag Mike Kravetz
2021-01-16  0:31 ` [PATCH 5/5] hugetlb: convert PageHugeFreed to HP_Freed flag Mike Kravetz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAMZfGtWt9g9a3cQUj-E8JS5yVe_V7Gj7eY9+61djeXJ2zdgFKg@mail.gmail.com \
    --to=songmuchun@bytedance.com \
    --cc=akpm@linux-foundation.org \
    --cc=david@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@kernel.org \
    --cc=mike.kravetz@oracle.com \
    --cc=n-horiguchi@ah.jp.nec.com \
    --cc=osalvador@suse.de \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).