Skip to content

Commit

Permalink
mm/zsmalloc: use BUG_ON instead of if condition followed by BUG.
Browse files Browse the repository at this point in the history
It can be optimized at compile time.

Link: https://lkml.kernel.org/r/1616727798-9110-1-git-send-email-zhouchuangao@vivo.com
Signed-off-by: zhouchuangao <zhouchuangao@vivo.com>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
zhouchuangao authored and Linus Torvalds committed May 5, 2021
1 parent 79cd420 commit ecfc2bd
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions mm/zsmalloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1987,8 +1987,7 @@ static int zs_page_migrate(struct address_space *mapping, struct page *newpage,
head = obj_to_head(page, addr);
if (head & OBJ_ALLOCATED_TAG) {
handle = head & ~OBJ_ALLOCATED_TAG;
if (!testpin_tag(handle))
BUG();
BUG_ON(!testpin_tag(handle));

old_obj = handle_to_obj(handle);
obj_to_location(old_obj, &dummy, &obj_idx);
Expand Down Expand Up @@ -2035,8 +2034,7 @@ static int zs_page_migrate(struct address_space *mapping, struct page *newpage,
head = obj_to_head(page, addr);
if (head & OBJ_ALLOCATED_TAG) {
handle = head & ~OBJ_ALLOCATED_TAG;
if (!testpin_tag(handle))
BUG();
BUG_ON(!testpin_tag(handle));
unpin_tag(handle);
}
}
Expand Down

0 comments on commit ecfc2bd

Please sign in to comment.