Re: [PATCH 5/5] mm, slob: Trace allocation failures consistently

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2012/9/6 Ezequiel Garcia <elezegarcia@xxxxxxxxx>:
> This patch cleans how we trace kmalloc and kmem_cache_alloc.
> In particular, it fixes out-of-memory tracing: now every failed
> allocation will trace reporting non-zero requested bytes, zero obtained bytes.

Other SLAB allocators(slab, slub) doesn't consider zero obtained bytes
in tracing.
These just return "addr = 0, obtained size = cache size"
Why does the slob print a different output?

> @@ -573,20 +576,23 @@ void *kmem_cache_alloc_node(struct kmem_cache *c, gfp_t flags, int node)
>
>         if (c->size < PAGE_SIZE) {
>                 b = slob_alloc(c->size, flags, c->align, node);
> -               trace_kmem_cache_alloc_node(_RET_IP_, b, c->size,
> -                                           SLOB_UNITS(c->size) * SLOB_UNIT,
> -                                           flags, node);
> +               if (!b)
> +                       goto trace_out;
> +               alloc_size = SLOB_UNITS(c->size) * SLOB_UNIT;
>         } else {
>                 b = slob_new_pages(flags, get_order(c->size), node);
> -               trace_kmem_cache_alloc_node(_RET_IP_, b, c->size,
> -                                           PAGE_SIZE << get_order(c->size),
> -                                           flags, node);
> +               if (!b)
> +                       goto trace_out;
> +               alloc_size = PAGE_SIZE << get_order(c->size);
>         }
>         if (c->ctor)
>                 c->ctor(b);

Regardless of tracing, "if (!b)" test is needed for skip "c->ctor".

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]