mirror of
https://github.com/torvalds/linux.git
synced 2026-11-29 10:07:52 +00:00
Zstd streams create dictionaries that can require significant RAM, especially when there is one per-CPU. Tools like 'perf record' won't use the streams without the -z option, and so the creation of the streams is pure overhead. Switch to creating the streams on first use. Committer notes: ssize_t comes from sys/types.h, size_t from stddef.h. This worked on glibc as stdlib.h includes both, but not on musl libc. So do what 'man size_t' says and include sys/types.h and stddef.h instead of stdlib.h Signed-off-by: Ian Rogers <[email protected]> Cc: Adrian Hunter <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Andi Kleen <[email protected]> Cc: Athira Jajeev <[email protected]> Cc: Changbin Du <[email protected]> Cc: Colin Ian King <[email protected]> Cc: Dmitrii Dolgov <[email protected]> Cc: German Gomez <[email protected]> Cc: Huacai Chen <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: James Clark <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: K Prateek Nayak <[email protected]> Cc: Kajol Jain <[email protected]> Cc: Kan Liang <[email protected]> Cc: Leo Yan <[email protected]> Cc: Li Dong <[email protected]> Cc: Liam Howlett <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Masami Hiramatsu (Google) <[email protected]> Cc: Miguel Ojeda <[email protected]> Cc: Ming Wang <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Nick Terrell <[email protected]> Cc: Paolo Bonzini <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Ravi Bangoria <[email protected]> Cc: Sandipan Das <[email protected]> Cc: Sean Christopherson <[email protected]> Cc: Steinar H. Gunderson <[email protected]> Cc: Vincent Whitchurch <[email protected]> Cc: Wenyu Liu <[email protected]> Cc: Yang Jihong <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
68 lines
1.5 KiB
C
68 lines
1.5 KiB
C
#ifndef __PERF_MMAP_H
|
|
#define __PERF_MMAP_H 1
|
|
|
|
#include <internal/mmap.h>
|
|
#include <linux/types.h>
|
|
#include <linux/bitops.h>
|
|
#include <perf/cpumap.h>
|
|
#ifdef HAVE_AIO_SUPPORT
|
|
#include <aio.h>
|
|
#endif
|
|
#include "auxtrace.h"
|
|
#include "util/compress.h"
|
|
|
|
struct aiocb;
|
|
|
|
struct mmap_cpu_mask {
|
|
unsigned long *bits;
|
|
size_t nbits;
|
|
};
|
|
|
|
#define MMAP_CPU_MASK_BYTES(m) \
|
|
(BITS_TO_LONGS(((struct mmap_cpu_mask *)m)->nbits) * sizeof(unsigned long))
|
|
|
|
/**
|
|
* struct mmap - perf's ring buffer mmap details
|
|
*
|
|
* @refcnt - e.g. code using PERF_EVENT_IOC_SET_OUTPUT to share this
|
|
*/
|
|
struct mmap {
|
|
struct perf_mmap core;
|
|
struct auxtrace_mmap auxtrace_mmap;
|
|
#ifdef HAVE_AIO_SUPPORT
|
|
struct {
|
|
void **data;
|
|
struct aiocb *cblocks;
|
|
struct aiocb **aiocb;
|
|
int nr_cblocks;
|
|
} aio;
|
|
#endif
|
|
struct mmap_cpu_mask affinity_mask;
|
|
void *data;
|
|
struct perf_data_file *file;
|
|
struct zstd_data zstd_data;
|
|
};
|
|
|
|
struct mmap_params {
|
|
struct perf_mmap_param core;
|
|
int nr_cblocks, affinity, flush, comp_level;
|
|
struct auxtrace_mmap_params auxtrace_mp;
|
|
};
|
|
|
|
int mmap__mmap(struct mmap *map, struct mmap_params *mp, int fd, struct perf_cpu cpu);
|
|
void mmap__munmap(struct mmap *map);
|
|
|
|
union perf_event *perf_mmap__read_forward(struct mmap *map);
|
|
|
|
int perf_mmap__push(struct mmap *md, void *to,
|
|
int push(struct mmap *map, void *to, void *buf, size_t size));
|
|
|
|
size_t mmap__mmap_len(struct mmap *map);
|
|
|
|
void mmap_cpu_mask__scnprintf(struct mmap_cpu_mask *mask, const char *tag);
|
|
|
|
int mmap_cpu_mask__duplicate(struct mmap_cpu_mask *original,
|
|
struct mmap_cpu_mask *clone);
|
|
|
|
#endif /*__PERF_MMAP_H */
|