lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 31 Aug 2022 18:15:41 +0300
From:   Mike Rapoport <rppt@...nel.org>
To:     Rebecca Mckeever <remckee0@...il.com>
Cc:     linux-mm@...ck.org, linux-kernel@...r.kernel.org,
        David Hildenbrand <david@...hat.com>
Subject: Re: [PATCH v2 1/4] memblock tests: add simulation of physical memory
 with multiple NUMA nodes

On Fri, Aug 19, 2022 at 02:05:31AM -0700, Rebecca Mckeever wrote:
> Add functions setup_numa_memblock_generic() and setup_numa_memblock()
> for setting up a memory layout with multiple NUMA nodes in a previously
> allocated dummy physical memory. These functions can be used in place of
> setup_memblock() in tests that need to simulate a NUMA system.
> 
> setup_numa_memblock_generic():
> - allows for setting up a custom memory layout by specifying the amount
>   of memory in each node, the number of nodes, and a factor that will be
>   used to scale the memory in each node
> 
> setup_numa_memblock():
> - allows for setting up a default memory layout
> 
> Introduce constant MEM_FACTOR, which is used to scale the default memory
> layout based on MEM_SIZE.
> 
> Set CONFIG_NODES_SHIFT to 4 when building with NUMA=1 to allow for up to
> 16 NUMA nodes.
> 
> Signed-off-by: Rebecca Mckeever <remckee0@...il.com>
> ---
>  .../testing/memblock/scripts/Makefile.include |  2 +-
>  tools/testing/memblock/tests/common.c         | 38 +++++++++++++++++++
>  tools/testing/memblock/tests/common.h         |  9 ++++-
>  3 files changed, 47 insertions(+), 2 deletions(-)

...
  
> +/**
> + * setup_numa_memblock_generic:
> + * Set up a memory layout with multiple NUMA nodes in a previously allocated
> + * dummy physical memory.
> + * @nodes: an array containing the amount of memory in each node
> + * @node_cnt: the size of @nodes
> + * @factor: a factor that will be used to scale the memory in each node
> + *
> + * The nids will be set to 0 through node_cnt - 1.
> + */
> +void setup_numa_memblock_generic(const phys_addr_t nodes[],
> +				 int node_cnt, int factor)

I only had time for a quick look and it seems this function is never used
on its own.
Let's fold it into setup_numa_memblock() for now.

> +{
> +	phys_addr_t base;
> +	int flags;
> +
> +	reset_memblock_regions();
> +	base = (phys_addr_t)memory_block.base;
> +	flags = (movable_node_is_enabled()) ? MEMBLOCK_NONE : MEMBLOCK_HOTPLUG;
> +
> +	for (int i = 0; i < node_cnt; i++) {
> +		phys_addr_t size = factor * nodes[i];
> +
> +		memblock_add_node(base, size, i, flags);
> +		base += size;
> +	}
> +	fill_memblock();
> +}
> +
> +void setup_numa_memblock(void)
> +{
> +	setup_numa_memblock_generic(node_sizes, NUMA_NODES, MEM_FACTOR);
> +}
> +

-- 
Sincerely yours,
Mike.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ