Subject: Re: Error in frreing hugepages with preemption enabled

From: Benjamin Herrenschmidt <[email-masked]>
Date: Wed, 04 Dec 2013 13:22:02 +1100

On Tue, 2013-12-03 at 23:21 +0100, Andrea Arcangeli wrote:
> #ifdef CONFIG_PPC_FSL_BOOK3E
>         hugepd_free(tlb, hugepte);
         ^^^^^^^^^^^^^^^^^^^^^^^^^^

This is the culprit

(Alex, you didn't specify this was embedded or did I miss it ?)

> #else
>         pgtable_free_tlb(tlb, hugepte, pdshift - shift);
> #endif
> }

That function does:

	batchp = &__get_cpu_var(hugepd_freelist_cur);

IE, it tries to use a per-CPU batch. Basically, it's duplicating the
logic in mm/memory.c for RCU freeing using a per-cpu freelist. I suppose
it assumes being called under something like the page table lock ?

This code also never "flushes" the batch, which is a concern...

Alex, this is Freescale stuff, can you followup with them ?

Cheers,
Ben.