]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
mm/hugetlb: assert hugetlb_lock in __hugetlb_cgroup_commit_charge
authorPeter Xu <peterx@redhat.com>
Wed, 17 Apr 2024 21:18:36 +0000 (17:18 -0400)
committerAndrew Morton <akpm@linux-foundation.org>
Mon, 6 May 2024 00:53:41 +0000 (17:53 -0700)
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>
mm/hugetlb_cgroup.c

index aa4486bd390493b4bfc45aa05ee0353785388191..e20339a346b9353b2eb69101366e1f89411b29ae 100644 (file)
@@ -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 =