mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 04:33:26 +02:00
Merge tag 'memblock-v6.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rppt/memblock
Pull memblock updates from Mike Rapoport: - add test for memblock_alloc_node() - minor coding style fixes - add flags and nid info in memblock debugfs * tag 'memblock-v6.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rppt/memblock: memblock: Update nid info in memblock debugfs memblock: Add flags and nid info in memblock debugfs Fix some coding style errors in memblock.c Add tests for memblock_alloc_node()
This commit is contained in:
@@ -156,10 +156,10 @@ static __refdata struct memblock_type *memblock_memory = &memblock.memory;
|
|||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
static int memblock_debug __initdata_memblock;
|
static int memblock_debug __initdata_memblock;
|
||||||
static bool system_has_some_mirror __initdata_memblock = false;
|
static bool system_has_some_mirror __initdata_memblock;
|
||||||
static int memblock_can_resize __initdata_memblock;
|
static int memblock_can_resize __initdata_memblock;
|
||||||
static int memblock_memory_in_slab __initdata_memblock = 0;
|
static int memblock_memory_in_slab __initdata_memblock;
|
||||||
static int memblock_reserved_in_slab __initdata_memblock = 0;
|
static int memblock_reserved_in_slab __initdata_memblock;
|
||||||
|
|
||||||
static enum memblock_flags __init_memblock choose_memblock_flags(void)
|
static enum memblock_flags __init_memblock choose_memblock_flags(void)
|
||||||
{
|
{
|
||||||
@@ -2178,20 +2178,44 @@ void __init memblock_free_all(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if defined(CONFIG_DEBUG_FS) && defined(CONFIG_ARCH_KEEP_MEMBLOCK)
|
#if defined(CONFIG_DEBUG_FS) && defined(CONFIG_ARCH_KEEP_MEMBLOCK)
|
||||||
|
static const char * const flagname[] = {
|
||||||
|
[ilog2(MEMBLOCK_HOTPLUG)] = "HOTPLUG",
|
||||||
|
[ilog2(MEMBLOCK_MIRROR)] = "MIRROR",
|
||||||
|
[ilog2(MEMBLOCK_NOMAP)] = "NOMAP",
|
||||||
|
[ilog2(MEMBLOCK_DRIVER_MANAGED)] = "DRV_MNG",
|
||||||
|
};
|
||||||
|
|
||||||
static int memblock_debug_show(struct seq_file *m, void *private)
|
static int memblock_debug_show(struct seq_file *m, void *private)
|
||||||
{
|
{
|
||||||
struct memblock_type *type = m->private;
|
struct memblock_type *type = m->private;
|
||||||
struct memblock_region *reg;
|
struct memblock_region *reg;
|
||||||
int i;
|
int i, j, nid;
|
||||||
|
unsigned int count = ARRAY_SIZE(flagname);
|
||||||
phys_addr_t end;
|
phys_addr_t end;
|
||||||
|
|
||||||
for (i = 0; i < type->cnt; i++) {
|
for (i = 0; i < type->cnt; i++) {
|
||||||
reg = &type->regions[i];
|
reg = &type->regions[i];
|
||||||
end = reg->base + reg->size - 1;
|
end = reg->base + reg->size - 1;
|
||||||
|
nid = memblock_get_region_node(reg);
|
||||||
|
|
||||||
seq_printf(m, "%4d: ", i);
|
seq_printf(m, "%4d: ", i);
|
||||||
seq_printf(m, "%pa..%pa\n", ®->base, &end);
|
seq_printf(m, "%pa..%pa ", ®->base, &end);
|
||||||
|
if (nid != MAX_NUMNODES)
|
||||||
|
seq_printf(m, "%4d ", nid);
|
||||||
|
else
|
||||||
|
seq_printf(m, "%4c ", 'x');
|
||||||
|
if (reg->flags) {
|
||||||
|
for (j = 0; j < count; j++) {
|
||||||
|
if (reg->flags & (1U << j)) {
|
||||||
|
seq_printf(m, "%s\n", flagname[j]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (j == count)
|
||||||
|
seq_printf(m, "%s\n", "UNKNOWN");
|
||||||
|
} else {
|
||||||
|
seq_printf(m, "%s\n", "NONE");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@@ -2494,6 +2494,35 @@ static int alloc_nid_numa_split_all_reserved_generic_check(void)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* A simple test that tries to allocate a memory region through the
|
||||||
|
* memblock_alloc_node() on a NUMA node with id `nid`. Expected to have the
|
||||||
|
* correct NUMA node set for the new region.
|
||||||
|
*/
|
||||||
|
static int alloc_node_on_correct_nid(void)
|
||||||
|
{
|
||||||
|
int nid_req = 2;
|
||||||
|
void *allocated_ptr = NULL;
|
||||||
|
#ifdef CONFIG_NUMA
|
||||||
|
struct memblock_region *req_node = &memblock.memory.regions[nid_req];
|
||||||
|
#endif
|
||||||
|
phys_addr_t size = SZ_512;
|
||||||
|
|
||||||
|
PREFIX_PUSH();
|
||||||
|
setup_numa_memblock(node_fractions);
|
||||||
|
|
||||||
|
allocated_ptr = memblock_alloc_node(size, SMP_CACHE_BYTES, nid_req);
|
||||||
|
|
||||||
|
ASSERT_NE(allocated_ptr, NULL);
|
||||||
|
#ifdef CONFIG_NUMA
|
||||||
|
ASSERT_EQ(nid_req, req_node->nid);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
test_pass_pop();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* Test case wrappers for NUMA tests */
|
/* Test case wrappers for NUMA tests */
|
||||||
static int alloc_nid_numa_simple_check(void)
|
static int alloc_nid_numa_simple_check(void)
|
||||||
{
|
{
|
||||||
@@ -2632,6 +2661,15 @@ static int alloc_nid_numa_split_all_reserved_check(void)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int alloc_node_numa_on_correct_nid(void)
|
||||||
|
{
|
||||||
|
test_print("\tRunning %s...\n", __func__);
|
||||||
|
run_top_down(alloc_node_on_correct_nid);
|
||||||
|
run_bottom_up(alloc_node_on_correct_nid);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int __memblock_alloc_nid_numa_checks(void)
|
int __memblock_alloc_nid_numa_checks(void)
|
||||||
{
|
{
|
||||||
test_print("Running %s NUMA tests...\n",
|
test_print("Running %s NUMA tests...\n",
|
||||||
@@ -2652,6 +2690,8 @@ int __memblock_alloc_nid_numa_checks(void)
|
|||||||
alloc_nid_numa_reserved_full_merge_check();
|
alloc_nid_numa_reserved_full_merge_check();
|
||||||
alloc_nid_numa_split_all_reserved_check();
|
alloc_nid_numa_split_all_reserved_check();
|
||||||
|
|
||||||
|
alloc_node_numa_on_correct_nid();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user