public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: Petr Vorel <pvorel@suse.cz>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [RFC][PATCH 0/2] Add safe_get_nodemap()
Date: Mon, 31 Mar 2025 17:52:26 +0200	[thread overview]
Message-ID: <Z-q6Okh-lkvbx5mA@yuki.lan> (raw)
In-Reply-To: <20250328114311.187541-1-pvorel@suse.cz>

Hi!
> not a huge improvement, but because all tst_get_nodemap() are in the
> setup (and only ksm06.c allows input parameter) we could have struct
> tst_test member which would call safe_get_nodemap().
> 
> e.g.:
> 
> .nodemap = (const struct tst_path_val) {
> 		.type = TST_NUMA_MEM
> 		.required = 2,
> },

I do not get this, the struct tst_path_val is something completely
different.

> safe_get_nodemap(tst_test->nodemap->type,
> 	tst_test->nodemap->required * getpagesize() / 1024);
> 
> This would not work for non - page sized nodes, e.g.:
> nodes = tst_get_nodemap(TST_NUMA_MEM, 2 * PAGES_ALLOCATED * page_size / 1024);
> 
> => extra member would need to be added:
> 
> .nodemap = (const struct tst_path_val) {
> 		.type = TST_NUMA_MEM
> 		.required = 2,
> 		.size = PAGES_ALLOCATED, // default == 1
> },

I've avoided the size to be in pages and choosen kilobytes instead
because the page size can differ a lot.

> would call:
> 
> safe_get_nodemap(tst_test->nodemap->type,
> 	tst_test->nodemap->required * tst_test->nodemap->size * getpagesize() / 1024,
         ^
	 This does not make any sense.

The memory parameter is supposed to be minimal free memory on each node,
for each node we check that it has at least min_mem_kb in the
node_has_enough_memory() function.

There is no point in multiplying that by the number of nodes we require.

And this looks like it uses kilobytes not pages.

> 	tst_test->nodemap->required);

I guess that what you meant is that we will add tst_numa structure such as:

struct tst_numa {
	enum tst_numa_types node_type;
	unsigned int min_nodes;
	unsigned int min_mem_kb;
};

And then use that in tst_test structure. That would certainly make
sense, but I guess that we would have to move the numa library to the
lib/ as well. I'm not sure that we can have a function call from
tst_test.c library to something that is not compiled in by default.

-- 
Cyril Hrubis
chrubis@suse.cz

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  parent reply	other threads:[~2025-03-31 15:52 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-28 11:43 [LTP] [RFC][PATCH 0/2] Add safe_get_nodemap() Petr Vorel
2025-03-28 11:43 ` [LTP] [RFC][PATCH 1/2] libs: " Petr Vorel
2025-03-31 16:00   ` Cyril Hrubis
2025-03-31 17:55     ` Petr Vorel
2025-03-28 11:43 ` [LTP] [RFC][PATCH 2/2] Use safe_get_nodemap() Petr Vorel
2025-03-31 16:06   ` Cyril Hrubis
2025-03-31 15:52 ` Cyril Hrubis [this message]
2025-03-31 17:31   ` [LTP] [RFC][PATCH 0/2] Add safe_get_nodemap() Petr Vorel
2025-04-02 10:14     ` Cyril Hrubis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Z-q6Okh-lkvbx5mA@yuki.lan \
    --to=chrubis@suse.cz \
    --cc=ltp@lists.linux.it \
    --cc=pvorel@suse.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox