[Crash-utility] "zero-size memory allocation!" is back for Linux 3.1

Bob Montgomery bob.montgomery at hp.com
Wed Jan 18 00:01:08 UTC 2012


In include/linux/slab_def.h circa linux 3.0, this def for field nodelists:

struct kmem_cache {
/* 1) per-cpu data, touched during every alloc/free */
        struct array_cache *array[NR_CPUS];

        ...

        struct kmem_list3 *nodelists[MAX_NUMNODES];
        /*
         * Do not add fields after nodelists[]
         */
};

Became this in 3.1:

struct kmem_cache {
...

/* 6) per-cpu/per-node data, touched during every alloc/free */
      /*
       * We put array[] at the end of kmem_cache, because we want to
size
       * this array to nr_cpu_ids slots instead of NR_CPUS
       * (see kmem_cache_init())
       * We still use [NR_CPUS] and not [1] or [0] because cache_cache
       * is statically defined, so we reserve the max number of cpus.
       */
      struct kmem_list3 **nodelists;
      struct array_cache *array[NR_CPUS];
      /*
       * Do not add fields after array[]
       */
};


Which causes this in crash/memory.c:vm_init()

       ARRAY_LENGTH_INIT(vt->kmem_cache_len_nodes, NULL,
            "kmem_cache.nodelists", NULL, 0);

to set vt->kmem_cache_len_nodes to 0, and leads to the initialization
failure when max_cpudata_limit calls getbuf with a size of 0.

Got a fix in the works yet?

Thanks,
Bob Montgomery







More information about the Crash-utility mailing list