From: Baoquan He <bhe@redhat.com>
To: Mike Kravetz <mike.kravetz@oracle.com>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
akpm@linux-foundation.org
Subject: Re: [PATCH 5/5] mm/hugetl.c: warn out if expected count of huge pages adjustment is not achieved
Date: Wed, 22 Jul 2020 16:49:13 +0800 [thread overview]
Message-ID: <20200722084913.GO32539@MiWiFi-R3L-srv> (raw)
In-Reply-To: <c5eb3692-2d05-d6dc-437d-21e51705560e@oracle.com>
Hi Mike,
On 07/20/20 at 05:38pm, Mike Kravetz wrote:
> > diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> > index 467894d8332a..1dfb5d9e4e06 100644
> > --- a/mm/hugetlb.c
> > +++ b/mm/hugetlb.c
> > @@ -2661,7 +2661,7 @@ static int adjust_pool_surplus(struct hstate *h, nodemask_t *nodes_allowed,
> > static int set_max_huge_pages(struct hstate *h, unsigned long count, int nid,
> > nodemask_t *nodes_allowed)
> > {
> > - unsigned long min_count, ret;
> > + unsigned long min_count, ret, old_max;
> > NODEMASK_ALLOC(nodemask_t, node_alloc_noretry, GFP_KERNEL);
> >
> > /*
> > @@ -2723,6 +2723,7 @@ static int set_max_huge_pages(struct hstate *h, unsigned long count, int nid,
> > * pool might be one hugepage larger than it needs to be, but
> > * within all the constraints specified by the sysctls.
> > */
> > + old_max = persistent_huge_pages(h);
> > while (h->surplus_huge_pages && count > persistent_huge_pages(h)) {
> > if (!adjust_pool_surplus(h, nodes_allowed, -1))
> > break;
> > @@ -2779,6 +2780,16 @@ static int set_max_huge_pages(struct hstate *h, unsigned long count, int nid,
> > }
> > out:
> > h->max_huge_pages = persistent_huge_pages(h);
> > + if (count != h->max_huge_pages) {
> > + char buf[32];
> > +
> > + string_get_size(huge_page_size(h), 1, STRING_UNITS_2, buf, 32);
> > + pr_warn("HugeTLB: %s %lu of page size %s failed. Only %s %lu hugepages.\n",
> > + count > old_max ? "increasing" : "decreasing",
> > + abs(count - old_max), buf,
> > + count > old_max ? "increased" : "decreased",
> > + abs(old_max - h->max_huge_pages));
> > + }
> > spin_unlock(&hugetlb_lock);
>
> I would prefer if we drop the lock before logging the message. That would
> involve grabbing the value of h->max_huge_pages before dropping the lock.
Do you think the below change is OK to you to move the message logging
after lock dropping? If yes, I will repost with updated patches.
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 6a9b7556ce5b..b5aa32a13569 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -2661,7 +2661,7 @@ static int adjust_pool_surplus(struct hstate *h, nodemask_t *nodes_allowed,
static int set_max_huge_pages(struct hstate *h, unsigned long count, int nid,
nodemask_t *nodes_allowed)
{
- unsigned long min_count, ret, old_max;
+ unsigned long min_count, ret, old_max, new_max;
NODEMASK_ALLOC(nodemask_t, node_alloc_noretry, GFP_KERNEL);
/*
@@ -2780,7 +2780,10 @@ static int set_max_huge_pages(struct hstate *h, unsigned long count, int nid,
}
out:
h->max_huge_pages = persistent_huge_pages(h);
- if (count != h->max_huge_pages) {
+ new_max = h->max_huge_pages;
+ spin_unlock(&hugetlb_lock);
+
+ if (count != new_max) {
char buf[32];
string_get_size(huge_page_size(h), 1, STRING_UNITS_2, buf, 32);
@@ -2788,9 +2791,8 @@ static int set_max_huge_pages(struct hstate *h, unsigned long count, int nid,
count > old_max ? "increasing" : "decreasing",
abs(count - old_max), buf,
count > old_max ? "increased" : "decreased",
- abs(old_max - h->max_huge_pages));
+ abs(old_max - new_max));
}
- spin_unlock(&hugetlb_lock);
NODEMASK_FREE(node_alloc_noretry);
next prev parent reply other threads:[~2020-07-22 8:50 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-20 6:26 [PATCH 0/5] mm/hugetlb: Small cleanup and improvement Baoquan He
2020-07-20 6:26 ` [PATCH 1/5] mm/hugetlb.c: Fix typo of glb_reserve Baoquan He
2020-07-20 22:32 ` Mike Kravetz
2020-07-21 9:17 ` Baoquan He
2020-07-20 6:26 ` [PATCH 2/5] mm/hugetlb.c: make is_hugetlb_entry_hwpoisoned return bool Baoquan He
2020-07-20 22:34 ` Mike Kravetz
2020-07-21 9:56 ` David Hildenbrand
2020-07-20 6:26 ` [PATCH 3/5] mm/hugetlb.c: Remove the unnecessary non_swap_entry() Baoquan He
2020-07-20 22:44 ` Mike Kravetz
2020-07-21 9:56 ` David Hildenbrand
2020-07-20 6:26 ` [PATCH 4/5] doc/vm: fix typo in in the hugetlb admin documentation Baoquan He
2020-07-20 22:55 ` Mike Kravetz
2020-07-21 9:56 ` David Hildenbrand
2020-07-20 6:26 ` [PATCH 5/5] mm/hugetl.c: warn out if expected count of huge pages adjustment is not achieved Baoquan He
2020-07-21 0:38 ` Mike Kravetz
2020-07-21 9:55 ` Baoquan He
2020-07-22 8:49 ` Baoquan He [this message]
2020-07-22 16:15 ` 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=20200722084913.GO32539@MiWiFi-R3L-srv \
--to=bhe@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mike.kravetz@oracle.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 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).