Skip to content

Commit 0e0da48

Browse files
Mikulas Patockahdeller
authored andcommitted
parisc: mm: don't count preallocated pmds
The patch dc6c9a3 that counts pmds allocated for a process introduced a bug on 64-bit PA-RISC kernels. The PA-RISC architecture preallocates one pmd with each pgd. This preallocated pmd can never be freed - pmd_free does nothing when it is called with this pmd. When the kernel attempts to free this preallocated pmd, it decreases the count of allocated pmds. The result is that the counter underflows and this error is reported. This patch fixes the bug by artifically incrementing the counter in pmd_free when the kernel tries to free the preallocated pmd. Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Signed-off-by: Helge Deller <deller@gmx.de>
1 parent 47514da commit 0e0da48

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

arch/parisc/include/asm/pgalloc.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,13 @@ static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd)
7474
{
7575
#ifdef CONFIG_64BIT
7676
if(pmd_flag(*pmd) & PxD_FLAG_ATTACHED)
77-
/* This is the permanent pmd attached to the pgd;
78-
* cannot free it */
77+
/*
78+
* This is the permanent pmd attached to the pgd;
79+
* cannot free it.
80+
* Increment the counter to compensate for the decrement
81+
* done by generic mm code.
82+
*/
83+
mm_inc_nr_pmds(mm);
7984
return;
8085
#endif
8186
free_pages((unsigned long)pmd, PMD_ORDER);

0 commit comments

Comments
 (0)