kfree_const(9)
π kfree_const(9) β from the Kernel API Manual, bestie
Okay so picture this: you're deep in kfree_const(9) territory, the Kernel API Manual has your back, and I'm here to translate. Let's go β¨
πΈ NAME
kfree_const β freeing memory, but conditionally. It's giving "read the room before you act" energy fr fr.
π SYNOPSIS
void kfree_const (const void *x );
That's it. That's the whole vibe check. π
π¦ ARGUMENTS
xβ pointer to the memory π literally just the address of the stuff you're thinking about freeing. Nothing more, nothing less.
π DESCRIPTION
So here's the tea β: this function calls kfree only if x is not in the .rodata section.
That's the whole personality. No .rodata shenanigans, no free. It's lowkey the most responsible little function in the kernel β checks first, frees second. Slay. π§
π₯ SEE ALSO
Kernel file ./mm/util.c β and the whole friend group, no cap:
__kmemdup_nul(9), kstrdup(9), kstrdup_const(9), kstrndup(9), kmemdup(9), kmemdup_array(9), kvmemdup(9), kmemdup_nul(9), memdup_user(9), vmemdup_user(9), strndup_user(9), memdup_user_nul(9), randomize_page(9), __account_locked_vm(9), account_locked_vm(9), __vmalloc_array(9), vmalloc_array(9), __vcalloc(9), vcalloc(9), folio_mapping(9), folio_copy(9), get_cmdline(9), mem_dump_obj(9), compat_set_desc_from_vma(9), __compat_vma_mmap(9), compat_vma_mmap(9), snapshot_page(9), mmap_action_prepare(9), mmap_action_complete(9), folio_pte_batch(9), page_range_contiguous(9)
That's the entire squad and yes we're tagging everyone. π
Kiss kiss, this page lives in ./mm, stamped October 2026 β see you in the next manpage bestie, mwah π«Άπ
π¦ 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