提交 ecfc2bda 编写于 作者: Z zhouchuangao 提交者: Linus Torvalds

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/1616727798-9110-1-git-send-email-zhouchuangao@vivo.comSigned-off-by: Nzhouchuangao <zhouchuangao@vivo.com>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 79cd4202
...@@ -1987,8 +1987,7 @@ static int zs_page_migrate(struct address_space *mapping, struct page *newpage, ...@@ -1987,8 +1987,7 @@ static int zs_page_migrate(struct address_space *mapping, struct page *newpage,
head = obj_to_head(page, addr); head = obj_to_head(page, addr);
if (head & OBJ_ALLOCATED_TAG) { if (head & OBJ_ALLOCATED_TAG) {
handle = head & ~OBJ_ALLOCATED_TAG; handle = head & ~OBJ_ALLOCATED_TAG;
if (!testpin_tag(handle)) BUG_ON(!testpin_tag(handle));
BUG();
old_obj = handle_to_obj(handle); old_obj = handle_to_obj(handle);
obj_to_location(old_obj, &dummy, &obj_idx); obj_to_location(old_obj, &dummy, &obj_idx);
...@@ -2035,8 +2034,7 @@ static int zs_page_migrate(struct address_space *mapping, struct page *newpage, ...@@ -2035,8 +2034,7 @@ static int zs_page_migrate(struct address_space *mapping, struct page *newpage,
head = obj_to_head(page, addr); head = obj_to_head(page, addr);
if (head & OBJ_ALLOCATED_TAG) { if (head & OBJ_ALLOCATED_TAG) {
handle = head & ~OBJ_ALLOCATED_TAG; handle = head & ~OBJ_ALLOCATED_TAG;
if (!testpin_tag(handle)) BUG_ON(!testpin_tag(handle));
BUG();
unpin_tag(handle); unpin_tag(handle);
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册