26 Apr, 2016

2 commits

  • If tracing_map_elt_alloc() fails, it will return ERR_PTR() instead of
    NULL, so change the check to IS_ERROR(). We also need to set the
    failed entry in the map->elts array to NULL instead of ERR_PTR() so
    tracing_map_free_elts() doesn't try freeing an ERR_PTR().

    tracing_map_free_elts() should also zero out what it frees so a
    reentrant call won't find previously freed elements.

    Link: http://lkml.kernel.org/r/f29d03b00bce3aac8cf151a8a30e6c83e5fee66d.1461610073.git.tom.zanussi@linux.intel.com

    Signed-off-by: Tom Zanussi
    Signed-off-by: Steven Rostedt

    Tom Zanussi
     
  • tracing_map_elt_alloc() returns ERR_PTRs on error, never NULL.

    Fixes: 08d43a5fa063 ('tracing: Add lock-free tracing_map')
    Link: http://lkml.kernel.org/r/20160423102347.GA11136@mwanda

    Acked-by: Tom Zanussi
    Signed-off-by: Dan Carpenter
    Signed-off-by: Steven Rostedt

    Dan Carpenter
     

20 Apr, 2016

2 commits

  • Make it clear exactly how many keys and values are supported through
    better defines, and add 1 to the vals count, since normally clients
    want support for at least a hitcount and two other values.

    Also, note the error return value for tracing_map_add_key/val_field()
    in the comments.

    Link: http://lkml.kernel.org/r/6696fa02ebc716aa344c27a571a2afaa25e5b4d4.1457029949.git.tom.zanussi@linux.intel.com

    Signed-off-by: Tom Zanussi
    Signed-off-by: Steven Rostedt

    Tom Zanussi
     
  • Add tracing_map, a special-purpose lock-free map for tracing.

    tracing_map is designed to aggregate or 'sum' one or more values
    associated with a specific object of type tracing_map_elt, which
    is associated by the map to a given key.

    It provides various hooks allowing per-tracer customization and is
    separated out into a separate file in order to allow it to be shared
    between multiple tracers, but isn't meant to be generally used outside
    of that context.

    The tracing_map implementation was inspired by lock-free map
    algorithms originated by Dr. Cliff Click:

    http://www.azulsystems.com/blog/cliff/2007-03-26-non-blocking-hashtable
    http://www.azulsystems.com/events/javaone_2007/2007_LockFreeHash.pdf

    Link: http://lkml.kernel.org/r/b43d68d1add33582a396f553c8ef705a33a6a748.1449767187.git.tom.zanussi@linux.intel.com

    Signed-off-by: Tom Zanussi
    Tested-by: Masami Hiramatsu
    Reviewed-by: Namhyung Kim
    Signed-off-by: Steven Rostedt

    Tom Zanussi