From: Peter Xu Date: Wed, 17 Apr 2024 21:18:36 +0000 (-0400) Subject: mm/hugetlb: assert hugetlb_lock in __hugetlb_cgroup_commit_charge X-Git-Tag: v6.10-rc1~105^2~110 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3ccae1dc84086721c300a1026d2c38574e433e69;p=thirdparty%2Fkernel%2Flinux.git mm/hugetlb: assert hugetlb_lock in __hugetlb_cgroup_commit_charge This is similar to __hugetlb_cgroup_uncharge_folio() where it relies on holding hugetlb_lock. Add the similar assertion like the other one, since it looks like such things may help some day. Link: https://lkml.kernel.org/r/20240417211836.2742593-4-peterx@redhat.com Signed-off-by: Peter Xu Reviewed-by: Mina Almasry Cc: David Hildenbrand Cc: David Rientjes Cc: Muchun Song Signed-off-by: Andrew Morton --- diff --git a/mm/hugetlb_cgroup.c b/mm/hugetlb_cgroup.c index aa4486bd39049..e20339a346b93 100644 --- a/mm/hugetlb_cgroup.c +++ b/mm/hugetlb_cgroup.c @@ -308,7 +308,7 @@ static void __hugetlb_cgroup_commit_charge(int idx, unsigned long nr_pages, { if (hugetlb_cgroup_disabled() || !h_cg) return; - + lockdep_assert_held(&hugetlb_lock); __set_hugetlb_cgroup(folio, h_cg, rsvd); if (!rsvd) { unsigned long usage =