From: Balbir Singh <bsingharora@gmail.com>
To: mpe@ellerman.id.au
Cc: aneesh.kumar@linux.vnet.ibm.com, linuxppc-dev@lists.ozlabs.org,
Balbir Singh <bsingharora@gmail.com>
Subject: [PATCH 2/2] Deduplicate the actual base page size code
Date: Wed, 11 May 2016 00:57:42 +1000 [thread overview]
Message-ID: <1462892262-18066-3-git-send-email-bsingharora@gmail.com> (raw)
In-Reply-To: <1462892262-18066-1-git-send-email-bsingharora@gmail.com>
Deduplicate to one function to compute the actual page size.
Some additional warnings added for AP size as well.
Signed-off-by: Balbir Singh <bsingharora@gmail.com>
---
arch/powerpc/mm/hugetlbpage-radix.c | 31 ++++++++++++++++---------------
1 file changed, 16 insertions(+), 15 deletions(-)
diff --git a/arch/powerpc/mm/hugetlbpage-radix.c b/arch/powerpc/mm/hugetlbpage-radix.c
index 1e11559..9108645 100644
--- a/arch/powerpc/mm/hugetlbpage-radix.c
+++ b/arch/powerpc/mm/hugetlbpage-radix.c
@@ -6,7 +6,8 @@
#include <asm/machdep.h>
#include <asm/mman.h>
-void radix__flush_hugetlb_page(struct vm_area_struct *vma, unsigned long vmaddr)
+static inline unsigned long get_base_page_size(struct vm_area_struct *vma,
+ unsigned long vmaddr)
{
unsigned long ap, shift;
struct hstate *hstate = hstate_file(vma->vm_file);
@@ -18,25 +19,25 @@ void radix__flush_hugetlb_page(struct vm_area_struct *vma, unsigned long vmaddr)
ap = mmu_get_ap(MMU_PAGE_1G);
else {
WARN(1, "Wrong huge page shift\n");
- return ;
+ return 0;
}
- radix___flush_tlb_page(vma->vm_mm, vmaddr, ap, 0);
+#ifdef CONFIG_DEBUG_VM
+ /* Double check this assumption */
+ WARN_ON(ap != 0 && ap != 0x5);
+#endif
+ return ap;
}
-void radix__local_flush_hugetlb_page(struct vm_area_struct *vma, unsigned long vmaddr)
+void radix__flush_hugetlb_page(struct vm_area_struct *vma, unsigned long vmaddr)
{
- unsigned long ap, shift;
- struct hstate *hstate = hstate_file(vma->vm_file);
+ unsigned long ap = get_base_page_size(vma, vmaddr);
+ radix___flush_tlb_page(vma->vm_mm, vmaddr, ap, 0);
+}
- shift = huge_page_shift(hstate);
- if (shift == mmu_psize_defs[MMU_PAGE_2M].shift)
- ap = mmu_get_ap(MMU_PAGE_2M);
- else if (shift == mmu_psize_defs[MMU_PAGE_1G].shift)
- ap = mmu_get_ap(MMU_PAGE_1G);
- else {
- WARN(1, "Wrong huge page shift\n");
- return ;
- }
+void radix__local_flush_hugetlb_page(struct vm_area_struct *vma,
+ unsigned long vmaddr)
+{
+ unsigned long ap = get_base_page_size(vma, vmaddr);
radix___local_flush_tlb_page(vma->vm_mm, vmaddr, ap, 0);
}
--
2.5.5
next prev parent reply other threads:[~2016-05-10 14:58 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-10 14:57 [v1] Basic Radix Tree cleanups Balbir Singh
2016-05-10 14:57 ` [PATCH 1/2] Fix .long's in mm/tlb-radix.c to more meaningful Balbir Singh
2016-05-10 18:12 ` Aneesh Kumar K.V
2016-05-10 14:57 ` Balbir Singh [this message]
2016-05-10 18:09 ` [PATCH 2/2] Deduplicate the actual base page size code Aneesh Kumar K.V
2016-05-11 1:18 ` Balbir Singh
2016-05-11 1:45 ` Aneesh Kumar K.V
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1462892262-18066-3-git-send-email-bsingharora@gmail.com \
--to=bsingharora@gmail.com \
--cc=aneesh.kumar@linux.vnet.ibm.com \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).