mirror of
				git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
				synced 2025-10-31 16:54:21 +00:00 
			
		
		
		
	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/20241226211639.1357704-2-surenb@google.com
Fixes: e0a955bf7f ("mm/codetag: add pgalloc_tag_copy()")
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Cc: David Wang <00107082@163.com>
Cc: Kent Overstreet <kent.overstreet@linux.dev>
Cc: Yu Zhao <yuzhao@google.com>
Cc: Zhenhua Huang <quic_zhenhuah@quicinc.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
			
			
This commit is contained in:
		
							parent
							
								
									9726891fe7
								
							
						
					
					
						commit
						05c82ee363
					
				
					 1 changed files with 3 additions and 0 deletions
				
			
		|  | @ -195,6 +195,9 @@ void pgalloc_tag_swap(struct folio *new, struct folio *old) | ||||||
| 	union codetag_ref ref_old, ref_new; | 	union codetag_ref ref_old, ref_new; | ||||||
| 	struct alloc_tag *tag_old, *tag_new; | 	struct alloc_tag *tag_old, *tag_new; | ||||||
| 
 | 
 | ||||||
|  | 	if (!mem_alloc_profiling_enabled()) | ||||||
|  | 		return; | ||||||
|  | 
 | ||||||
| 	tag_old = pgalloc_tag_get(&old->page); | 	tag_old = pgalloc_tag_get(&old->page); | ||||||
| 	if (!tag_old) | 	if (!tag_old) | ||||||
| 		return; | 		return; | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Suren Baghdasaryan
						Suren Baghdasaryan