Skip to content

Commit 7ea8574

Browse files
Michal Hockotorvalds
authored andcommitted
hugetlb_cgroup: use lockdep_assert_held rather than spin_is_locked
spin_lock may be an empty struct for !SMP configurations and so arch_spin_is_locked may return unconditional 0 and trigger the VM_BUG_ON even when the lock is held. Replace spin_is_locked by lockdep_assert_held. We will not BUG anymore but it is questionable whether crashing makes a lot of sense in the uncharge path. Uncharge happens after the last page reference was released so nobody should touch the page and the function doesn't update any shared state except for res counter which uses synchronization of its own. Signed-off-by: Michal Hocko <[email protected]> Reviewed-by: Aneesh Kumar K.V <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 137f8cf commit 7ea8574

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

mm/hugetlb_cgroup.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ void hugetlb_cgroup_uncharge_page(int idx, unsigned long nr_pages,
217217

218218
if (hugetlb_cgroup_disabled())
219219
return;
220-
VM_BUG_ON(!spin_is_locked(&hugetlb_lock));
220+
lockdep_assert_held(&hugetlb_lock);
221221
h_cg = hugetlb_cgroup_from_page(page);
222222
if (unlikely(!h_cg))
223223
return;

0 commit comments

Comments
 (0)