Skip to content

Commit ecfc2bd

Browse files
zhouchuangaotorvalds
authored andcommitted
mm/zsmalloc: use BUG_ON instead of if condition followed by BUG.
It can be optimized at compile time. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: zhouchuangao <[email protected]> Cc: Minchan Kim <[email protected]> Cc: Sergey Senozhatsky <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 79cd420 commit ecfc2bd

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

mm/zsmalloc.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1987,8 +1987,7 @@ static int zs_page_migrate(struct address_space *mapping, struct page *newpage,
19871987
head = obj_to_head(page, addr);
19881988
if (head & OBJ_ALLOCATED_TAG) {
19891989
handle = head & ~OBJ_ALLOCATED_TAG;
1990-
if (!testpin_tag(handle))
1991-
BUG();
1990+
BUG_ON(!testpin_tag(handle));
19921991

19931992
old_obj = handle_to_obj(handle);
19941993
obj_to_location(old_obj, &dummy, &obj_idx);
@@ -2035,8 +2034,7 @@ static int zs_page_migrate(struct address_space *mapping, struct page *newpage,
20352034
head = obj_to_head(page, addr);
20362035
if (head & OBJ_ALLOCATED_TAG) {
20372036
handle = head & ~OBJ_ALLOCATED_TAG;
2038-
if (!testpin_tag(handle))
2039-
BUG();
2037+
BUG_ON(!testpin_tag(handle));
20402038
unpin_tag(handle);
20412039
}
20422040
}

0 commit comments

Comments
 (0)