From: Miaohe Lin <linmiaohe@huawei.com>
To: Muchun Song <songmuchun@bytedance.com>
Cc: <sh_def@163.com>, <linux-mm@kvack.org>,
<linux-kernel@vger.kernel.org>, <stable@vger.kernel.org>,
<mike.kravetz@oracle.com>, <akpm@linux-foundation.org>
Subject: Re: [PATCH] mm: hugetlb: fix missing put_page in gather_surplus_pages()
Date: Tue, 26 Jan 2021 14:20:10 +0800 [thread overview]
Message-ID: <becc96f8-9abd-21e1-337f-22b1cd7a9c96@huawei.com> (raw)
In-Reply-To: <20210126031009.96266-1-songmuchun@bytedance.com>
Hi:
On 2021/1/26 11:10, Muchun Song wrote:
> The VM_BUG_ON_PAGE avoids the generation of any code, even if that
> expression has side-effects when !CONFIG_DEBUG_VM.
>
> Fixes: e5dfacebe4a4 ("mm/hugetlb.c: just use put_page_testzero() instead of page_count()")
> Signed-off-by: Muchun Song <songmuchun@bytedance.com>
> Cc: <stable@vger.kernel.org>
> ---
> mm/hugetlb.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> index a6bad1f686c5..082ed643020b 100644
> --- a/mm/hugetlb.c
> +++ b/mm/hugetlb.c
> @@ -2047,13 +2047,16 @@ static int gather_surplus_pages(struct hstate *h, long delta)
>
> /* Free the needed pages to the hugetlb pool */
> list_for_each_entry_safe(page, tmp, &surplus_list, lru) {
> + int zeroed;
> +
> if ((--needed) < 0)
> break;
> /*
> * This page is now managed by the hugetlb allocator and has
> * no users -- drop the buddy allocator's reference.
> */
> - VM_BUG_ON_PAGE(!put_page_testzero(page), page);
> + zeroed = put_page_testzero(page);
> + VM_BUG_ON_PAGE(!zeroed, page);
> enqueue_huge_page(h, page);
> }
> free:
>
Good Catch! Thanks.
Reviewed-by: Miaohe Lin <linmiaohe@huawei.com>
prev parent reply other threads:[~2021-01-26 6:20 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-26 3:10 Muchun Song
2021-01-26 4:31 ` Mike Kravetz
2021-01-26 6:10 ` [External] " Muchun Song
2021-01-26 6:20 ` Miaohe Lin [this message]
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=becc96f8-9abd-21e1-337f-22b1cd7a9c96@huawei.com \
--to=linmiaohe@huawei.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mike.kravetz@oracle.com \
--cc=sh_def@163.com \
--cc=songmuchun@bytedance.com \
--cc=stable@vger.kernel.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