Re: [PATCH] x86/mm/init: respect memblock reserved regions whendestroying mappings

From: Stefano Stabellini
Date: Mon Feb 07 2011 - 11:00:58 EST


On Sat, 5 Feb 2011, Jeremy Fitzhardinge wrote:
> > pud = pud_offset(pgd_offset_k(_brk_end), _brk_end);
> > pmd = pmd_offset(pud, _brk_end - 1);
> > - while (++pmd <= pmd_offset(pud, (unsigned long)_end - 1))
> > - pmd_clear(pmd);
> > + addr = (_brk_end + PMD_SIZE - 1) & PMD_MASK;
>
> I guess its OK if this is >_end, because the pmd offset will be greater
> than _end's. But is there an edge condition if the pmd_offset goes off
> the end of the pud, and pud page itself happens to be at the end of the
> address space and it wraps?
>
> > + while (++pmd <= pmd_offset(pud, (unsigned long)_end - 1)) {
> Could _end be in a different pud from _brk_end? Could this walk off the
> pud page?
>
> Or is it moot, and there's a guarantee that the whole space is mapped
> out of the same pud page? I guess the original code has the same
> concern, so this patch leaves the status quo unchanged.
>

Indeed. I had this doubt myself, but I thought there must have been a
smart reason why _brk_end and _end must be on the same pud, so I left it
unchanged.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/