diff mbox

BUG: non-zero nr_pmds on freeing mm: -1

Message ID 20150312220756.GA4792@node.dhcp.inet.fi (mailing list archive)
State Superseded
Headers show

Commit Message

Kirill A. Shutemov March 12, 2015, 10:07 p.m. UTC
On Thu, Mar 12, 2015 at 03:51:11PM -0400, John David Anglin wrote:
> On 2015-03-12 3:35 PM, Aaro Koskinen wrote:
> >Hi,
> >
> >On Wed, Mar 11, 2015 at 08:21:35PM -0400, John David Anglin wrote:
> >>On 2015-03-11, at 7:31 PM, Graham Gower wrote:
> >>>I thought this patch was supposed to address the problem?
> >>>https://lkml.org/lkml/2015/2/26/230
> >>>
> >>>However, its not fixed it for me either in 4.0.0-rc3.
> >>I doubt the patch is correct for parisc. I believe the system where
> >>I saw the BUG messages has PT_NLEVELS == 3.
> >For 32-bit kernels, the fix helped.
> 32-bit kernels have PT_NLEVELS == 2.  I think the define needs to be moved
> outside #if/#endif
> but didn't get a chance to test last night.

There's hack in pgd_alloc() on parisc to initialize one pmd, which is not
accounted and we get underflow on exit. We need to adjust accounting for
that pmd.

Could you try the patch below?

Comments

Kirill A. Shutemov March 13, 2015, 10:29 a.m. UTC | #1
On Thu, Mar 12, 2015 at 08:41:37PM -0400, John David Anglin wrote:
> On 2015-03-12, at 6:07 PM, Kirill A. Shutemov wrote:
> 
> > There's hack in pgd_alloc() on parisc to initialize one pmd, which is not
> > accounted and we get underflow on exit. We need to adjust accounting for
> > that pmd.
> > 
> > Could you try the patch below?
> > 
> > diff --git a/arch/parisc/include/asm/pgalloc.h b/arch/parisc/include/asm/pgalloc.h
> > index f213f5b4c423..8ee9a0bdc468 100644
> > --- a/arch/parisc/include/asm/pgalloc.h
> > +++ b/arch/parisc/include/asm/pgalloc.h
> > @@ -38,6 +38,7 @@ static inline pgd_t *pgd_alloc(struct mm_struct *mm)
> > 		/* The first pmd entry also is marked with _PAGE_GATEWAY as
> > 		 * a signal that this pmd may not be freed */
> > 		__pgd_val_set(*pgd, PxD_FLAG_ATTACHED);
> > +		mm_inc_nr_pmds(mm);
> > #endif
> > 	}
> > 	return actual_pgd;
> 
> The patch fixes the BUG messages.
> 
> Helge, the #ifdef in pgd_alloc doesn't seem correct.  We only have a L2/L3 scheme when
> "defined(CONFIG_64BIT) && defined(CONFIG_PARISC_PAGE_SIZE_4KB)".

Looks like you're correct. But that's separate issue. Please, post a
patch.
diff mbox

Patch

diff --git a/arch/parisc/include/asm/pgalloc.h b/arch/parisc/include/asm/pgalloc.h
index f213f5b4c423..8ee9a0bdc468 100644
--- a/arch/parisc/include/asm/pgalloc.h
+++ b/arch/parisc/include/asm/pgalloc.h
@@ -38,6 +38,7 @@  static inline pgd_t *pgd_alloc(struct mm_struct *mm)
 		/* The first pmd entry also is marked with _PAGE_GATEWAY as
 		 * a signal that this pmd may not be freed */
 		__pgd_val_set(*pgd, PxD_FLAG_ATTACHED);
+		mm_inc_nr_pmds(mm);
 #endif
 	}
 	return actual_pgd;