Go to file
Liu Zixian fa187ac754 mm/hugetlb: initialize hugetlb_usage in mm_init
BugLink: https://bugs.launchpad.net/bugs/1946802

commit 13db8c5047 upstream.

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.

Link: https://lkml.kernel.org/r/20210826071742.877-1-liuzixian4@huawei.com
Fixes: 5d317b2b65 ("mm: hugetlb: proc: add HugetlbPages field to /proc/PID/status")
Signed-off-by: Liu Zixian <liuzixian4@huawei.com>
Reviewed-by: Naoya Horiguchi <naoya.horiguchi@nec.com>
Reviewed-by: Mike Kravetz <mike.kravetz@oracle.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kelsey Skunberg <kelsey.skunberg@canonical.com>
2021-10-12 16:31:40 -06:00
Documentation docs: Fix infiniband uverbs minor number 2021-10-12 16:31:24 -06:00
LICENSES
arch s390/pv: fix the forcing of the swiotlb 2021-10-12 16:31:39 -06:00
block scsi: bsg: Remove support for SCSI_IOCTL_SEND_COMMAND 2021-10-12 16:31:24 -06:00
certs certs: Trigger creation of RSA module signing key if it's not an RSA key 2021-10-11 17:08:45 -06:00
crypto crypto: shash - avoid comparing pointers to exported functions under CFI 2021-08-13 09:45:08 +02:00
debian UBUNTU: [Packaging] Add fips-checks as part of finalchecks 2021-10-12 16:31:05 -06:00
debian.master UBUNTU: upstream stable to v5.4.147 2021-10-12 16:31:06 -06:00
drivers cpufreq: powernv: Fix init_chip_info initialization in numa=off 2021-10-12 16:31:39 -06:00
fs ovl: fix BUG_ON() in may_delete() when called from ovl_cleanup() 2021-10-12 16:31:39 -06:00
include mm/hugetlb: initialize hugetlb_usage in mm_init 2021-10-12 16:31:40 -06:00
init kbuild: add CONFIG_LD_IS_LLD 2021-08-13 09:44:14 +02:00
ipc memcg: enable accounting of ipc resources 2021-10-12 15:19:01 -06:00
kernel mm/hugetlb: initialize hugetlb_usage in mm_init 2021-10-12 16:31:40 -06:00
lib bpf/tests: Do not PASS tests without actually testing the result 2021-10-12 16:31:30 -06:00
mm mm/page_alloc: speed up the iteration of max_order 2021-10-01 11:34:02 +02:00
net fix array-index-out-of-bounds in taprio_change 2021-10-12 16:31:39 -06:00
samples samples: bpf: Fix tracex7 error raised on the missing argument 2021-10-12 16:31:32 -06:00
scripts kbuild: Fix 'no symbols' warning when CONFIG_TRIM_UNUSD_KSYMS=y 2021-10-12 16:31:27 -06:00
security Smack: Fix wrong semantics in smk_access_entry() 2021-10-12 16:31:29 -06:00
sound ASoC: rockchip: i2s: Fixup config for DAIFMT_DSP_A/B 2021-10-12 16:31:38 -06:00
tools selftests/bpf: Enlarge select() timeout for test_maps 2021-10-12 16:31:37 -06:00
ubuntu UBUNTU: [Packaging] Add support for ODM drivers 2021-01-26 17:27:59 -07:00
usr
virt KVM: Do not leak memory for duplicate debugfs directories 2021-09-20 18:50:10 +02:00
.clang-format
.cocciconfig
.get_maintainer.ignore
.gitattributes
.gitignore
.mailmap
COPYING
CREDITS
Kbuild
Kconfig
MAINTAINERS UBUNTU: ODM: MAINTAINERS: Add Advantech AHC1EC0 embedded controller entry 2021-02-19 16:45:06 +01:00
Makefile Linux 5.4.147 2021-10-12 16:31:06 -06:00
README
dropped.txt
snapcraft.yaml
update-dkms-versions UBUNTU: [Packaging] switch to kernel-versions 2021-09-20 18:50:21 +02:00
update-version-dkms UBUNTU: [Packaging] switch to kernel-versions 2021-09-20 18:50:21 +02:00

README

Linux kernel
============

There are several guides for kernel developers and users. These guides can
be rendered in a number of formats, like HTML and PDF. Please read
Documentation/admin-guide/README.rst first.

In order to build the documentation, use ``make htmldocs`` or
``make pdfdocs``.  The formatted documentation can also be read online at:

    https://www.kernel.org/doc/html/latest/

There are various text files in the Documentation/ subdirectory,
several of them using the Restructured Text markup notation.

Please read the Documentation/process/changes.rst file, as it contains the
requirements for building and running the kernel, and information about
the problems which may result by upgrading your kernel.