* [PATCH] powerpc/mm/radix: Drop unneeded NULL check
@ 2017-10-16 7:11 Aneesh Kumar K.V
2017-10-17 11:54 ` Nicholas Piggin
2017-10-24 8:08 ` Michael Ellerman
0 siblings, 2 replies; 4+ messages in thread
From: Aneesh Kumar K.V @ 2017-10-16 7:11 UTC (permalink / raw)
To: benh, paulus, mpe; +Cc: linuxppc-dev, Aneesh Kumar K . V
From: Michael Ellerman <mpe@ellerman.id.au>
We call these functions with non-NULL mm or vma. Hence we can skip the NULL
check in these functions. We also remove now unused function
__local_flush_hugetlb_page().
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
---
arch/powerpc/include/asm/hugetlb.h | 6 ------
arch/powerpc/mm/tlb-radix.c | 18 ++++++++----------
2 files changed, 8 insertions(+), 16 deletions(-)
diff --git a/arch/powerpc/include/asm/hugetlb.h b/arch/powerpc/include/asm/hugetlb.h
index b8a0fb442c64..795d825c2edd 100644
--- a/arch/powerpc/include/asm/hugetlb.h
+++ b/arch/powerpc/include/asm/hugetlb.h
@@ -40,12 +40,6 @@ static inline void flush_hugetlb_page(struct vm_area_struct *vma,
return radix__flush_hugetlb_page(vma, vmaddr);
}
-static inline void __local_flush_hugetlb_page(struct vm_area_struct *vma,
- unsigned long vmaddr)
-{
- if (radix_enabled())
- return radix__local_flush_hugetlb_page(vma, vmaddr);
-}
#else
static inline pte_t *hugepd_page(hugepd_t hpd)
diff --git a/arch/powerpc/mm/tlb-radix.c b/arch/powerpc/mm/tlb-radix.c
index 191cc5abc940..98fdf2243d35 100644
--- a/arch/powerpc/mm/tlb-radix.c
+++ b/arch/powerpc/mm/tlb-radix.c
@@ -164,7 +164,7 @@ void radix__local_flush_tlb_page_psize(struct mm_struct *mm, unsigned long vmadd
unsigned long ap = mmu_get_ap(psize);
preempt_disable();
- pid = mm ? mm->context.id : 0;
+ pid = mm->context.id;
if (pid != MMU_NO_CONTEXT)
_tlbiel_va(vmaddr, pid, ap, RIC_FLUSH_TLB);
preempt_enable();
@@ -175,10 +175,9 @@ void radix__local_flush_tlb_page(struct vm_area_struct *vma, unsigned long vmadd
#ifdef CONFIG_HUGETLB_PAGE
/* need the return fix for nohash.c */
if (vma && is_vm_hugetlb_page(vma))
- return __local_flush_hugetlb_page(vma, vmaddr);
+ return radix__local_flush_hugetlb_page(vma, vmaddr);
#endif
- radix__local_flush_tlb_page_psize(vma ? vma->vm_mm : NULL, vmaddr,
- mmu_virtual_psize);
+ radix__local_flush_tlb_page_psize(vma->vm_mm, vmaddr, mmu_virtual_psize);
}
EXPORT_SYMBOL(radix__local_flush_tlb_page);
@@ -232,7 +231,7 @@ void radix__flush_tlb_page_psize(struct mm_struct *mm, unsigned long vmaddr,
unsigned long ap = mmu_get_ap(psize);
preempt_disable();
- pid = mm ? mm->context.id : 0;
+ pid = mm->context.id;
if (unlikely(pid == MMU_NO_CONTEXT))
goto bail;
if (!mm_is_thread_local(mm))
@@ -247,10 +246,9 @@ void radix__flush_tlb_page(struct vm_area_struct *vma, unsigned long vmaddr)
{
#ifdef CONFIG_HUGETLB_PAGE
if (vma && is_vm_hugetlb_page(vma))
- return flush_hugetlb_page(vma, vmaddr);
+ return radix__flush_hugetlb_page(vma, vmaddr);
#endif
- radix__flush_tlb_page_psize(vma ? vma->vm_mm : NULL, vmaddr,
- mmu_virtual_psize);
+ radix__flush_tlb_page_psize(vma->vm_mm, vmaddr, mmu_virtual_psize);
}
EXPORT_SYMBOL(radix__flush_tlb_page);
@@ -330,7 +328,7 @@ void radix__flush_tlb_range_psize(struct mm_struct *mm, unsigned long start,
preempt_disable();
- pid = mm ? mm->context.id : 0;
+ pid = mm->context.id;
if (unlikely(pid == MMU_NO_CONTEXT))
goto err_out;
@@ -361,7 +359,7 @@ void radix__flush_tlb_collapsed_pmd(struct mm_struct *mm, unsigned long addr)
unsigned long pid, end;
- pid = mm ? mm->context.id : 0;
+ pid = mm->context.id;
if (unlikely(pid == MMU_NO_CONTEXT))
goto no_context;
--
2.13.6
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] powerpc/mm/radix: Drop unneeded NULL check
2017-10-16 7:11 [PATCH] powerpc/mm/radix: Drop unneeded NULL check Aneesh Kumar K.V
@ 2017-10-17 11:54 ` Nicholas Piggin
2017-10-18 2:45 ` Aneesh Kumar K.V
2017-10-24 8:08 ` Michael Ellerman
1 sibling, 1 reply; 4+ messages in thread
From: Nicholas Piggin @ 2017-10-17 11:54 UTC (permalink / raw)
To: Aneesh Kumar K.V; +Cc: benh, paulus, mpe, linuxppc-dev
On Mon, 16 Oct 2017 12:41:00 +0530
"Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com> wrote:
> @@ -175,10 +175,9 @@ void radix__local_flush_tlb_page(struct vm_area_struct *vma, unsigned long vmadd
> #ifdef CONFIG_HUGETLB_PAGE
> /* need the return fix for nohash.c */
> if (vma && is_vm_hugetlb_page(vma))
> - return __local_flush_hugetlb_page(vma, vmaddr);
> + return radix__local_flush_hugetlb_page(vma, vmaddr);
> #endif
> - radix__local_flush_tlb_page_psize(vma ? vma->vm_mm : NULL, vmaddr,
> - mmu_virtual_psize);
> + radix__local_flush_tlb_page_psize(vma->vm_mm, vmaddr, mmu_virtual_psize);
> }
> EXPORT_SYMBOL(radix__local_flush_tlb_page);
>
Missed the other NULL pointer check in this hunk.
> @@ -247,10 +246,9 @@ void radix__flush_tlb_page(struct vm_area_struct *vma, unsigned long vmaddr)
> {
> #ifdef CONFIG_HUGETLB_PAGE
> if (vma && is_vm_hugetlb_page(vma))
> - return flush_hugetlb_page(vma, vmaddr);
> + return radix__flush_hugetlb_page(vma, vmaddr);
> #endif
> - radix__flush_tlb_page_psize(vma ? vma->vm_mm : NULL, vmaddr,
> - mmu_virtual_psize);
> + radix__flush_tlb_page_psize(vma->vm_mm, vmaddr, mmu_virtual_psize);
> }
> EXPORT_SYMBOL(radix__flush_tlb_page);
>
And another one.
Thanks,
Nick
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] powerpc/mm/radix: Drop unneeded NULL check
2017-10-17 11:54 ` Nicholas Piggin
@ 2017-10-18 2:45 ` Aneesh Kumar K.V
0 siblings, 0 replies; 4+ messages in thread
From: Aneesh Kumar K.V @ 2017-10-18 2:45 UTC (permalink / raw)
To: Nicholas Piggin; +Cc: benh, paulus, mpe, linuxppc-dev
On 10/17/2017 05:24 PM, Nicholas Piggin wrote:
> On Mon, 16 Oct 2017 12:41:00 +0530
> "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com> wrote:
>
>> @@ -175,10 +175,9 @@ void radix__local_flush_tlb_page(struct vm_area_struct *vma, unsigned long vmadd
>> #ifdef CONFIG_HUGETLB_PAGE
>> /* need the return fix for nohash.c */
>> if (vma && is_vm_hugetlb_page(vma))
>> - return __local_flush_hugetlb_page(vma, vmaddr);
>> + return radix__local_flush_hugetlb_page(vma, vmaddr);
>> #endif
>> - radix__local_flush_tlb_page_psize(vma ? vma->vm_mm : NULL, vmaddr,
>> - mmu_virtual_psize);
>> + radix__local_flush_tlb_page_psize(vma->vm_mm, vmaddr, mmu_virtual_psize);
>> }
>> EXPORT_SYMBOL(radix__local_flush_tlb_page);
>>
>
> Missed the other NULL pointer check in this hunk.
>
>> @@ -247,10 +246,9 @@ void radix__flush_tlb_page(struct vm_area_struct *vma, unsigned long vmaddr)
>> {
>> #ifdef CONFIG_HUGETLB_PAGE
>> if (vma && is_vm_hugetlb_page(vma))
>> - return flush_hugetlb_page(vma, vmaddr);
>> + return radix__flush_hugetlb_page(vma, vmaddr);
>> #endif
>> - radix__flush_tlb_page_psize(vma ? vma->vm_mm : NULL, vmaddr,
>> - mmu_virtual_psize);
>> + radix__flush_tlb_page_psize(vma->vm_mm, vmaddr, mmu_virtual_psize);
>> }
>> EXPORT_SYMBOL(radix__flush_tlb_page);
>>
>
> And another one.
>
Didn't get that. We should not find vma NULL here. Hence i removed that
vma == NULL check. Are you suggesting that this is not correct?
-aneesh
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: powerpc/mm/radix: Drop unneeded NULL check
2017-10-16 7:11 [PATCH] powerpc/mm/radix: Drop unneeded NULL check Aneesh Kumar K.V
2017-10-17 11:54 ` Nicholas Piggin
@ 2017-10-24 8:08 ` Michael Ellerman
1 sibling, 0 replies; 4+ messages in thread
From: Michael Ellerman @ 2017-10-24 8:08 UTC (permalink / raw)
To: Aneesh Kumar K.V, benh, paulus; +Cc: linuxppc-dev, Aneesh Kumar K . V
On Mon, 2017-10-16 at 07:11:00 UTC, "Aneesh Kumar K.V" wrote:
> From: Michael Ellerman <mpe@ellerman.id.au>
>
> We call these functions with non-NULL mm or vma. Hence we can skip the NULL
> check in these functions. We also remove now unused function
> __local_flush_hugetlb_page().
>
> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/6773027205ea4ccf17055d7f0a0cd8
cheers
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-10-24 8:08 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-16 7:11 [PATCH] powerpc/mm/radix: Drop unneeded NULL check Aneesh Kumar K.V
2017-10-17 11:54 ` Nicholas Piggin
2017-10-18 2:45 ` Aneesh Kumar K.V
2017-10-24 8:08 ` Michael Ellerman
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.