[RFC/PATCH 2/7] ARM: ARM11 MPCore: pte_alloc_one{,_kernel} are not preempt safe
Russell King - ARM Linux
linux at arm.linux.org.uk
Fri Oct 7 03:47:07 EDT 2011
On Thu, Oct 06, 2011 at 10:38:36PM -0400, gdavis at mvista.com wrote:
> -#define PGALLOC_GFP (GFP_KERNEL | __GFP_NOTRACK | __GFP_REPEAT | __GFP_ZERO)
> +#define PGALLOC_GFP (GFP_KERNEL | __GFP_NOTRACK | __GFP_REPEAT)
> @@ -81,8 +88,14 @@ pte_alloc_one(struct mm_struct *mm, unsigned long addr)
> pte = alloc_pages(PGALLOC_GFP, 0);
> #endif
> if (pte) {
> + void *p = page_address(pte);
> + if (cache_ops_need_broadcast())
> + preempt_disable();
> + memset(p, 0, PAGE_SIZE);
> if (!PageHighMem(pte))
> - clean_pte_table(page_address(pte));
> + clean_pte_table(p);
> + if (cache_ops_need_broadcast())
> + preempt_enable();
This won't work - page_address(pte) will be NULL for highmem pages, and
so will cause an oops, and removing the __GFP_ZERO will mean that highmem
pages will not be zeroed, meaning that such page tables will not have been
initialized.
More information about the linux-arm-kernel
mailing list