]> git.baikalelectronics.ru Git - kernel.git/commit
mm/hugetlb: avoid unnecessary hugetlb_acct_memory() call
authorMiaohe Lin <linmiaohe@huawei.com>
Wed, 24 Feb 2021 20:06:57 +0000 (12:06 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 24 Feb 2021 21:38:32 +0000 (13:38 -0800)
commit50e1c9af462635326459a59d90868fba1e218927
treefb419d52f2e9880dd12b4a009a7eaa0815bfe699
parent8865963e95764dc32e30cfd5f8a4d60d9e80d76b
mm/hugetlb: avoid unnecessary hugetlb_acct_memory() call

When reservation accounting remains unchanged, hugetlb_acct_memory() will
do nothing except holding and releasing hugetlb_lock.  We should avoid
this unnecessary hugetlb_lock lock/unlock cycle which is happening on
'most' hugetlb munmap operations by check delta against 0 at the beginning
of hugetlb_acct_memory.

Link: https://lkml.kernel.org/r/20210115092013.61012-1-linmiaohe@huawei.com
Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Oscar Salvador <osalvador@suse.de>
Cc: Mike Kravetz <mike.kravetz@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/hugetlb.c