All of lore.kernel.org
 help / color / mirror / Atom feed
From: "HORIGUCHI NAOYA(堀口 直也)" <naoya.horiguchi@nec.com>
To: Liu Zixian <liuzixian4@huawei.com>
Cc: "linux-mm@kvack.org" <linux-mm@kvack.org>,
	"mike.kravetz@oracle.com" <mike.kravetz@oracle.com>,
	"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
	"stable@vger.kernel.org" <stable@vger.kernel.org>,
	"wuxu.wu@huawei.com" <wuxu.wu@huawei.com>
Subject: Re: [PATCH v2] mm/hugetlb: initialize hugetlb_usage in mm_init
Date: Thu, 26 Aug 2021 07:29:55 +0000	[thread overview]
Message-ID: <20210826072954.GA2917170@hori.linux.bs1.fc.nec.co.jp> (raw)
In-Reply-To: <20210826071742.877-1-liuzixian4@huawei.com>

On Thu, Aug 26, 2021 at 03:17:42PM +0800, Liu Zixian wrote:
> After fork, the child process will get incorrect (2x) hugetlb_usage.
> If a process uses 5 2MB hugetlb pages in an anonymous mapping,
> 	HugetlbPages:	   10240 kB
> and then forks, the child will show,
> 	HugetlbPages:	   20480 kB
> The reason for double the amount is because hugetlb_usage will be
> copied from the parent and then increased when we copy page tables
> from parent to child. Child will have 2x actual usage.
> 
> Fix this by adding hugetlb_count_init in mm_init.
> 
> Fixes: 5d317b2b6536 ("mm: hugetlb: proc: add HugetlbPages field to
> /proc/PID/status")
> Signed-off-by: Liu Zixian <liuzixian4@huawei.com>

Thank you for the fix.

Reviewed-by: Naoya Horiguchi <naoya.horiguchi@nec.com>

  reply	other threads:[~2021-08-26  7:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-26  7:17 [PATCH v2] mm/hugetlb: initialize hugetlb_usage in mm_init Liu Zixian
2021-08-26  7:29 ` HORIGUCHI NAOYA(堀口 直也) [this message]
2021-08-26 16:19 ` 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=20210826072954.GA2917170@hori.linux.bs1.fc.nec.co.jp \
    --to=naoya.horiguchi@nec.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-mm@kvack.org \
    --cc=liuzixian4@huawei.com \
    --cc=mike.kravetz@oracle.com \
    --cc=stable@vger.kernel.org \
    --cc=wuxu.wu@huawei.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.