mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-11-01 23:04:54 +01:00
perf mmap: Introduce mmap_cpu_mask__duplicate()
This patch adds a new function in util/mmap.c to duplicate a mmap_cpu_mask. This new function will be used in patches in the workqueue patchkit. Signed-off-by: Riccardo Mancini <[email protected]> Cc: Ian Rogers <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Link: http://lore.kernel.org/lkml/8943a548ef7a3dd3e015095afad7e9a8b2154c05.1629490974.git.rickyman7@gmail.com [ bitmap_alloc() was renamed to bitmap_zalloc() ] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
This commit is contained in:
1 parent
73e40c9bd4
commit
6bd006c6eb
2 files changed
+14
No files matched your search
@@ -350,3 +350,14 @@ int perf_mmap__push(struct mmap *md, void *to,
|
||||
out:
|
||||
return rc;
|
||||
}
|
||||
|
||||
int mmap_cpu_mask__duplicate(struct mmap_cpu_mask *original, struct mmap_cpu_mask *clone)
|
||||
{
|
||||
clone->nbits = original->nbits;
|
||||
clone->bits = bitmap_zalloc(original->nbits);
|
||||
if (!clone->bits)
|
||||
return -ENOMEM;
|
||||
|
||||
memcpy(clone->bits, original->bits, MMAP_CPU_MASK_BYTES(original));
|
||||
return 0;
|
||||
}
|
||||
@@ -64,4 +64,7 @@ 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 */
|
||||
Reference in new issue
Block a user