diff options
| author | Suren Baghdasaryan <[email protected]> | 2024-12-26 21:16:39 +0000 |
|---|---|---|
| committer | Andrew Morton <[email protected]> | 2025-01-16 05:15:43 +0000 |
| commit | 05c82ee363f64c64b87a0cfd744298e9333475f5 (patch) | |
| tree | 4fc27c669a22bd8e3aaee5898a51d57918a20484 /lib/alloc_tag.c | |
| parent | mm: page_alloc: fix missed updates of lowmem_reserve in adjust_managed_page_c... (diff) | |
| download | kernel-05c82ee363f64c64b87a0cfd744298e9333475f5.tar.gz kernel-05c82ee363f64c64b87a0cfd744298e9333475f5.zip | |
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: e0a955bf7f61 ("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]>
Diffstat (limited to 'lib/alloc_tag.c')
| -rw-r--r-- | lib/alloc_tag.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/alloc_tag.c b/lib/alloc_tag.c index 7dcebf118a3e..65e706e1bc19 100644 --- a/lib/alloc_tag.c +++ b/lib/alloc_tag.c @@ -195,6 +195,9 @@ void pgalloc_tag_swap(struct folio *new, struct folio *old) union codetag_ref ref_old, ref_new; struct alloc_tag *tag_old, *tag_new; + if (!mem_alloc_profiling_enabled()) + return; + tag_old = pgalloc_tag_get(&old->page); if (!tag_old) return; |
