linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC 1/9] mm/hugetlb: Make GENERAL_HUGETLB functions PGD implementation aware
@ 2016-03-09 12:10 Anshuman Khandual
  2016-03-09 12:10 ` [RFC 2/9] mm/hugetlb: Add follow_huge_pgd function Anshuman Khandual
                   ` (8 more replies)
  0 siblings, 9 replies; 22+ messages in thread
From: Anshuman Khandual @ 2016-03-09 12:10 UTC (permalink / raw)
  To: linux-mm, linux-kernel, linuxppc-dev
  Cc: hughd, kirill, n-horiguchi, akpm, mgorman, aneesh.kumar, mpe

Currently both the ARCH_WANT_GENERAL_HUGETLB functions 'huge_pte_alloc'
and 'huge_pte_offset' dont take into account huge page implementation
at the PGD level. With addition of PGD awareness into these functions,
more architectures like POWER which also implements huge pages at PGD
level (along with PMD level), can use ARCH_WANT_GENERAL_HUGETLB option.

Signed-off-by: Anshuman Khandual <khandual@linux.vnet.ibm.com>
---
 mm/hugetlb.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 01f2b48..a478b7b 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -4251,6 +4251,11 @@ pte_t *huge_pte_alloc(struct mm_struct *mm,
 	pte_t *pte = NULL;
 
 	pgd = pgd_offset(mm, addr);
+	if (sz == PGDIR_SIZE) {
+		pte = (pte_t *)pgd;
+		goto huge_pgd;
+	}
+
 	pud = pud_alloc(mm, pgd, addr);
 	if (pud) {
 		if (sz == PUD_SIZE) {
@@ -4263,6 +4268,8 @@ pte_t *huge_pte_alloc(struct mm_struct *mm,
 				pte = (pte_t *)pmd_alloc(mm, pud, addr);
 		}
 	}
+
+huge_pgd:
 	BUG_ON(pte && !pte_none(*pte) && !pte_huge(*pte));
 
 	return pte;
@@ -4276,6 +4283,8 @@ pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr)
 
 	pgd = pgd_offset(mm, addr);
 	if (pgd_present(*pgd)) {
+		if (pgd_huge(*pgd))
+			return (pte_t *)pgd;
 		pud = pud_offset(pgd, addr);
 		if (pud_present(*pud)) {
 			if (pud_huge(*pud))
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2016-03-21  9:55 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-09 12:10 [RFC 1/9] mm/hugetlb: Make GENERAL_HUGETLB functions PGD implementation aware Anshuman Khandual
2016-03-09 12:10 ` [RFC 2/9] mm/hugetlb: Add follow_huge_pgd function Anshuman Khandual
2016-03-11  3:02   ` Anshuman Khandual
2016-03-09 12:10 ` [RFC 3/9] mm/gup: Make follow_page_mask function PGD implementation aware Anshuman Khandual
2016-03-11  3:03   ` Anshuman Khandual
2016-03-09 12:10 ` [RFC 4/9] powerpc/mm: Split huge_pte_alloc function for BOOK3S 64K Anshuman Khandual
2016-03-09 19:55   ` Aneesh Kumar K.V
2016-03-10  5:33     ` Anshuman Khandual
2016-03-09 12:10 ` [RFC 5/9] powerpc/mm: Split huge_pte_offset " Anshuman Khandual
2016-03-09 22:57   ` Dave Hansen
2016-03-10  3:37     ` Anshuman Khandual
2016-03-09 12:10 ` [RFC 6/9] powerpc/hugetlb: Enable ARCH_WANT_GENERAL_HUGETLB " Anshuman Khandual
2016-03-09 19:58   ` Aneesh Kumar K.V
2016-03-10  5:12     ` Anshuman Khandual
2016-03-21  9:55   ` Rui Teng
2016-03-09 12:10 ` [RFC 7/9] powerpc/hugetlb: Change follow_huge_* routines " Anshuman Khandual
2016-03-09 12:10 ` [RFC 8/9] powerpc/mm: Enable HugeTLB page migration Anshuman Khandual
2016-03-09 12:10 ` [RFC 9/9] selfttest/powerpc: Add memory page migration tests Anshuman Khandual
2016-03-09 20:01   ` Aneesh Kumar K.V
2016-03-10  5:05     ` Anshuman Khandual
2016-03-11  3:01 ` [RFC 1/9] mm/hugetlb: Make GENERAL_HUGETLB functions PGD implementation aware Anshuman Khandual
2016-03-14 20:29   ` Andrew Morton

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).