tools/perf/util/mem-info.c
Source file repositories/reference/linux-study-clean/tools/perf/util/mem-info.c
File Facts
- System
- Linux kernel
- Corpus path
tools/perf/util/mem-info.c- Extension
.c- Size
- 1058 bytes
- Lines
- 49
- Domain
- Support Tooling And Documentation
- Bucket
- tools
- Inferred role
- Support Tooling And Documentation: implementation source
- Status
- source implementation candidate
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/zalloc.hmem-info.h
Detected Declarations
function mem_info__put
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
#include <linux/zalloc.h>
#include "mem-info.h"
struct mem_info *mem_info__get(struct mem_info *mi)
{
struct mem_info *result;
if (RC_CHK_GET(result, mi))
refcount_inc(mem_info__refcnt(mi));
return result;
}
void mem_info__put(struct mem_info *mi)
{
if (mi && refcount_dec_and_test(mem_info__refcnt(mi))) {
addr_map_symbol__exit(mem_info__iaddr(mi));
addr_map_symbol__exit(mem_info__daddr(mi));
RC_CHK_FREE(mi);
} else {
RC_CHK_PUT(mi);
}
}
struct mem_info *mem_info__new(void)
{
struct mem_info *result = NULL;
RC_STRUCT(mem_info) *mi = zalloc(sizeof(*mi));
if (ADD_RC_CHK(result, mi))
refcount_set(mem_info__refcnt(result), 1);
return result;
}
struct mem_info *mem_info__clone(struct mem_info *mi)
{
struct mem_info *result = mem_info__new();
if (result) {
addr_map_symbol__copy(mem_info__iaddr(result), mem_info__iaddr(mi));
addr_map_symbol__copy(mem_info__daddr(result), mem_info__daddr(mi));
mem_info__data_src(result)->val = mem_info__data_src(mi)->val;
}
return result;
}
Annotation
- Immediate include surface: `linux/zalloc.h`, `mem-info.h`.
- Detected declarations: `function mem_info__put`.
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.