Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <peterx@redhat.com>
Reviewed-by: Mina Almasry <almasrymina@google.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: David Rientjes <rientjes@google.com>
Cc: Muchun Song <muchun.song@linux.dev>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Peter Xu and committed by
Andrew Morton
3ccae1dc 6401a2e6

+1 -1
+1 -1
mm/hugetlb_cgroup.c
··· 308 308 { 309 309 if (hugetlb_cgroup_disabled() || !h_cg) 310 310 return; 311 - 311 + lockdep_assert_held(&hugetlb_lock); 312 312 __set_hugetlb_cgroup(folio, h_cg, rsvd); 313 313 if (!rsvd) { 314 314 unsigned long usage =