Skip to content

Commit

Permalink
parisc: mm: don't count preallocated pmds
Browse files Browse the repository at this point in the history
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 <[email protected]>
Acked-by: Kirill A. Shutemov <[email protected]>
Signed-off-by: Helge Deller <[email protected]>
  • Loading branch information
Mikulas Patocka authored and hdeller committed Mar 23, 2015
1 parent 47514da commit 0e0da48
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions arch/parisc/include/asm/pgalloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,13 @@ static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd)
{
#ifdef CONFIG_64BIT
if(pmd_flag(*pmd) & PxD_FLAG_ATTACHED)
/* This is the permanent pmd attached to the pgd;
* cannot free it */
/*
* This is the permanent pmd attached to the pgd;
* cannot free it.
* Increment the counter to compensate for the decrement
* done by generic mm code.
*/
mm_inc_nr_pmds(mm);
return;
#endif
free_pages((unsigned long)pmd, PMD_ORDER);
Expand Down

0 comments on commit 0e0da48

Please sign in to comment.