diff mbox series

[4/4] hugetlb: Remove redundant VM_BUG_ON() in add_reservation_in_range()

Message ID 2b565552f3d06753da1e8dda439c0d96d6d9a5a3.1634797639.git.baolin.wang@linux.alibaba.com (mailing list archive)
State New
Headers show
Series Some cleanups and improvements for hugetlb | expand

Commit Message

Baolin Wang Oct. 21, 2021, 6:31 a.m. UTC
When calling hugetlb_resv_map_add(), we've guaranteed that the parameter
'to' is always larger than 'from', so it never returns a negative value
from hugetlb_resv_map_add(). Thus remove the redundant VM_BUG_ON().

Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com>
---
 mm/hugetlb.c | 1 -
 1 file changed, 1 deletion(-)

Comments

Mike Kravetz Oct. 22, 2021, 11:57 p.m. UTC | #1
On 10/20/21 11:31 PM, Baolin Wang wrote:
> When calling hugetlb_resv_map_add(), we've guaranteed that the parameter
> 'to' is always larger than 'from', so it never returns a negative value
> from hugetlb_resv_map_add(). Thus remove the redundant VM_BUG_ON().
> 
> Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com>
> ---
>  mm/hugetlb.c | 1 -
>  1 file changed, 1 deletion(-)

Thanks!  You are correct, we could never trigger that VM_BUG_ON.

Reviewed-by: Mike Kravetz <mike.kravetz@oracle.com>
diff mbox series

Patch

diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 5922629..166cfa1 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -446,7 +446,6 @@  static long add_reservation_in_range(struct resv_map *resv, long f, long t,
 		add += hugetlb_resv_map_add(resv, rg, last_accounted_offset,
 					    t, h, h_cg, regions_needed);
 
-	VM_BUG_ON(add < 0);
 	return add;
 }