Re: [PATCH] mm: don't count preallocated pmds

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

 




On Wed, 18 Mar 2015, Kirill A. Shutemov wrote:

> On Wed, Mar 18, 2015 at 11:16:42AM -0400, Mikulas Patocka wrote:
> > Hi
> > 
> > Here I'm sending a patch that fixes numerous "BUG: non-zero nr_pmds on 
> > freeing mm: -1" errors on 64-bit PA-RISC kernel.
> > 
> > I think the patch posted here 
> > http://www.spinics.net/lists/linux-parisc/msg05981.html is incorrect, it 
> > wouldn't work if the affected address range is freed and allocated 
> > multiple times.
> > 	- 1. alloc pgd with built-in pmd, the count of pmds is 1
> > 	- 2. free the range covered by the built-in pmd, the count of pmds 
> > 		is 0, but the built-in pmd is still present
> 
> Hm. Okay. I didn't realize you have special case in pmd_clear() for these
> pmds.
> 
> What about adding mm_inc_nr_pmds() in pmd_clear() for PxD_FLAG_ATTACHED
> to compensate mm_dec_nr_pmds() in free_pmd_range()?

pmd_clear clears one entry in the pmd, it wouldn't work. You need to add 
it to pgd_clear. That clears the pointer to the pmd (and does nothing if 
it is asked to clear the pointer to the preallocated pmd). But pgd_clear 
doesn't receive the pointer to mm.

> I don't like pmd_preallocated() in generic code. It's too specific to
> parisc.

The question is if it is better to use pmd_preallocated, or pass the 
pointer to the mm to pgd_clear (that would affect all architectures).

Mikulas

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]