Linux Test Project
 help / color / mirror / Atom feed
From: Li Wang <li.wang@linux.dev>
To: Andrea Cervesato <andrea.cervesato@suse.com>
Cc: ltp@lists.linux.it, Li Wang <liwang@hygon.cn>
Subject: Re: [LTP] [PATCH 1/2] madvise09: restore cgroup v1 memory limits with numeric values
Date: Thu, 30 Jul 2026 20:52:37 +0800	[thread overview]
Message-ID: <amtJFVYrok5gb5q2@linux.dev> (raw)
In-Reply-To: <6a6b3464.9099b29d.17a1f7.d2b1@mx.google.com>

Andrea Cervesato wrote:

> > +	if (TST_CG_VER_IS_V1(tst_cg, "memory")) {
> > +		SAFE_CG_PRINTF(tst_cg, "memory.max", "%lld", ori_mem_limit);
> > +
> > +		if (swap_accounting_enabled)
> > +			SAFE_CG_PRINTF(tst_cg, "memory.swap.max", "%lld", ori_swap_limit);
> > +	} else {
> > +		SAFE_CG_PRINT(tst_cg, "memory.max", "max");
> > +
> > +		if (swap_accounting_enabled)
> > +			SAFE_CG_PRINT(tst_cg, "memory.swap.max", "max");
> > +	}

> >  static void setup(void)
> >  {
> > -	if (SAFE_CG_HAS(tst_cg, "memory.swap.max"))
> > +	if (TST_CG_VER_IS_V1(tst_cg, "memory"))
> > +		SAFE_CG_SCANF(tst_cg, "memory.max", "%lld", &ori_mem_limit);
> > +
> > +	if (SAFE_CG_HAS(tst_cg, "memory.swap.max")) {
> >  		swap_accounting_enabled = 1;
> > -	else
> > +
> > +		if (TST_CG_VER_IS_V1(tst_cg, "memory"))
> > +			SAFE_CG_SCANF(tst_cg, "memory.swap.max", "%lld", &ori_swap_limit);
> > +	} else {
> >  		tst_res(TINFO, "Swap accounting is disabled");
> > +	}
> 
> 
> I see a pattern inside text function and setup(), maybe we can create
> a function that reset memory.max and memory.swap.max in one place.

Not exactly, the logic in setup (save) and test (restore) are
not identical, one reads the other writes. 

Or, did I miss anything there?

-- 
Regards,
Li Wang

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

  reply	other threads:[~2026-07-30 12:53 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-30  7:41 [LTP] [PATCH 1/2] madvise09: restore cgroup v1 memory limits with numeric values Li Wang
2026-07-30  7:41 ` [LTP] [PATCH 2/2] mailmap: enable liwang@hygon.cn address Li Wang
2026-07-30  8:26   ` Andrea Cervesato via ltp
2026-07-30  9:51   ` Petr Vorel
2026-07-30 10:09     ` Li Wang
2026-07-30 11:02       ` Andrea Cervesato via ltp
2026-07-30  8:29 ` [LTP] madvise09: restore cgroup v1 memory limits with numeric values linuxtestproject.agent
2026-07-30  9:43   ` Li Wang
2026-07-30 11:24 ` [LTP] [PATCH 1/2] " Andrea Cervesato via ltp
2026-07-30 12:52   ` Li Wang [this message]
2026-07-30 12:55     ` Andrea Cervesato via ltp

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=amtJFVYrok5gb5q2@linux.dev \
    --to=li.wang@linux.dev \
    --cc=andrea.cervesato@suse.com \
    --cc=liwang@hygon.cn \
    --cc=ltp@lists.linux.it \
    /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