From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id C0B98ECAAD3 for ; Fri, 2 Sep 2022 00:14:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 57F218D0009; Thu, 1 Sep 2022 20:14:51 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 52E288D0002; Thu, 1 Sep 2022 20:14:51 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3F7178D0009; Thu, 1 Sep 2022 20:14:51 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 2DEB08D0002 for ; Thu, 1 Sep 2022 20:14:51 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 0866AC0C91 for ; Fri, 2 Sep 2022 00:14:51 +0000 (UTC) X-FDA: 79865224782.19.FC979A0 Received: from mail-oa1-f66.google.com (mail-oa1-f66.google.com [209.85.160.66]) by imf04.hostedemail.com (Postfix) with ESMTP id A40514004E for ; Fri, 2 Sep 2022 00:14:50 +0000 (UTC) Received: by mail-oa1-f66.google.com with SMTP id 586e51a60fabf-1225219ee46so1260030fac.2 for ; Thu, 01 Sep 2022 17:14:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date; bh=gKp98spEweFUGFmaHflLEq6ZQ2lg9SKE97iSlwXZRWk=; b=b3fx0Lq5OQIejVvIPchFJmhhaRpuR7yq6Mz+SI9N1fGg+lSTtC6oFKYaKWQLRoDBfY DHgPJ+9tRxH5fv7akPGi6AaQwFNLluX4V7WBUcsRK0a5GdYv5749hSMj9fV3ZNdl+yit mX+0YZ4o2wQ4L54SfDgQxU7YemcqWENW8F40qSVXaQyZc3TLPnxA3u8d0Q2nMyhtTlJv jcC1Q81d55Pgcl9KGQaGc0wct2uzOQebukS2E0pgSGVJWD5Cle05ykv7yV+TtlNf4eGL 3dYrJzbmUzuQ05MdBkPYzopmZnwtTMvZufcWtfM/L5AK1CDt65mpLrsU8OpRfJdOB8kf kKKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date; bh=gKp98spEweFUGFmaHflLEq6ZQ2lg9SKE97iSlwXZRWk=; b=Q2n+eLroG8+/U+aLLpuJZbcibFMTMNpzeNpbEpcsCUOxSopbzUcXVKbc8b6GSIaYeZ hnYNdlJ7ZFmpu+h+ew3BtOXuznszwowR7qYlGIErJpbbzPdbS7Ue4PUNGk3XcIgqJFE7 QGQseiduYHPexbiTeMYsQy7v67qOi4eoZc3ad/6g4QJN5XlmsiOnJ/PHCdfgJ7Na7rDk U4IYwY4Mq24gM/Os533kqX/YBX3le2lxz1ejQIX4TkzDliZLoItho+8Q1oc+rTeTCLS5 8dJAMZlSWIEPXyhdG5zxvW253dLu1mixcCWs43zxfCYT0D4nr2ZrKr9Wl8cxaWzUStl9 CAYw== X-Gm-Message-State: ACgBeo1fBRRu5PRxxsgenNkQ9KG9+eItduYFJeO4A29vG1AEPeGLr9oj aUZWnTrYVwV0qXeCW3DkCPPfOBPW3jY= X-Google-Smtp-Source: AA6agR6qNPSkUFTWari9DLPob4stRjrElutvNL9JQO3j+rRkmaCUD31HuOEVA2sXN79I29N56Y5JIg== X-Received: by 2002:a05:6870:3282:b0:122:58aa:3fbd with SMTP id q2-20020a056870328200b0012258aa3fbdmr977288oac.12.1662077689859; Thu, 01 Sep 2022 17:14:49 -0700 (PDT) Received: from sophie (static-198-54-128-70.cust.tzulo.com. [198.54.128.70]) by smtp.gmail.com with ESMTPSA id u42-20020a056870d5aa00b00120f7de7f6esm352544oao.58.2022.09.01.17.14.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Sep 2022 17:14:48 -0700 (PDT) Date: Thu, 1 Sep 2022 19:14:47 -0500 From: Rebecca Mckeever To: Mike Rapoport Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, David Hildenbrand Subject: Re: [PATCH v2 1/4] memblock tests: add simulation of physical memory with multiple NUMA nodes Message-ID: <20220902001447.GA18733@sophie> References: <0cfb3c69ba6ca9ff55e1fc2528d18d108416ba57.1660897864.git.remckee0@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1662077690; a=rsa-sha256; cv=none; b=cqLWra9z5k2fGAZAX1MPBxxaLptw6ipFh6eZHldKMo+6TlWbt8pYfKQGVnmzb6dl4wnIJO pH8BAcmZwcn7RWox5NL5Bnr9mpaj3AuKGPtLXI3mH9Ob/sEo5EwkzZ2grkClcoeMS2y3CJ kzjjY6DeKeWEL05td7bLvKidkpeNf/Q= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=b3fx0Lq5; spf=pass (imf04.hostedemail.com: domain of remckee0@gmail.com designates 209.85.160.66 as permitted sender) smtp.mailfrom=remckee0@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1662077690; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=gKp98spEweFUGFmaHflLEq6ZQ2lg9SKE97iSlwXZRWk=; b=VOFWRdMebVnIxFoZYNVHcwwCoyMDorcK3iCiOLaXSUc+CRahmVWd0omfg2PxwUAfyc+L82 +FJK9/K2wUa6fG5ibOBCZ1Ooa4kYGHzOUr11hb6cVh8MC+4cREIFVJeUQ9fvbip5nNpBHR /RsqLxsPm3R1GNkTcVaH+V6Rb42SgZc= X-Stat-Signature: 4mb7hi3wuc6hyrrndrkqyswd1unatz95 X-Rspam-User: X-Rspamd-Queue-Id: A40514004E X-Rspamd-Server: rspam07 Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=b3fx0Lq5; spf=pass (imf04.hostedemail.com: domain of remckee0@gmail.com designates 209.85.160.66 as permitted sender) smtp.mailfrom=remckee0@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-HE-Tag: 1662077690-193811 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Wed, Aug 31, 2022 at 06:15:41PM +0300, Mike Rapoport wrote: > 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 > > --- > > .../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. > Okay, will do. > > +{ > > + 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. Thanks, Rebecca