All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pengfei Xu <pengfei.xu@intel.com>
To: Cyril Hrubis <chrubis@suse.cz>
Cc: Heng Su <heng.su@intel.com>, rpalethorpe@suse.com, ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v1 1/1] libs: libltpnuma: Fix one fake failure when CXL(Compute eXpress Link) node memory is not used
Date: Tue, 9 May 2023 22:27:00 +0800	[thread overview]
Message-ID: <ZFpYNARm7y4b2QBl@xpf.sh.intel.com> (raw)
In-Reply-To: <ZFpUW8OAYPVViMBv@yuki>

Hi Cyril,

On 2023-05-09 at 16:10:35 +0200, Cyril Hrubis wrote:
> Hi!
> > # ./get_mempolicy01
> > tst_test.c:1560: TINFO: Timeout per run is 0h 00m 30s
> > tst_numa.c:208: TINFO: Found 3 NUMA memory nodes
> > tst_numa.c:162: TWARN: Faield to parse '/sys/devices/system/node/node0/meminfo' MemUsed:65220292
> > tst_numa.c:162: TWARN: Faield to parse '/sys/devices/system/node/node1/meminfo' MemUsed:65167784
> > tst_numa.c:162: TWARN: Faield to parse '/sys/devices/system/node/node2/meminfo' MemUsed:4194304
> > get_mempolicy01.c:149: TCONF: test requires at least one NUMA memory node
> > Node 0 and 1 could not be tested with follow patch installed, seems when
> > node2/meminfo "MemUsed: 0",sscanf("...%li", &val) will return 0 if only 0 value
> > will be scaned, and the while loop will scan the char one by one and impact all
> > other node meminfo scan result, it's strange.
> > 
> > If used my patch, I didn't meet this issue.
> 
> Ah, right the file is multiline and we match only one of the lines per
> iteration...
> 
> Then we need:
> 
  Yes, below patch works well and as expected for all nodes memory check now.

  Below way is better and correct.

  Thanks!
  BR.

> diff --git a/libs/libltpnuma/tst_numa.c b/libs/libltpnuma/tst_numa.c
> index ef4c8e879..c3297013b 100644
> --- a/libs/libltpnuma/tst_numa.c
> +++ b/libs/libltpnuma/tst_numa.c
> @@ -127,8 +127,8 @@ static int node_has_enough_memory(int node, size_t min_kb)
>  {
>         char path[1024];
>         char buf[1024];
> -       long mem_total = 0;
> -       long mem_used = 0;
> +       long mem_total = -1;
> +       long mem_used = -1;
>         long file_pages = 0;
>         long mem_avail;
> 
> @@ -161,7 +161,7 @@ static int node_has_enough_memory(int node, size_t min_kb)
> 
>         fclose(fp);
> 
> -       if (!mem_total || !mem_used) {
> +       if (mem_total == -1 || mem_used == -1) {
>                 tst_res(TWARN, "Failed to parse '%s'", path);
>                 return 0;
>         }
> 
> -- 
> Cyril Hrubis
> chrubis@suse.cz

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

  reply	other threads:[~2023-05-09 14:25 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cover.1683274510.git.pengfei.xu@intel.com>
2023-05-05  8:18 ` [LTP] [PATCH v1 1/1] libs: libltpnuma: Fix one fake failure when CXL(Compute eXpress Link) node memory is not used Pengfei Xu
2023-05-09 11:59   ` Cyril Hrubis
2023-05-09 14:05     ` Pengfei Xu
2023-05-09 14:10       ` Cyril Hrubis
2023-05-09 14:27         ` Pengfei Xu [this message]
2023-05-10 15:20           ` Cyril Hrubis
2023-05-11  6:43             ` Pengfei Xu

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=ZFpYNARm7y4b2QBl@xpf.sh.intel.com \
    --to=pengfei.xu@intel.com \
    --cc=chrubis@suse.cz \
    --cc=heng.su@intel.com \
    --cc=ltp@lists.linux.it \
    --cc=rpalethorpe@suse.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.