Re: [-rc7 regression] Buggy commit: "mm: use aligned zone start forpfn_to_bitidx calculation"

From: Yinghai Lu
Date: Sat Feb 16 2013 - 14:38:42 EST


On Sat, Feb 16, 2013 at 10:26 AM, Linus Torvalds
<torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:
> On Fri, Feb 15, 2013 at 3:44 AM, Ingo Molnar <mingo@xxxxxxxxxx> wrote:
>>>
>>> c060f943d092 may be related as you config does not have
>>> CONFIG_SPARSEMEM defined.
>>
>> Right, that's the commit causing the x86 regression:
>>
>> c060f943d0929f3e429c5d9522290584f6281d6e is the first bad commit
>> commit c060f943d0929f3e429c5d9522290584f6281d6e
>> Date: Fri Jan 11 14:31:51 2013 -0800
>>
>> mm: use aligned zone start for pfn_to_bitidx calculation
>
> Ok, looking more at this, I don't really want to revert it, and I have
> an idea of what is wrong.
>
> When we allocate the zone use bitmap, we do not take the
> zone_start_pfn into account. So I *think* that what happens is that
> "pfn_to_bitidx()" simply overruns the allocation for unaligned zonesm
> and the spinlock just happens to be right after (or the overrun causes
> some other memory corruption that then indirectly causes the spinlock
> corruption).
>
> So I'm wondering if the fix is simply something like the attached
> patch. It takes the zone_start_pfn into account when allocating the
> zone bitmap.

Yes, that is right fix.

but you forgot to update setup_usemap() for SPARSEMEM

static inline void setup_usemap(struct pglist_data *pgdat,
struct zone *zone, unsigned long zonesize) {}

Thanks

Yinghai
--
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/