Patch "MIPS: add PMD table accounting into MIPS'pmd_alloc_one" has been added to the 5.4-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    MIPS: add PMD table accounting into MIPS'pmd_alloc_one

to the 5.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     mips-add-pmd-table-accounting-into-mips-pmd_alloc_on.patch
and it can be found in the queue-5.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit c9a1df0784eeef4a1f74588b00b4c8ac5bd0468d
Author: Huang Pei <huangpei@xxxxxxxxxxx>
Date:   Fri Jun 11 15:09:46 2021 +0800

    MIPS: add PMD table accounting into MIPS'pmd_alloc_one
    
    [ Upstream commit ed914d48b6a1040d1039d371b56273d422c0081e ]
    
    This fixes Page Table accounting bug.
    
    MIPS is the ONLY arch just defining __HAVE_ARCH_PMD_ALLOC_ONE alone.
    Since commit b2b29d6d011944 (mm: account PMD tables like PTE tables),
    "pmd_free" in asm-generic with PMD table accounting and "pmd_alloc_one"
    in MIPS without PMD table accounting causes PageTable accounting number
    negative, which read by global_zone_page_state(), always returns 0.
    
    Signed-off-by: Huang Pei <huangpei@xxxxxxxxxxx>
    Signed-off-by: Thomas Bogendoerfer <tsbogend@xxxxxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/arch/mips/include/asm/pgalloc.h b/arch/mips/include/asm/pgalloc.h
index 166842337eb2..dd10854321ca 100644
--- a/arch/mips/include/asm/pgalloc.h
+++ b/arch/mips/include/asm/pgalloc.h
@@ -62,11 +62,15 @@ do {							\
 
 static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address)
 {
-	pmd_t *pmd;
+	pmd_t *pmd = NULL;
+	struct page *pg;
 
-	pmd = (pmd_t *) __get_free_pages(GFP_KERNEL, PMD_ORDER);
-	if (pmd)
+	pg = alloc_pages(GFP_KERNEL | __GFP_ACCOUNT, PMD_ORDER);
+	if (pg) {
+		pgtable_pmd_page_ctor(pg);
+		pmd = (pmd_t *)page_address(pg);
 		pmd_init((unsigned long)pmd, (unsigned long)invalid_pte_table);
+	}
 	return pmd;
 }
 



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux