mem2node.c (820e9906cf64142169134f35b996108303cf22ca) mem2node.c (d68f0365087395fe232e39ac9c8ee53627522c3c)
1// SPDX-License-Identifier: GPL-2.0
2#include <linux/compiler.h>
3#include <linux/bitmap.h>
4#include <linux/kernel.h>
5#include <linux/zalloc.h>
6#include <perf/cpumap.h>
7#include <internal/cpumap.h>
8#include "debug.h"

--- 29 unchanged lines hidden (view full) ---

38 if (map)
39 perf_cpu_map__put(map);
40 else
41 free(bm);
42
43 return bm && map ? bm : NULL;
44}
45
1// SPDX-License-Identifier: GPL-2.0
2#include <linux/compiler.h>
3#include <linux/bitmap.h>
4#include <linux/kernel.h>
5#include <linux/zalloc.h>
6#include <perf/cpumap.h>
7#include <internal/cpumap.h>
8#include "debug.h"

--- 29 unchanged lines hidden (view full) ---

38 if (map)
39 perf_cpu_map__put(map);
40 else
41 free(bm);
42
43 return bm && map ? bm : NULL;
44}
45
46int test__mem2node(struct test *t __maybe_unused, int subtest __maybe_unused)
46static int test__mem2node(struct test *t __maybe_unused, int subtest __maybe_unused)
47{
48 struct mem2node map;
49 struct memory_node nodes[3];
50 struct perf_env env = {
51 .memory_nodes = (struct memory_node *) &nodes[0],
52 .nr_memory_nodes = ARRAY_SIZE(nodes),
53 .memory_bsize = 0x100,
54 };

--- 17 unchanged lines hidden (view full) ---

72 T("failed: mem2node__node", -1 == mem2node__node(&map, 0x1050));
73
74 for (i = 0; i < ARRAY_SIZE(nodes); i++)
75 zfree(&nodes[i].set);
76
77 mem2node__exit(&map);
78 return 0;
79}
47{
48 struct mem2node map;
49 struct memory_node nodes[3];
50 struct perf_env env = {
51 .memory_nodes = (struct memory_node *) &nodes[0],
52 .nr_memory_nodes = ARRAY_SIZE(nodes),
53 .memory_bsize = 0x100,
54 };

--- 17 unchanged lines hidden (view full) ---

72 T("failed: mem2node__node", -1 == mem2node__node(&map, 0x1050));
73
74 for (i = 0; i < ARRAY_SIZE(nodes); i++)
75 zfree(&nodes[i].set);
76
77 mem2node__exit(&map);
78 return 0;
79}
80
81DEFINE_SUITE("mem2node", mem2node);