linux-kernel-test/arch
Peter Zijlstra 42ef73fe13 x86, mm: fix pte_free()
On -rt we were seeing spurious bad page states like:

Bad page state in process 'firefox'
page:c1bc2380 flags:0x40000000 mapping:c1bc2390 mapcount:0 count:0
Trying to fix it up, but a reboot is needed
Backtrace:
Pid: 503, comm: firefox Not tainted 2.6.26.8-rt13 #3
[<c043d0f3>] ? printk+0x14/0x19
[<c0272d4e>] bad_page+0x4e/0x79
[<c0273831>] free_hot_cold_page+0x5b/0x1d3
[<c02739f6>] free_hot_page+0xf/0x11
[<c0273a18>] __free_pages+0x20/0x2b
[<c027d170>] __pte_alloc+0x87/0x91
[<c027d25e>] handle_mm_fault+0xe4/0x733
[<c043f680>] ? rt_mutex_down_read_trylock+0x57/0x63
[<c043f680>] ? rt_mutex_down_read_trylock+0x57/0x63
[<c0218875>] do_page_fault+0x36f/0x88a

This is the case where a concurrent fault already installed the PTE and
we get to free the newly allocated one.

This is due to pgtable_page_ctor() doing the spin_lock_init(&page->ptl)
which is overlaid with the {private, mapping} struct.

union {
    struct {
        unsigned long private;
        struct address_space *mapping;
    };
    spinlock_t ptl;
    struct kmem_cache *slab;
    struct page *first_page;
};

Normally the spinlock is small enough to not stomp on page->mapping, but
PREEMPT_RT=y has huge 'spin'locks.

But lockdep kernels should also be able to trigger this splat, as the
lock tracking code grows the spinlock to cover page->mapping.

The obvious fix is calling pgtable_page_dtor() like the regular pte free
path __pte_free_tlb() does.

It seems all architectures except x86 and nm10300 already do this, and
nm10300 doesn't seem to use pgtable_page_ctor(), which suggests it
doesn't do SMP or simply doesnt do MMU at all or something.

Signed-off-by: Peter Zijlstra <a.p.zijlsta@chello.nl>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Cc: <stable@kernel.org>
2009-01-23 18:42:06 +01:00
..
alpha PCI: alpha: use generic INTx swizzle from PCI core 2009-01-07 11:13:13 -08:00
arm Merge git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-2.6-nommu 2009-01-09 14:00:58 -08:00
avr32 Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/djbw/async_tx 2009-01-09 11:52:14 -08:00
blackfin NOMMU: Make VMAs per MM as for MMU-mode linux 2009-01-08 12:04:47 +00:00
cris Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2009-01-07 11:31:52 -08:00
frv NOMMU: Make VMAs per MM as for MMU-mode linux 2009-01-08 12:04:47 +00:00
h8300 NOMMU: Make VMAs per MM as for MMU-mode linux 2009-01-08 12:04:47 +00:00
ia64 Merge branch 'cpus4096-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip 2009-01-10 06:12:18 -08:00
m32r Merge branch 'cpus4096-for-linus-3' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip 2009-01-03 12:04:39 -08:00
m68k trivial: fix an -> a typos in documentation and comments 2009-01-06 11:28:07 +01:00
m68knommu NOMMU: Make VMAs per MM as for MMU-mode linux 2009-01-08 12:04:47 +00:00
mips Merge branch 'linux-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6 2009-01-07 15:41:01 -08:00
mn10300 take init_fs to saner place 2008-12-31 18:07:42 -05:00
parisc parisc: introduce asm/swab.h 2009-01-09 12:46:23 -08:00
powerpc Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rric/oprofile 2009-01-09 12:43:06 -08:00
s390 [S390] Use unsigned long long for u64 on 64bit. 2009-01-09 12:15:07 +01:00
sh NOMMU: Make VMAs per MM as for MMU-mode linux 2009-01-08 12:04:47 +00:00
sparc generic swap(): sparc: rename swap() to swap_ulong() 2009-01-08 08:31:14 -08:00
um mm: invoke oom-killer from page fault 2009-01-06 15:58:58 -08:00
x86 x86, mm: fix pte_free() 2009-01-23 18:42:06 +01:00
xtensa xtensa: introduce swab.h 2009-01-07 12:22:04 -08:00
.gitignore
Kconfig