]> git.baikalelectronics.ru Git - kernel.git/commit
mm/mmap.c: fix missing call to vm_unacct_memory in mmap_region
authorMiaohe Lin <linmiaohe@huawei.com>
Sat, 18 Jun 2022 08:20:27 +0000 (16:20 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 25 Aug 2022 09:17:58 +0000 (11:17 +0200)
commit4aa2a1f2b5c707b4cdc24967d7c080b75f6cdec6
tree81fe1de4d6c5b81476e6f51774d8fa4f1720b35b
parentdc295422a4a1e14740943b285c7c1e9f762e7d2c
mm/mmap.c: fix missing call to vm_unacct_memory in mmap_region

[ Upstream commit 580b8583b329fa19db8a471db2b499e2f15e6c63 ]

Since the beginning, charged is set to 0 to avoid calling vm_unacct_memory
twice because vm_unacct_memory will be called by above unmap_region.  But
since commit 1fd9cdf0f893 ("vm: remove 'nr_accounted' calculations from
the unmap_vmas() interfaces"), unmap_region doesn't call vm_unacct_memory
anymore.  So charged shouldn't be set to 0 now otherwise the calling to
paired vm_unacct_memory will be missed and leads to imbalanced account.

Link: https://lkml.kernel.org/r/20220618082027.43391-1-linmiaohe@huawei.com
Fixes: 1fd9cdf0f893 ("vm: remove 'nr_accounted' calculations from the unmap_vmas() interfaces")
Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
mm/mmap.c