aboutsummaryrefslogtreecommitdiff
path: root/tools/perf/util/mmap.c
diff options
context:
space:
mode:
authorGravatar Sean Christopherson <seanjc@google.com> 2022-11-19 01:34:46 +0000
committerGravatar Paolo Bonzini <pbonzini@redhat.com> 2022-12-02 13:22:33 -0500
commit75d7ba32f9829e778484cf6e96e6e8f80914b0b3 (patch)
tree84e0c2d67e2c6b35138bfd9ecf13e5e99677399b /tools/perf/util/mmap.c
parenttools: Take @bit as an "unsigned long" in {clear,set}_bit() helpers (diff)
downloadlinux-75d7ba32f9829e778484cf6e96e6e8f80914b0b3.tar.gz
linux-75d7ba32f9829e778484cf6e96e6e8f80914b0b3.tar.bz2
linux-75d7ba32f9829e778484cf6e96e6e8f80914b0b3.zip
perf tools: Use dedicated non-atomic clear/set bit helpers
Use the dedicated non-atomic helpers for {clear,set}_bit() and their test variants, i.e. the double-underscore versions. Depsite being defined in atomic.h, and despite the kernel versions being atomic in the kernel, tools' {clear,set}_bit() helpers aren't actually atomic. Move to the double-underscore versions so that the versions that are expected to be atomic (for kernel developers) can be made atomic without affecting users that don't want atomic operations. No functional change intended. Signed-off-by: Sean Christopherson <seanjc@google.com> Acked-by: Namhyung Kim <namhyung@kernel.org> Message-Id: <20221119013450.2643007-6-seanjc@google.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'tools/perf/util/mmap.c')
-rw-r--r--tools/perf/util/mmap.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/tools/perf/util/mmap.c b/tools/perf/util/mmap.c
index a4dff881be39..49093b21ee2d 100644
--- a/tools/perf/util/mmap.c
+++ b/tools/perf/util/mmap.c
@@ -111,7 +111,7 @@ static int perf_mmap__aio_bind(struct mmap *map, int idx, struct perf_cpu cpu, i
pr_err("Failed to allocate node mask for mbind: error %m\n");
return -1;
}
- set_bit(node_index, node_mask);
+ __set_bit(node_index, node_mask);
if (mbind(data, mmap_len, MPOL_BIND, node_mask, node_index + 1 + 1, 0)) {
pr_err("Failed to bind [%p-%p] AIO buffer to node %lu: error %m\n",
data, data + mmap_len, node_index);
@@ -256,7 +256,7 @@ static void build_node_mask(int node, struct mmap_cpu_mask *mask)
for (idx = 0; idx < nr_cpus; idx++) {
cpu = perf_cpu_map__cpu(cpu_map, idx); /* map c index to online cpu index */
if (cpu__get_node(cpu) == node)
- set_bit(cpu.cpu, mask->bits);
+ __set_bit(cpu.cpu, mask->bits);
}
}
@@ -270,7 +270,7 @@ static int perf_mmap__setup_affinity_mask(struct mmap *map, struct mmap_params *
if (mp->affinity == PERF_AFFINITY_NODE && cpu__max_node() > 1)
build_node_mask(cpu__get_node(map->core.cpu), &map->affinity_mask);
else if (mp->affinity == PERF_AFFINITY_CPU)
- set_bit(map->core.cpu.cpu, map->affinity_mask.bits);
+ __set_bit(map->core.cpu.cpu, map->affinity_mask.bits);
return 0;
}