Skip to content

Commit 05c82ee

Browse files
surenbaghdasaryanakpm00
authored andcommitted
alloc_tag: skip pgalloc_tag_swap if profiling is disabled
When memory allocation profiling is disabled, there is no need to swap allocation tags during migration. Skip it to avoid unnecessary overhead. Once I added these checks, the overhead of the mode when memory profiling is enabled but turned off went down by about 50%. Link: https://lkml.kernel.org/r/[email protected] Fixes: e0a955b ("mm/codetag: add pgalloc_tag_copy()") Signed-off-by: Suren Baghdasaryan <[email protected]> Cc: David Wang <[email protected]> Cc: Kent Overstreet <[email protected]> Cc: Yu Zhao <[email protected]> Cc: Zhenhua Huang <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 9726891 commit 05c82ee

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lib/alloc_tag.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,9 @@ void pgalloc_tag_swap(struct folio *new, struct folio *old)
195195
union codetag_ref ref_old, ref_new;
196196
struct alloc_tag *tag_old, *tag_new;
197197

198+
if (!mem_alloc_profiling_enabled())
199+
return;
200+
198201
tag_old = pgalloc_tag_get(&old->page);
199202
if (!tag_old)
200203
return;

0 commit comments

Comments
 (0)