Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

perf: Use guard() for aux_mutex in perf_mmap()

After duplicating the common code into the rb/aux branches is it
possible to use a simple guard() for the aux_mutex. Making the aux
branch self-contained.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Link: https://lore.kernel.org/r/20250812104019.246250452@infradead.org

+1 -5
+1 -5
kernel/events/core.c
··· 6975 6975 struct perf_event *event = file->private_data; 6976 6976 unsigned long vma_size, nr_pages; 6977 6977 long user_extra = 0, extra = 0; 6978 - struct mutex *aux_mutex = NULL; 6979 6978 struct perf_buffer *rb = NULL; 6980 6979 int ret, flags = 0; 6981 6980 mapped_f mapped; ··· 7099 7100 if (!rb) 7100 7101 goto unlock; 7101 7102 7102 - aux_mutex = &rb->aux_mutex; 7103 - mutex_lock(aux_mutex); 7103 + guard(mutex)(&rb->aux_mutex); 7104 7104 7105 7105 aux_offset = READ_ONCE(rb->user_page->aux_offset); 7106 7106 aux_size = READ_ONCE(rb->user_page->aux_size); ··· 7159 7161 } 7160 7162 7161 7163 unlock: 7162 - if (aux_mutex) 7163 - mutex_unlock(aux_mutex); 7164 7164 mutex_unlock(&event->mmap_mutex); 7165 7165 7166 7166 if (ret)