perf core: Allocate perf_buffer in the target node memory
Namhyung Kim
maintainerPATCH 1/1 perf core: Allocate perf_buffer in the target node memory
I found the ring buffer pages are allocated in the node but the ring buffer itself is not. Let's convert it to use kzalloc_node() too.
Signed-off-by Namhyung Kim <[email protected]>
--- kernel/events/ring_buffer.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
kernel/events/ring_buffer.c +6 -3
@@ -804,7 +804,7 @@ struct perf_buffer *rb_alloc(int nr_pages, long watermark, int cpu, int flags) {struct perf_buffer *rb;unsigned long size; -int i; +int i, node; size =sizeof (struct perf_buffer ); size += nr_pages *sizeof (void *);
@@ -812,7 +812,8 @@ struct perf_buffer *rb_alloc(int nr_pages, long watermark, int cpu, int flags)if (order_base_2 (size) >=PAGE_SHIFT +MAX_ORDER ) goto fail; - rb =kzalloc (size,GFP_KERNEL ); + node = (cpu ==-1 ) ? cpu :cpu_to_node (cpu); + rb =kzalloc_node (size,GFP_KERNEL , node);if (!rb) goto fail;
@@ -906,11 +907,13 @@ struct perf_buffer *rb_alloc(int nr_pages, long watermark, int cpu, int flags)struct perf_buffer *rb;unsigned long size;void *all_buf; +int node; size =sizeof (struct perf_buffer ); size +=sizeof (void *); - rb =kzalloc (size,GFP_KERNEL ); + node = (cpu ==-1 ) ? cpu :cpu_to_node (cpu); + rb =kzalloc_node (size,GFP_KERNEL , node);if (!rb) goto fail;
Signature · 1 line
2.31.0.rc2.261.g7f71774620-goog
The following commit has been merged into the perf/core branch of tip:
The following commit has been merged into the perf/core branch of tip:
Commit-ID: 9483409ab5067941860754e78a4a44a60311d276 Gitweb: https://git.kernel.org/tip/9483409ab5067941860754e78a4a44a60311d276 Author: Namhyung Kim <[email protected]> AuthorDate: Mon, 15 Mar 2021 12:34:36 +09:00 Committer: Peter Zijlstra <[email protected]> CommitterDate: Tue, 16 Mar 2021 21:44:42 +01:00
perf core: Allocate perf_buffer in the target node memory
I found the ring buffer pages are allocated in the node but the ring buffer itself is not. Let's convert it to use kzalloc_node() too.
Signed-off-by Namhyung Kim <[email protected]>
Signed-off-by Peter Zijlstra (Intel) <[email protected]>
--- kernel/events/ring_buffer.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
kernel/events/ring_buffer.c +6 -3
@@ -804,7 +804,7 @@ struct perf_buffer *rb_alloc(int nr_pages, long watermark, int cpu, int flags) {struct perf_buffer *rb;unsigned long size; -int i; +int i, node; size =sizeof (struct perf_buffer ); size += nr_pages *sizeof (void *);
@@ -812,7 +812,8 @@ struct perf_buffer *rb_alloc(int nr_pages, long watermark, int cpu, int flags)if (order_base_2 (size) >=PAGE_SHIFT +MAX_ORDER ) goto fail; - rb =kzalloc (size,GFP_KERNEL ); + node = (cpu ==-1 ) ? cpu :cpu_to_node (cpu); + rb =kzalloc_node (size,GFP_KERNEL , node);if (!rb) goto fail;
@@ -906,11 +907,13 @@ struct perf_buffer *rb_alloc(int nr_pages, long watermark, int cpu, int flags)struct perf_buffer *rb;unsigned long size;void *all_buf; +int node; size =sizeof (struct perf_buffer ); size +=sizeof (void *); - rb =kzalloc (size,GFP_KERNEL ); + node = (cpu ==-1 ) ? cpu :cpu_to_node (cpu); + rb =kzalloc_node (size,GFP_KERNEL , node);if (!rb) goto fail;