* [PATCH] riscv/mm: Use BUG_ON instead of if condition followed by BUG.
@ 2021-03-30 13:56 ` zhouchuangao
0 siblings, 0 replies; 4+ messages in thread
From: zhouchuangao @ 2021-03-30 13:56 UTC (permalink / raw)
To: Paul Walmsley, Palmer Dabbelt, Albert Ou, Atish Patra,
Anup Patel, Mike Rapoport, Andrew Morton, Kefeng Wang, Zong Li,
Nick Kossifidis, linux-riscv, linux-kernel
Cc: zhouchuangao
BUG_ON() uses unlikely in if(), which can be optimized at compile time.
Signed-off-by: zhouchuangao <zhouchuangao@vivo.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);
}
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] riscv/mm: Use BUG_ON instead of if condition followed by BUG.
@ 2021-03-30 13:56 ` zhouchuangao
0 siblings, 0 replies; 4+ messages in thread
From: zhouchuangao @ 2021-03-30 13:56 UTC (permalink / raw)
To: Paul Walmsley, Palmer Dabbelt, Albert Ou, Atish Patra,
Anup Patel, Mike Rapoport, Andrew Morton, Kefeng Wang, Zong Li,
Nick Kossifidis, linux-riscv, linux-kernel
Cc: zhouchuangao
BUG_ON() uses unlikely in if(), which can be optimized at compile time.
Signed-off-by: zhouchuangao <zhouchuangao@vivo.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);
}
--
2.7.4
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] riscv/mm: Use BUG_ON instead of if condition followed by BUG.
2021-03-30 13:56 ` zhouchuangao
@ 2021-04-23 1:53 ` Palmer Dabbelt
-1 siblings, 0 replies; 4+ messages in thread
From: Palmer Dabbelt @ 2021-04-23 1:53 UTC (permalink / raw)
To: zhouchuangao
Cc: Paul Walmsley, aou, Atish Patra, Anup Patel, rppt, akpm,
wangkefeng.wang, zong.li, mick, linux-riscv, linux-kernel,
zhouchuangao
On Tue, 30 Mar 2021 06:56:26 PDT (-0700), zhouchuangao@vivo.com wrote:
> BUG_ON() uses unlikely in if(), which can be optimized at compile time.
>
> Signed-off-by: zhouchuangao <zhouchuangao@vivo.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.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] riscv/mm: Use BUG_ON instead of if condition followed by BUG.
@ 2021-04-23 1:53 ` Palmer Dabbelt
0 siblings, 0 replies; 4+ messages in thread
From: Palmer Dabbelt @ 2021-04-23 1:53 UTC (permalink / raw)
To: zhouchuangao
Cc: Paul Walmsley, aou, Atish Patra, Anup Patel, rppt, akpm,
wangkefeng.wang, zong.li, mick, linux-riscv, linux-kernel,
zhouchuangao
On Tue, 30 Mar 2021 06:56:26 PDT (-0700), zhouchuangao@vivo.com wrote:
> BUG_ON() uses unlikely in if(), which can be optimized at compile time.
>
> Signed-off-by: zhouchuangao <zhouchuangao@vivo.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.
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-04-23 1:54 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-30 13:56 [PATCH] riscv/mm: Use BUG_ON instead of if condition followed by BUG zhouchuangao
2021-03-30 13:56 ` zhouchuangao
2021-04-23 1:53 ` Palmer Dabbelt
2021-04-23 1:53 ` Palmer Dabbelt
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.