Commit 0cd1a029 authored by Vlastimil Babka's avatar Vlastimil Babka
Browse files

mm/slub: move struct track init out of set_track()



set_track() either zeroes out the struct track or fills it, depending on
the addr parameter. This is unnecessary as there's only one place that
calls it for the initialization - init_tracking(). We can simply do the
zeroing there, with a single memset() that covers both TRACK_ALLOC and
TRACK_FREE as they are adjacent.

Signed-off-by: default avatarVlastimil Babka <vbabka@suse.cz>
Reviewed-and-tested-by: default avatarHyeonggon Yoo <42.hyeyoo@gmail.com>
Acked-by: default avatarDavid Rientjes <rientjes@google.com>
parent a5f1783b
Loading
Loading
Loading
Loading
+15 −17
Original line number Diff line number Diff line
@@ -729,7 +729,6 @@ static void set_track(struct kmem_cache *s, void *object,
{
	struct track *p = get_track(s, object, alloc);

	if (addr) {
#ifdef CONFIG_STACKTRACE
	unsigned int nr_entries;

@@ -745,18 +744,17 @@ static void set_track(struct kmem_cache *s, void *object,
	p->cpu = smp_processor_id();
	p->pid = current->pid;
	p->when = jiffies;
	} else {
		memset(p, 0, sizeof(struct track));
	}
}

static void init_tracking(struct kmem_cache *s, void *object)
{
	struct track *p;

	if (!(s->flags & SLAB_STORE_USER))
		return;

	set_track(s, object, TRACK_FREE, 0UL);
	set_track(s, object, TRACK_ALLOC, 0UL);
	p = get_track(s, object, TRACK_ALLOC);
	memset(p, 0, 2*sizeof(struct track));
}

static void print_track(const char *s, struct track *t, unsigned long pr_time)