[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <mhng-1c7adead-9a56-41dc-a734-61e0088b0cc3@palmerdabbelt-glaptop>
Date: Thu, 22 Apr 2021 18:53:28 -0700 (PDT)
From: Palmer Dabbelt <palmer@...belt.com>
To: zhouchuangao@...o.com
CC: Paul Walmsley <paul.walmsley@...ive.com>, aou@...s.berkeley.edu,
Atish Patra <Atish.Patra@....com>,
Anup Patel <Anup.Patel@....com>, rppt@...nel.org,
akpm@...ux-foundation.org, wangkefeng.wang@...wei.com,
zong.li@...ive.com, mick@....forth.gr,
linux-riscv@...ts.infradead.org, linux-kernel@...r.kernel.org,
zhouchuangao@...o.com
Subject: Re: [PATCH] riscv/mm: Use BUG_ON instead of if condition followed by BUG.
On Tue, 30 Mar 2021 06:56:26 PDT (-0700), zhouchuangao@...o.com wrote:
> BUG_ON() uses unlikely in if(), which can be optimized at compile time.
>
> Signed-off-by: zhouchuangao <zhouchuangao@...o.com>
> ---
> arch/riscv/mm/init.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c
> index 067583a..a7fa5e2 100644
> --- a/arch/riscv/mm/init.c
> +++ b/arch/riscv/mm/init.c
> @@ -213,8 +213,8 @@ static phys_addr_t alloc_pte_late(uintptr_t va)
> unsigned long vaddr;
>
> vaddr = __get_free_page(GFP_KERNEL);
> - if (!vaddr || !pgtable_pte_page_ctor(virt_to_page(vaddr)))
> - BUG();
> + BUG_ON(!vaddr || !pgtable_pte_page_ctor(virt_to_page(vaddr)));
> +
> return __pa(vaddr);
> }
Thanks, this is on for-next.
Powered by blists - more mailing lists