Merge commit 'linus/master' into HEAD
authorVegard Nossum <vegard.nossum@gmail.com>
Mon, 15 Jun 2009 13:50:49 +0000 (15:50 +0200)
committerVegard Nossum <vegard.nossum@gmail.com>
Mon, 15 Jun 2009 13:50:49 +0000 (15:50 +0200)
Conflicts:
MAINTAINERS

Signed-off-by: Vegard Nossum <vegard.nossum@gmail.com>
1  2 
MAINTAINERS
arch/x86/Kconfig
arch/x86/kernel/traps.c
arch/x86/mm/init_32.c
include/linux/gfp.h
include/linux/interrupt.h
include/linux/slab.h
init/main.c
mm/slab.c
mm/slub.c

diff --combined MAINTAINERS
@@@ -681,6 -681,13 +681,13 @@@ M:       sakoman@gmail.co
  L:    linux-arm-kernel@lists.arm.linux.org.uk (subscribers-only)
  S:    Maintained
  
+ ARM/H4700 (HP IPAQ HX4700) MACHINE SUPPORT
+ P:    Philipp Zabel
+ M:    philipp.zabel@gmail.com
+ S:    Maintained
+ F:    arch/arm/mach-pxa/hx4700.c
+ F:    arch/arm/mach-pxa/include/mach/hx4700.h
  ARM/HP JORNADA 7XX MACHINE SUPPORT
  P:    Kristoffer Ericson
  M:    kristoffer.ericson@gmail.com
@@@ -2105,6 -2112,15 +2112,15 @@@ W:    http://sourceforge.net/projects/lpfc
  S:    Supported
  F:    drivers/scsi/lpfc/
  
+ ENE CB710 FLASH CARD READER DRIVER
+ P:    Michał Mirosław
+ M:    mirq-linux@rere.qmqm.pl
+ L:    linux-kernel@vger.kernel.org
+ S:    Maintained
+ F:    drivers/misc/cb710/
+ F:    drivers/mmc/host/cb710-mmc.*
+ F:    include/linux/cb710.h
  EPSON 1355 FRAMEBUFFER DRIVER
  P:    Christopher Hoover
  M:    ch@murgatroid.com
@@@ -2351,7 -2367,7 +2367,7 @@@ F:      fs/freevxfs
  
  FREEZER
  P:    Pavel Machek
- M:    pavel@suse.cz
+ M:    pavel@ucw.cz
  P:    Rafael J. Wysocki
  M:    rjw@sisk.pl
  L:    linux-pm@lists.linux-foundation.org
@@@ -3363,19 -3379,15 +3379,23 @@@ F:   drivers/serial/kgdboc.
  F:    include/linux/kgdb.h
  F:    kernel/kgdb.c
  
 +KMEMCHECK
 +P:    Vegard Nossum
 +M:    vegardno@ifi.uio.no
 +P     Pekka Enberg
 +M:    penberg@cs.helsinki.fi
 +L:    linux-kernel@vger.kernel.org
 +S:    Maintained
 +
  KMEMLEAK
  P:    Catalin Marinas
  M:    catalin.marinas@arm.com
  L:    linux-kernel@vger.kernel.org
  S:    Maintained
+ F:    Documentation/kmemleak.txt
+ F:    include/linux/kmemleak.h
+ F:    mm/kmemleak.c
+ F:    mm/kmemleak-test.c
  
  KMEMTRACE
  P:    Eduard - Gabriel Munteanu
@@@ -4163,6 -4175,69 +4183,69 @@@ S:    Maintaine
  F:    drivers/video/riva/
  F:    drivers/video/nvidia/
  
+ OMAP SUPPORT
+ P:    Tony Lindgren <tony@atomide.com>
+ M:    tony@atomide.com
+ L:    linux-omap@vger.kernel.org
+ W:    http://www.muru.com/linux/omap/
+ W:    http://linux.omap.com/
+ T:    git git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap-2.6.git
+ S:    Maintained
+ F:    arch/arm/*omap*
+ OMAP CLOCK FRAMEWORK SUPPORT
+ P:    Paul Walmsley
+ M:    paul@pwsan.com
+ L:    linux-omap@vger.kernel.org
+ S:    Maintained
+ F:    arch/arm/*omap*/*clock*
+ OMAP POWER MANAGEMENT SUPPORT
+ P:    Kevin Hilman
+ M:    khilman@deeprootsystems.com
+ L:    linux-omap@vger.kernel.org
+ S:    Maintained
+ F:    arch/arm/*omap*/*pm*
+ OMAP AUDIO SUPPORT
+ P:    Jarkko Nikula
+ M:    jhnikula@gmail.com
+ L:    alsa-devel@alsa-project.org (subscribers-only)
+ L:    linux-omap@vger.kernel.org
+ S:    Maintained
+ F:    sound/soc/omap/
+ OMAP FRAMEBUFFER SUPPORT
+ P:    Imre Deak
+ M:    imre.deak@nokia.com
+ L:    linux-fbdev-devel@lists.sourceforge.net (moderated for non-subscribers)
+ L:    linux-omap@vger.kernel.org
+ S:    Maintained
+ F:    drivers/video/omap/
+ OMAP MMC SUPPORT
+ P:    Jarkko Lavinen
+ M:    jarkko.lavinen@nokia.com
+ L:    linux-kernel@vger.kernel.org
+ L:    linux-omap@vger.kernel.org
+ S:    Maintained
+ F:    drivers/mmc/host/*omap*
+ OMAP RANDOM NUMBER GENERATOR SUPPORT
+ P:    Deepak Saxena
+ M:    dsaxena@plexity.net
+ S:    Maintained
+ F:    drivers/char/hw_random/omap-rng.c
+ OMAP USB SUPPORT
+ P:    Felipe Balbi
+ M:    felipe.balbi@nokia.com
+ P:    David Brownell
+ M:    dbrownell@users.sourceforge.net
+ L:    linux-usb@vger.kernel.org
+ L:    linux-omap@vger.kernel.org
+ S:    Maintained
  OMFS FILESYSTEM
  P:    Bob Copeland
  M:    me@bobcopeland.com
@@@ -4601,7 -4676,7 +4684,7 @@@ F:      drivers/media/video/pvrusb2
  
  PXA2xx/PXA3xx SUPPORT
  P:    Eric Miao
- M:    eric.miao@marvell.com
+ M:    eric.y.miao@gmail.com
  P:    Russell King
  M:    linux@arm.linux.org.uk
  L:    linux-arm-kernel@lists.arm.linux.org.uk (subscribers-only)
@@@ -4611,23 -4686,24 +4694,24 @@@ F:   drivers/pcmcia/pxa2xx
  F:    drivers/spi/pxa2xx*
  F:    drivers/usb/gadget/pxa2*
  F:    include/sound/pxa2xx-lib.h
- F:    sound/soc/pxa/pxa2xx*
+ F:    sound/arm/pxa*
+ F:    sound/soc/pxa
  
  PXA168 SUPPORT
  P:    Eric Miao
- M:    eric.miao@marvell.com
+ M:    eric.y.miao@gmail.com
  P:    Jason Chagas
  M:    jason.chagas@marvell.com
  L:    linux-arm-kernel@lists.arm.linux.org.uk (subscribers-only)
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/ycmiao/pxa-linux-2.6.git
- S:    Supported
+ S:    Maintained
  
  PXA910 SUPPORT
  P:    Eric Miao
- M:    eric.miao@marvell.com
+ M:    eric.y.miao@gmail.com
  L:    linux-arm-kernel@lists.arm.linux.org.uk (subscribers-only)
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/ycmiao/pxa-linux-2.6.git
- S:    Supported
+ S:    Maintained
  
  PXA MMCI DRIVER
  S:    Orphan
@@@ -5148,7 -5224,6 +5232,6 @@@ P:      Vincent Sander
  M:    support@simtec.co.uk
  W:    http://www.simtec.co.uk/products/EB110ATX/
  S:    Supported
- F:    arch/arm/mach-ebsa110/
  
  SIMTEC EB2410ITX (BAST)
  P:    Ben Dooks
@@@ -5339,11 -5414,12 +5422,12 @@@ P:   Liam Girdwoo
  M:    lrg@slimlogic.co.uk
  P:    Mark Brown
  M:    broonie@opensource.wolfsonmicro.com
- T:    git git://opensource.wolfsonmicro.com/linux-2.6-asoc
+ T:    git git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound-2.6.git
  L:    alsa-devel@alsa-project.org (subscribers-only)
  W:    http://alsa-project.org/main/index.php/ASoC
  S:    Supported
  F:    sound/soc/
+ F:    include/sound/soc*
  
  SPARC + UltraSPARC (sparc/sparc64)
  P:    David S. Miller
@@@ -5561,20 -5637,6 +5645,6 @@@ F:     drivers/misc/tifm
  F:    drivers/mmc/host/tifm_sd.c
  F:    include/linux/tifm.h
  
- TI OMAP MMC INTERFACE DRIVER
- P:    Carlos Aguiar, Anderson Briglia and Syed Khasim
- M:    linux-omap@vger.kernel.org
- W:    http://linux.omap.com
- W:    http://www.muru.com/linux/omap/
- S:    Maintained
- F:    drivers/mmc/host/omap.c
- TI OMAP RANDOM NUMBER GENERATOR SUPPORT
- P:    Deepak Saxena
- M:    dsaxena@plexity.net
- S:    Maintained
- F:    drivers/char/hw_random/omap-rng.c
  TIPC NETWORK LAYER
  P:    Per Liden
  M:    per.liden@ericsson.com
diff --combined arch/x86/Kconfig
@@@ -46,7 -46,6 +46,7 @@@ config X8
        select HAVE_KERNEL_GZIP
        select HAVE_KERNEL_BZIP2
        select HAVE_KERNEL_LZMA
 +      select HAVE_ARCH_KMEMCHECK
  
  config OUTPUT_FORMAT
        string
@@@ -790,10 -789,26 +790,26 @@@ config X86_MC
          to disable it.  MCE support simply ignores non-MCE processors like
          the 386 and 486, so nearly everyone can say Y here.
  
+ config X86_OLD_MCE
+       depends on X86_32 && X86_MCE
+       bool "Use legacy machine check code (will go away)"
+       default n
+       select X86_ANCIENT_MCE
+       ---help---
+         Use the old i386 machine check code. This is merely intended for
+         testing in a transition period. Try this if you run into any machine
+         check related software problems, but report the problem to
+         linux-kernel.  When in doubt say no.
+ config X86_NEW_MCE
+       depends on X86_MCE
+       bool
+       default y if (!X86_OLD_MCE && X86_32) || X86_64
  config X86_MCE_INTEL
        def_bool y
        prompt "Intel MCE features"
-       depends on X86_64 && X86_MCE && X86_LOCAL_APIC
+       depends on X86_NEW_MCE && X86_LOCAL_APIC
        ---help---
           Additional support for intel specific MCE features such as
           the thermal monitor.
  config X86_MCE_AMD
        def_bool y
        prompt "AMD MCE features"
-       depends on X86_64 && X86_MCE && X86_LOCAL_APIC
+       depends on X86_NEW_MCE && X86_LOCAL_APIC
        ---help---
           Additional support for AMD specific MCE features such as
           the DRAM Error Threshold.
  
+ config X86_ANCIENT_MCE
+       def_bool n
+       depends on X86_32
+       prompt "Support for old Pentium 5 / WinChip machine checks"
+       ---help---
+         Include support for machine check handling on old Pentium 5 or WinChip
+         systems. These typically need to be enabled explicitely on the command
+         line.
  config X86_MCE_THRESHOLD
        depends on X86_MCE_AMD || X86_MCE_INTEL
        bool
        default y
  
+ config X86_MCE_INJECT
+       depends on X86_NEW_MCE
+       tristate "Machine check injector support"
+       ---help---
+         Provide support for injecting machine checks for testing purposes.
+         If you don't know what a machine check is and you don't do kernel
+         QA it is safe to say n.
  config X86_MCE_NONFATAL
        tristate "Check for non-fatal errors on AMD Athlon/Duron / Intel Pentium 4"
-       depends on X86_32 && X86_MCE
+       depends on X86_OLD_MCE
        ---help---
          Enabling this feature starts a timer that triggers every 5 seconds which
          will look at the machine check registers to see if anything happened.
  
  config X86_MCE_P4THERMAL
        bool "check for P4 thermal throttling interrupt."
-       depends on X86_32 && X86_MCE && (X86_UP_APIC || SMP)
+       depends on X86_OLD_MCE && X86_MCE && (X86_UP_APIC || SMP)
        ---help---
          Enabling this feature will cause a message to be printed when the P4
          enters thermal throttling.
  
+ config X86_THERMAL_VECTOR
+       def_bool y
+       depends on X86_MCE_P4THERMAL || X86_MCE_INTEL
  config VM86
        bool "Enable VM86 support" if EMBEDDED
        default y
diff --combined arch/x86/kernel/traps.c
@@@ -45,7 -45,6 +45,7 @@@
  #include <linux/edac.h>
  #endif
  
 +#include <asm/kmemcheck.h>
  #include <asm/stacktrace.h>
  #include <asm/processor.h>
  #include <asm/debugreg.h>
@@@ -535,10 -534,6 +535,10 @@@ dotraplinkage void __kprobes do_debug(s
  
        get_debugreg(condition, 6);
  
 +      /* Catch kmemcheck conditions first of all! */
 +      if (condition & DR_STEP && kmemcheck_trap(regs))
 +              return;
 +
        /*
         * The processor cleared BTF, so don't mark that we need it set.
         */
@@@ -803,15 -798,15 +803,15 @@@ unsigned long patch_espfix_desc(unsigne
  
        return new_kesp;
  }
- #else
+ #endif
  asmlinkage void __attribute__((weak)) smp_thermal_interrupt(void)
  {
  }
  
- asmlinkage void __attribute__((weak)) mce_threshold_interrupt(void)
+ asmlinkage void __attribute__((weak)) smp_threshold_interrupt(void)
  {
  }
- #endif
  
  /*
   * 'math_state_restore()' saves the current math information in the
diff --combined arch/x86/mm/init_32.c
@@@ -111,7 -111,7 +111,7 @@@ static pte_t * __init one_page_table_in
                pte_t *page_table = NULL;
  
                if (after_bootmem) {
 -#ifdef CONFIG_DEBUG_PAGEALLOC
 +#if defined(CONFIG_DEBUG_PAGEALLOC) || defined(CONFIG_KMEMCHECK)
                        page_table = (pte_t *) alloc_bootmem_pages(PAGE_SIZE);
  #endif
                        if (!page_table)
@@@ -564,7 -564,7 +564,7 @@@ static inline void save_pg_dir(void
  }
  #endif /* !CONFIG_ACPI_SLEEP */
  
- void zap_low_mappings(void)
+ void zap_low_mappings(bool early)
  {
        int i;
  
                set_pgd(swapper_pg_dir+i, __pgd(0));
  #endif
        }
-       flush_tlb_all();
+       if (early)
+               __flush_tlb();
+       else
+               flush_tlb_all();
  }
  
  pteval_t __supported_pte_mask __read_mostly = ~(_PAGE_NX | _PAGE_GLOBAL | _PAGE_IOMAP);
@@@ -956,7 -960,7 +960,7 @@@ void __init mem_init(void
                test_wp_bit();
  
        save_pg_dir();
-       zap_low_mappings();
+       zap_low_mappings(true);
  }
  
  #ifdef CONFIG_MEMORY_HOTPLUG
diff --combined include/linux/gfp.h
@@@ -52,19 -52,7 +52,19 @@@ struct vm_area_struct
  #define __GFP_RECLAIMABLE ((__force gfp_t)0x80000u) /* Page is reclaimable */
  #define __GFP_MOVABLE ((__force gfp_t)0x100000u)  /* Page is movable */
  
 -#define __GFP_BITS_SHIFT 21   /* Room for 21 __GFP_FOO bits */
 +#ifdef CONFIG_KMEMCHECK
 +#define __GFP_NOTRACK ((__force gfp_t)0x200000u)  /* Don't track with kmemcheck */
 +#else
 +#define __GFP_NOTRACK ((__force gfp_t)0)
 +#endif
 +
 +/*
 + * This may seem redundant, but it's a way of annotating false positives vs.
 + * allocations that simply cannot be supported (e.g. page tables).
 + */
 +#define __GFP_NOTRACK_FALSE_POSITIVE (__GFP_NOTRACK)
 +
 +#define __GFP_BITS_SHIFT 22   /* Room for 22 __GFP_FOO bits */
  #define __GFP_BITS_MASK ((__force gfp_t)((1 << __GFP_BITS_SHIFT) - 1))
  
  /* This equals 0, but use constants in case they ever change */
@@@ -97,6 -85,9 +97,9 @@@
                        __GFP_NOWARN|__GFP_REPEAT|__GFP_NOFAIL|\
                        __GFP_NORETRY|__GFP_NOMEMALLOC)
  
+ /* Control slab gfp mask during early boot */
+ #define SLAB_GFP_BOOT_MASK __GFP_BITS_MASK & ~(__GFP_WAIT|__GFP_IO|__GFP_FS)
  /* Control allocation constraints */
  #define GFP_CONSTRAINT_MASK (__GFP_HARDWALL|__GFP_THISNODE)
  
@@@ -183,12 -183,18 +183,18 @@@ extern void disable_irq(unsigned int ir
  extern void enable_irq(unsigned int irq);
  
  /* The following three functions are for the core kernel use only. */
+ #ifdef CONFIG_GENERIC_HARDIRQS
  extern void suspend_device_irqs(void);
  extern void resume_device_irqs(void);
  #ifdef CONFIG_PM_SLEEP
  extern int check_wakeup_irqs(void);
  #else
  static inline int check_wakeup_irqs(void) { return 0; }
+ #endif
+ #else
+ static inline void suspend_device_irqs(void) { };
+ static inline void resume_device_irqs(void) { };
+ static inline int check_wakeup_irqs(void) { return 0; }
  #endif
  
  #if defined(CONFIG_SMP) && defined(CONFIG_GENERIC_HARDIRQS)
@@@ -466,20 -472,6 +472,20 @@@ static inline void tasklet_hi_schedule(
                __tasklet_hi_schedule(t);
  }
  
 +extern void __tasklet_hi_schedule_first(struct tasklet_struct *t);
 +
 +/*
 + * This version avoids touching any other tasklets. Needed for kmemcheck
 + * in order not to take any page faults while enqueueing this tasklet;
 + * consider VERY carefully whether you really need this or
 + * tasklet_hi_schedule()...
 + */
 +static inline void tasklet_hi_schedule_first(struct tasklet_struct *t)
 +{
 +      if (!test_and_set_bit(TASKLET_STATE_SCHED, &t->state))
 +              __tasklet_hi_schedule_first(t);
 +}
 +
  
  static inline void tasklet_disable_nosync(struct tasklet_struct *t)
  {
diff --combined include/linux/slab.h
  
  #define SLAB_NOLEAKTRACE      0x00800000UL    /* Avoid kmemleak tracing */
  
 +/* Don't track use of uninitialized memory */
 +#ifdef CONFIG_KMEMCHECK
 +# define SLAB_NOTRACK         0x01000000UL
 +#else
 +# define SLAB_NOTRACK         0x00000000UL
 +#endif
 +
  /* The following flags affect the page allocator grouping pages by mobility */
  #define SLAB_RECLAIM_ACCOUNT  0x00020000UL            /* Objects are reclaimable */
  #define SLAB_TEMPORARY                SLAB_RECLAIM_ACCOUNT    /* Objects are short-lived */
@@@ -326,4 -319,6 +326,6 @@@ static inline void *kzalloc_node(size_
        return kmalloc_node(size, flags | __GFP_ZERO, node);
  }
  
+ void __init kmem_cache_init_late(void);
  #endif        /* _LINUX_SLAB_H */
diff --combined init/main.c
@@@ -65,7 -65,6 +65,7 @@@
  #include <linux/idr.h>
  #include <linux/ftrace.h>
  #include <linux/async.h>
 +#include <linux/kmemcheck.h>
  #include <linux/kmemtrace.h>
  #include <trace/boot.h>
  
@@@ -540,6 -539,11 +540,11 @@@ void __init __weak thread_info_cache_in
   */
  static void __init mm_init(void)
  {
+       /*
+        * page_cgroup requires countinous pages as memmap
+        * and it's bigger than MAX_ORDER unless SPARSEMEM.
+        */
+       page_cgroup_init_flatmem();
        mem_init();
        kmem_cache_init();
        vmalloc_init();
@@@ -636,6 -640,7 +641,7 @@@ asmlinkage void __init start_kernel(voi
                                 "enabled early\n");
        early_boot_irqs_on();
        local_irq_enable();
+       kmem_cache_init_late();
  
        /*
         * HACK ALERT! This is early. We're enabling the console before
diff --combined mm/slab.c
+++ b/mm/slab.c
  #include      <linux/rtmutex.h>
  #include      <linux/reciprocal_div.h>
  #include      <linux/debugobjects.h>
 +#include      <linux/kmemcheck.h>
  
  #include      <asm/cacheflush.h>
  #include      <asm/tlbflush.h>
                         SLAB_STORE_USER | \
                         SLAB_RECLAIM_ACCOUNT | SLAB_PANIC | \
                         SLAB_DESTROY_BY_RCU | SLAB_MEM_SPREAD | \
 -                       SLAB_DEBUG_OBJECTS | SLAB_NOLEAKTRACE)
 +                       SLAB_DEBUG_OBJECTS | SLAB_NOLEAKTRACE | SLAB_NOTRACK)
  #else
  # define CREATE_MASK  (SLAB_HWCACHE_ALIGN | \
                         SLAB_CACHE_DMA | \
                         SLAB_RECLAIM_ACCOUNT | SLAB_PANIC | \
                         SLAB_DESTROY_BY_RCU | SLAB_MEM_SPREAD | \
 -                       SLAB_DEBUG_OBJECTS | SLAB_NOLEAKTRACE)
 +                       SLAB_DEBUG_OBJECTS | SLAB_NOLEAKTRACE | SLAB_NOTRACK)
  #endif
  
  /*
@@@ -305,6 -304,12 +305,12 @@@ struct kmem_list3 
  };
  
  /*
+  * The slab allocator is initialized with interrupts disabled. Therefore, make
+  * sure early boot allocations don't accidentally enable interrupts.
+  */
+ static gfp_t slab_gfp_mask __read_mostly = SLAB_GFP_BOOT_MASK;
+ /*
   * Need this for bootstrapping a per node allocator.
   */
  #define NUM_INIT_LISTS (3 * MAX_NUMNODES)
@@@ -375,6 -380,87 +381,6 @@@ static void kmem_list3_init(struct kmem
        MAKE_LIST((cachep), (&(ptr)->slabs_free), slabs_free, nodeid);  \
        } while (0)
  
 -/*
 - * struct kmem_cache
 - *
 - * manages a cache.
 - */
 -
 -struct kmem_cache {
 -/* 1) per-cpu data, touched during every alloc/free */
 -      struct array_cache *array[NR_CPUS];
 -/* 2) Cache tunables. Protected by cache_chain_mutex */
 -      unsigned int batchcount;
 -      unsigned int limit;
 -      unsigned int shared;
 -
 -      unsigned int buffer_size;
 -      u32 reciprocal_buffer_size;
 -/* 3) touched by every alloc & free from the backend */
 -
 -      unsigned int flags;             /* constant flags */
 -      unsigned int num;               /* # of objs per slab */
 -
 -/* 4) cache_grow/shrink */
 -      /* order of pgs per slab (2^n) */
 -      unsigned int gfporder;
 -
 -      /* force GFP flags, e.g. GFP_DMA */
 -      gfp_t gfpflags;
 -
 -      size_t colour;                  /* cache colouring range */
 -      unsigned int colour_off;        /* colour offset */
 -      struct kmem_cache *slabp_cache;
 -      unsigned int slab_size;
 -      unsigned int dflags;            /* dynamic flags */
 -
 -      /* constructor func */
 -      void (*ctor)(void *obj);
 -
 -/* 5) cache creation/removal */
 -      const char *name;
 -      struct list_head next;
 -
 -/* 6) statistics */
 -#if STATS
 -      unsigned long num_active;
 -      unsigned long num_allocations;
 -      unsigned long high_mark;
 -      unsigned long grown;
 -      unsigned long reaped;
 -      unsigned long errors;
 -      unsigned long max_freeable;
 -      unsigned long node_allocs;
 -      unsigned long node_frees;
 -      unsigned long node_overflow;
 -      atomic_t allochit;
 -      atomic_t allocmiss;
 -      atomic_t freehit;
 -      atomic_t freemiss;
 -#endif
 -#if DEBUG
 -      /*
 -       * If debugging is enabled, then the allocator can add additional
 -       * fields and/or padding to every object. buffer_size contains the total
 -       * object size including these internal fields, the following two
 -       * variables contain the offset to the user object and its size.
 -       */
 -      int obj_offset;
 -      int obj_size;
 -#endif
 -      /*
 -       * We put nodelists[] at the end of kmem_cache, because we want to size
 -       * this array to nr_node_ids slots instead of MAX_NUMNODES
 -       * (see kmem_cache_init())
 -       * We still use [MAX_NUMNODES] and not [1] or [0] because cache_cache
 -       * is statically defined, so we reserve the max number of nodes.
 -       */
 -      struct kmem_list3 *nodelists[MAX_NUMNODES];
 -      /*
 -       * Do not add fields after nodelists[]
 -       */
 -};
 -
  #define CFLGS_OFF_SLAB                (0x80000000UL)
  #define       OFF_SLAB(x)     ((x)->flags & CFLGS_OFF_SLAB)
  
@@@ -673,6 -759,7 +679,7 @@@ static enum 
        NONE,
        PARTIAL_AC,
        PARTIAL_L3,
+       EARLY,
        FULL
  } g_cpucache_up;
  
   */
  int slab_is_available(void)
  {
-       return g_cpucache_up == FULL;
+       return g_cpucache_up >= EARLY;
  }
  
  static DEFINE_PER_CPU(struct delayed_work, reap_work);
@@@ -1545,19 -1632,27 +1552,27 @@@ void __init kmem_cache_init(void
                }
        }
  
-       /* 6) resize the head arrays to their final sizes */
-       {
-               struct kmem_cache *cachep;
-               mutex_lock(&cache_chain_mutex);
-               list_for_each_entry(cachep, &cache_chain, next)
-                       if (enable_cpucache(cachep, GFP_NOWAIT))
-                               BUG();
-               mutex_unlock(&cache_chain_mutex);
-       }
+       g_cpucache_up = EARLY;
  
        /* Annotate slab for lockdep -- annotate the malloc caches */
        init_lock_keys();
+ }
+ void __init kmem_cache_init_late(void)
+ {
+       struct kmem_cache *cachep;
+       /*
+        * Interrupts are enabled now so all GFP allocations are safe.
+        */
+       slab_gfp_mask = __GFP_BITS_MASK;
  
+       /* 6) resize the head arrays to their final sizes */
+       mutex_lock(&cache_chain_mutex);
+       list_for_each_entry(cachep, &cache_chain, next)
+               if (enable_cpucache(cachep, GFP_NOWAIT))
+                       BUG();
+       mutex_unlock(&cache_chain_mutex);
  
        /* Done! */
        g_cpucache_up = FULL;
@@@ -1612,7 -1707,7 +1627,7 @@@ static void *kmem_getpages(struct kmem_
        if (cachep->flags & SLAB_RECLAIM_ACCOUNT)
                flags |= __GFP_RECLAIMABLE;
  
 -      page = alloc_pages_node(nodeid, flags, cachep->gfporder);
 +      page = alloc_pages_node(nodeid, flags | __GFP_NOTRACK, cachep->gfporder);
        if (!page)
                return NULL;
  
                        NR_SLAB_UNRECLAIMABLE, nr_pages);
        for (i = 0; i < nr_pages; i++)
                __SetPageSlab(page + i);
 +
 +      if (kmemcheck_enabled && !(cachep->flags & SLAB_NOTRACK)) {
 +              kmemcheck_alloc_shadow(page, cachep->gfporder, flags, nodeid);
 +
 +              if (cachep->ctor)
 +                      kmemcheck_mark_uninitialized_pages(page, nr_pages);
 +              else
 +                      kmemcheck_mark_unallocated_pages(page, nr_pages);
 +      }
 +
        return page_address(page);
  }
  
@@@ -1647,8 -1732,6 +1662,8 @@@ static void kmem_freepages(struct kmem_
        struct page *page = virt_to_page(addr);
        const unsigned long nr_freed = i;
  
 +      kmemcheck_free_shadow(page, cachep->gfporder);
 +
        if (cachep->flags & SLAB_RECLAIM_ACCOUNT)
                sub_zone_page_state(page_zone(page),
                                NR_SLAB_RECLAIMABLE, nr_freed);
@@@ -2034,7 -2117,7 +2049,7 @@@ static int __init_refok setup_cpu_cache
                        for_each_online_node(node) {
                                cachep->nodelists[node] =
                                    kmalloc_node(sizeof(struct kmem_list3),
-                                               GFP_KERNEL, node);
+                                               gfp, node);
                                BUG_ON(!cachep->nodelists[node]);
                                kmem_list3_init(cachep->nodelists[node]);
                        }
@@@ -3286,6 -3369,8 +3301,8 @@@ __cache_alloc_node(struct kmem_cache *c
        unsigned long save_flags;
        void *ptr;
  
+       flags &= slab_gfp_mask;
        lockdep_trace_alloc(flags);
  
        if (slab_should_failslab(cachep, flags))
        kmemleak_alloc_recursive(ptr, obj_size(cachep), 1, cachep->flags,
                                 flags);
  
 +      if (likely(ptr))
 +              kmemcheck_slab_alloc(cachep, flags, ptr, obj_size(cachep));
 +
        if (unlikely((flags & __GFP_ZERO) && ptr))
                memset(ptr, 0, obj_size(cachep));
  
@@@ -3369,6 -3451,8 +3386,8 @@@ __cache_alloc(struct kmem_cache *cachep
        unsigned long save_flags;
        void *objp;
  
+       flags &= slab_gfp_mask;
        lockdep_trace_alloc(flags);
  
        if (slab_should_failslab(cachep, flags))
                                 flags);
        prefetchw(objp);
  
 +      if (likely(objp))
 +              kmemcheck_slab_alloc(cachep, flags, objp, obj_size(cachep));
 +
        if (unlikely((flags & __GFP_ZERO) && objp))
                memset(objp, 0, obj_size(cachep));
  
@@@ -3502,8 -3583,6 +3521,8 @@@ static inline void __cache_free(struct 
        kmemleak_free_recursive(objp, cachep->flags);
        objp = cache_free_debugcheck(cachep, objp, __builtin_return_address(0));
  
 +      kmemcheck_slab_free(cachep, objp, obj_size(cachep));
 +
        /*
         * Skip calling cache_free_alien() when the platform is not numa.
         * This will avoid cache misses that happen while accessing slabp (which
diff --combined mm/slub.c
+++ b/mm/slub.c
@@@ -18,7 -18,6 +18,7 @@@
  #include <linux/proc_fs.h>
  #include <linux/seq_file.h>
  #include <linux/kmemtrace.h>
 +#include <linux/kmemcheck.h>
  #include <linux/cpu.h>
  #include <linux/cpuset.h>
  #include <linux/kmemleak.h>
                SLAB_TRACE | SLAB_DESTROY_BY_RCU | SLAB_NOLEAKTRACE)
  
  #define SLUB_MERGE_SAME (SLAB_DEBUG_FREE | SLAB_RECLAIM_ACCOUNT | \
 -              SLAB_CACHE_DMA)
 +              SLAB_CACHE_DMA | SLAB_NOTRACK)
  
  #ifndef ARCH_KMALLOC_MINALIGN
  #define ARCH_KMALLOC_MINALIGN __alignof__(unsigned long long)
@@@ -179,6 -178,12 +179,12 @@@ static enum 
        SYSFS           /* Sysfs up */
  } slab_state = DOWN;
  
+ /*
+  * The slab allocator is initialized with interrupts disabled. Therefore, make
+  * sure early boot allocations don't accidentally enable interrupts.
+  */
+ static gfp_t slab_gfp_mask __read_mostly = SLAB_GFP_BOOT_MASK;
  /* A list of all slab caches on the system */
  static DECLARE_RWSEM(slub_lock);
  static LIST_HEAD(slab_caches);
@@@ -1066,8 -1071,6 +1072,8 @@@ static inline struct page *alloc_slab_p
  {
        int order = oo_order(oo);
  
 +      flags |= __GFP_NOTRACK;
 +
        if (node == -1)
                return alloc_pages(flags, order);
        else
@@@ -1095,24 -1098,6 +1101,24 @@@ static struct page *allocate_slab(struc
  
                stat(get_cpu_slab(s, raw_smp_processor_id()), ORDER_FALLBACK);
        }
 +
 +      if (kmemcheck_enabled
 +              && !(s->flags & (SLAB_NOTRACK | DEBUG_DEFAULT_FLAGS)))
 +      {
 +              int pages = 1 << oo_order(oo);
 +
 +              kmemcheck_alloc_shadow(page, oo_order(oo), flags, node);
 +
 +              /*
 +               * Objects from caches that have a constructor don't get
 +               * cleared when they're allocated, so we need to do it here.
 +               */
 +              if (s->ctor)
 +                      kmemcheck_mark_uninitialized_pages(page, pages);
 +              else
 +                      kmemcheck_mark_unallocated_pages(page, pages);
 +      }
 +
        page->objects = oo_objects(oo);
        mod_zone_page_state(page_zone(page),
                (s->flags & SLAB_RECLAIM_ACCOUNT) ?
@@@ -1186,8 -1171,6 +1192,8 @@@ static void __free_slab(struct kmem_cac
                __ClearPageSlubDebug(page);
        }
  
 +      kmemcheck_free_shadow(page, compound_order(page));
 +
        mod_zone_page_state(page_zone(page),
                (s->flags & SLAB_RECLAIM_ACCOUNT) ?
                NR_SLAB_RECLAIMABLE : NR_SLAB_UNRECLAIMABLE,
@@@ -1618,6 -1601,8 +1624,8 @@@ static __always_inline void *slab_alloc
        unsigned long flags;
        unsigned int objsize;
  
+       gfpflags &= slab_gfp_mask;
        lockdep_trace_alloc(gfpflags);
        might_sleep_if(gfpflags & __GFP_WAIT);
  
        if (unlikely((gfpflags & __GFP_ZERO) && object))
                memset(object, 0, objsize);
  
 +      kmemcheck_slab_alloc(s, gfpflags, object, c->objsize);
        kmemleak_alloc_recursive(object, objsize, 1, s->flags, gfpflags);
 +
        return object;
  }
  
@@@ -1776,7 -1759,6 +1784,7 @@@ static __always_inline void slab_free(s
        kmemleak_free_recursive(x, s->flags);
        local_irq_save(flags);
        c = get_cpu_slab(s, smp_processor_id());
 +      kmemcheck_slab_free(s, object, c->objsize);
        debug_check_no_locks_freed(object, c->objsize);
        if (!(s->flags & SLAB_DEBUG_OBJECTS))
                debug_check_no_obj_freed(object, c->objsize);
@@@ -2651,8 -2633,7 +2659,8 @@@ static noinline struct kmem_cache *dma_
  
        if (!s || !text || !kmem_cache_open(s, flags, text,
                        realsize, ARCH_KMALLOC_MINALIGN,
 -                      SLAB_CACHE_DMA|__SYSFS_ADD_DEFERRED, NULL)) {
 +                      SLAB_CACHE_DMA|SLAB_NOTRACK|__SYSFS_ADD_DEFERRED,
 +                      NULL)) {
                kfree(s);
                kfree(text);
                goto unlock_out;
@@@ -2746,10 -2727,9 +2754,10 @@@ EXPORT_SYMBOL(__kmalloc)
  
  static void *kmalloc_large_node(size_t size, gfp_t flags, int node)
  {
 -      struct page *page = alloc_pages_node(node, flags | __GFP_COMP,
 -                                              get_order(size));
 +      struct page *page;
  
 +      flags |= __GFP_COMP | __GFP_NOTRACK;
 +      page = alloc_pages_node(node, flags, get_order(size));
        if (page)
                return page_address(page);
        else
@@@ -3132,6 -3112,14 +3140,14 @@@ void __init kmem_cache_init(void
                nr_cpu_ids, nr_node_ids);
  }
  
+ void __init kmem_cache_init_late(void)
+ {
+       /*
+        * Interrupts are enabled now so all GFP allocations are safe.
+        */
+       slab_gfp_mask = __GFP_BITS_MASK;
+ }
  /*
   * Find a mergeable slab cache
   */
@@@ -4424,8 -4412,6 +4440,8 @@@ static char *create_unique_id(struct km
                *p++ = 'a';
        if (s->flags & SLAB_DEBUG_FREE)
                *p++ = 'F';
 +      if (!(s->flags & SLAB_NOTRACK))
 +              *p++ = 't';
        if (p != name + 1)
                *p++ = '-';
        p += sprintf(p, "%07d", s->size);