@@ -137,16 +137,13 @@ static inline void alloc_tag_sub_check(union codetag_ref *ref) {}
/* Caller should verify both ref and tag to be valid */
static inline void __alloc_tag_ref_set(union codetag_ref *ref, struct alloc_tag *tag)
{
- alloc_tag_add_check(ref, tag);
- if (!ref || !tag)
- return;
-
ref->ct = &tag->ct;
}
static inline void alloc_tag_ref_set(union codetag_ref *ref, struct alloc_tag *tag)
{
__alloc_tag_ref_set(ref, tag);
+
/*
* We need in increment the call counter every time we have a new
* allocation or when we split a large allocation into smaller ones.
@@ -158,6 +155,10 @@ static inline void alloc_tag_ref_set(union codetag_ref *ref, struct alloc_tag *t
static inline void alloc_tag_add(union codetag_ref *ref, struct alloc_tag *tag, size_t bytes)
{
+ alloc_tag_add_check(ref, tag);
+ if (!ref || !tag)
+ return;
+
alloc_tag_ref_set(ref, tag);
this_cpu_add(tag->counters->bytes, bytes);
}