msc_buffer_u..._unless_used(9)
π msc_buffer_u..._unless_used(9) π
okay bestie, welcome to the Kernel API Manual β yes, the actual kernel manual, we're doing this, and honestly? this one's kinda iconic. it's giving "polite little cleanup function that checks the vibe before it deletes anything." no cap.
β¨ NAME β¨
msc_buffer_unlocked_free_unless_used β frees a buffer unless it's in use. that's it. that's the whole personality. π
πΈ SYNOPSIS πΈ
int msc_buffer_unlocked_free_unless_used (struct msc *msc );
like, you hand it an msc and it hands you back an int. simple. clean. slay.
π¦ ARGUMENTS π¦
mscβ the MSC device, obviously π it's the star of the show, the main character, the whole reason we're here.
π₯ DESCRIPTION π₯
so the way this works is: it will free the MSC buffer β unless it's in use, or unless there's literally no allocated buffer to free in the first place. no buffer? no problem. girly just shrugs and moves on. π«Ά
β οΈ but listen β the caller needs to hold msc::buf_mutex. like, that's not optional, that's not a suggestion, that's the rule. hold the mutex or don't come to the function. periodt. π
β RETURN β
0β successful deallocation π β¦ or there was just no buffer to deallocate, which honestly also counts as a win, we love a low-stakes success.-EBUSYβ nope, there are active users π the buffer is occupied, bestie, come back later.
π SEE ALSO π
okay this is the friend group, the whole squad, the entire intel_th cinematic universe. look at the kernel file ./drivers/hwtracing/intel_th/msu.c for the lore, and then meet the cast:
struct msc_window(9)struct msc_iter(9)struct msc(9)struct msu_buffer_entry(9)msc_is_last_win(9)msc_next_window(9)msc_find_window(9)msc_oldest_window(9)msc_win_oldest_sg(9)msc_buffer_iterate(9)msc_buffer_clear_hw_header(9)msc_configure(9)msc_disable(9)msc_buffer_contig_alloc(9)msc_buffer_contig_free(9)msc_buffer_contig_get_page(9)msc_buffer_win_alloc(9)msc_buffer_win_free(9)msc_buffer_relink(9)msc_buffer_free(9)msc_buffer_alloc(9)msc_buffer_free_unless_used(9)msc_buffer_get_page(9)struct msc_win_to_user_struct(9)msc_win_to_user(9)intel_th_msc_window_unlock(9)
like, the whole roster. iykyk. π
and that's the tea π β brought to you by the lovely humans over at ./drivers/hwtracing/intel_th, dated October 2026, filed under msc_buffer_u..._unless_used(9). mwah π go hold that mutex, bestie π§π
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms