Thread (3 messages) 3 messages, 3 authors, 2021-08-26

Re: [PATCH v2] mm/hugetlb: initialize hugetlb_usage in mm_init

From: HORIGUCHI NAOYA (堀口 直也) <hidden>
Date: 2021-08-26 07:30:01
Also in: linux-mm

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 <redacted>
Thank you for the fix.

Reviewed-by: Naoya Horiguchi <redacted>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help