From: Mike Kravetz <mike.kravetz@oracle.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Xin Hao <xhao@linux.alibaba.com>,
songmuchun@bytedance.com, linux-mm@kvack.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH V2] mm/hugetlb: add is_resv_equal_free() func
Date: Fri, 16 Sep 2022 14:09:57 -0700 [thread overview]
Message-ID: <YyTmJUsKqAPVk6BH@monkey> (raw)
In-Reply-To: <20220916131249.68d59133cdb0366e0831592b@linux-foundation.org>
On 09/16/22 13:12, Andrew Morton wrote:
> On Fri, 16 Sep 2022 14:41:27 +0800 Xin Hao <xhao@linux.alibaba.com> wrote:
>
> > In hugetlb.c file, there are several places to compare the values of
> > 'h->free_huge_pages' and 'h->resv_huge_pages', it looks a bit messy, so
> > there add a new is_resv_equal_free() func to do these.
> >
> > ...
> >
> > --- a/mm/hugetlb.c
> > +++ b/mm/hugetlb.c
> > @@ -1191,6 +1191,11 @@ static struct page *dequeue_huge_page_nodemask(struct hstate *h, gfp_t gfp_mask,
> > return NULL;
> > }
> >
> > +static inline bool is_resv_equal_free(struct hstate *h)
>
> I'm not sure that's a well chosen name. A better name would reflect
> the *meaning* of free_huge_pages being equal to resv_huge_pages. Maybe
> something like reserves_exhausted()?
How about calling it free_non_reserved_huge_pages() and returning the actual
value (h->free_huge_pages - h->resv_huge_pages)?
Perhaps available_huge_pages()?
It could then be used in at least one other place
- if (h->free_huge_pages - h->resv_huge_pages > 0)
> This would all be clearer if we'd bothered to document the fields of
> struct hstate :(
Agree, and discussed elsewhwere some may even be able to be eliminated. I can
add that to my todo list.
--
Mike Kravetz
>
>
> > +{
> > + return (h->free_huge_pages - h->resv_huge_pages == 0) ? true : false;
>
> return h->free_huge_pages == h->resv_huge_pages;
>
> > +}
>
next prev parent reply other threads:[~2022-09-16 21:10 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-16 6:41 [PATCH V2] mm/hugetlb: add is_resv_equal_free() func Xin Hao
2022-09-16 20:12 ` Andrew Morton
2022-09-16 21:09 ` Mike Kravetz [this message]
2022-09-17 1:17 ` haoxin
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=YyTmJUsKqAPVk6BH@monkey \
--to=mike.kravetz@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=songmuchun@bytedance.com \
--cc=xhao@linux.alibaba.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.