cgroups.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: YoungJun Park <youngjun.park@lge.com>
To: kernel test robot <lkp@intel.com>
Cc: akpm@linux-foundation.org, hannes@cmpxchg.org,
	oe-kbuild-all@lists.linux.dev, mhocko@kernel.org,
	roman.gushchin@linux.dev, shakeel.butt@linux.dev,
	muchun.song@linux.dev, shikemeng@huaweicloud.com,
	kasong@tencent.com, nphamcs@gmail.com, bhe@redhat.com,
	baohua@kernel.org, chrisl@kernel.org, cgroups@vger.kernel.org,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	gunho.lee@lge.com, iamjoonsoo.kim@lge.com, taejoon.song@lge.com,
	"Michal Koutný" <mkoutny@suse.com>
Subject: Re: [PATCH 1/4] mm/swap, memcg: Introduce infrastructure for cgroup-based swap priority
Date: Tue, 22 Jul 2025 23:09:37 +0900	[thread overview]
Message-ID: <aH+boS+lxLapI796@yjaykim-PowerEdge-T330> (raw)
In-Reply-To: <202507171936.fGW4muEc-lkp@intel.com>

On Thu, Jul 17, 2025 at 07:20:58PM +0800, kernel test robot wrote:
> Hi Youngjun,
> 
> kernel test robot noticed the following build warnings:
> 
> [auto build test WARNING on 347e9f5043c89695b01e66b3ed111755afcf1911]
> 
> url:    https://github.com/intel-lab-lkp/linux/commits/Youngjun-Park/mm-swap-memcg-Introduce-infrastructure-for-cgroup-based-swap-priority/20250717-042648
> base:   347e9f5043c89695b01e66b3ed111755afcf1911
> patch link:    https://lore.kernel.org/r/20250716202006.3640584-2-youngjun.park%40lge.com
> patch subject: [PATCH 1/4] mm/swap, memcg: Introduce infrastructure for cgroup-based swap priority
> config: loongarch-allyesconfig (https://download.01.org/0day-ci/archive/20250717/202507171936.fGW4muEc-lkp@intel.com/config)
> compiler: clang version 21.0.0git (https://github.com/llvm/llvm-project 16534d19bf50bde879a83f0ae62875e2c5120e64)
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250717/202507171936.fGW4muEc-lkp@intel.com/reproduce)
> 
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@intel.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202507171936.fGW4muEc-lkp@intel.com/
> 
> All warnings (new ones prefixed by >>):
> 
> >> mm/memcontrol.c:5462:12: warning: variable 'id' is uninitialized when used here [-Wuninitialized]
>     5462 |                                 memcg, id, SWAP_PRIORITY_GLOBAL);
>          |                                        ^~
>    mm/memcontrol.c:5414:8: note: initialize the variable 'id' to silence this warning
>     5414 |         u64 id;
>          |               ^
>          |                = 0
>    1 warning generated.
> 
> 
> vim +/id +5462 mm/memcontrol.c
> 
>   5408	
>   5409	#ifdef CONFIG_SWAP_CGROUP_PRIORITY
>   5410	static ssize_t swap_cgroup_priority_write(struct kernfs_open_file *of,
>   5411						  char *buf, size_t nbytes, loff_t off)
>   5412	{
>   5413		struct mem_cgroup *memcg = mem_cgroup_from_css(of_css(of));
>   5414		u64 id;
>   5415		int prio;
>   5416		int ret;
>   5417		char first_token[32];
>   5418		char second_token[32];
>   5419		char dummy[2];
>   5420		char *stripped_buf;
>   5421		int num_parsed;
>   5422	
>   5423		stripped_buf = strstrip(buf);
>   5424		num_parsed = sscanf(stripped_buf, "%31s %31s %1s", first_token,
>   5425				    second_token, dummy);
>   5426		if (num_parsed == 2) {
>   5427			if (strcmp(first_token, "default") == 0) {
>   5428				if (strcmp(second_token, "none") == 0)
>   5429					ret = apply_swap_cgroup_priority(
>   5430						memcg, DEFAULT_ID, SWAP_PRIORITY_GLOBAL);
>   5431				else if (strcmp(second_token, "disabled") == 0)
>   5432					ret = apply_swap_cgroup_priority(
>   5433						memcg, DEFAULT_ID, SWAP_PRIORITY_DISABLE);
>   5434				else
>   5435					ret = -EINVAL;
>   5436			} else {
>   5437				ret = kstrtoull(first_token, 10, &id);
>   5438				if (ret)
>   5439					return -EINVAL;
>   5440	
>   5441				if (strcmp(second_token, "none") == 0) {
>   5442					ret = apply_swap_cgroup_priority(
>   5443						memcg, id, SWAP_PRIORITY_GLOBAL);
>   5444				} else if (strcmp(second_token, "disabled") == 0) {
>   5445					ret = apply_swap_cgroup_priority(
>   5446						memcg, id, SWAP_PRIORITY_DISABLE);
>   5447				} else {
>   5448					ret = kstrtoint(second_token, 10, &prio);
>   5449					if (ret)
>   5450						return -EINVAL;
>   5451					if (prio == -1)
>   5452						return -EINVAL;
>   5453					else if (prio > SHRT_MAX || prio < SHRT_MIN)
>   5454						return -EINVAL;
>   5455					ret = apply_swap_cgroup_priority(memcg, id,
>   5456									 prio);
>   5457				}
>   5458			}
>   5459		} else if (num_parsed == 1) {
>   5460			if (strcmp(first_token, "none") == 0)
>   5461				ret = apply_swap_cgroup_priority(
> > 5462					memcg, id, SWAP_PRIORITY_GLOBAL);
>   5463			else if (strcmp(first_token, "disabled") == 0)
>   5464				ret = apply_swap_cgroup_priority(
>   5465					memcg, id, SWAP_PRIORITY_DISABLE);
>   5466			else
>   5467				ret = -EINVAL;
>   5468		} else {
>   5469			return -EINVAL;
>   5470		}
>   5471	
>   5472		if (ret)
>   5473			return ret;
>   5474	
>   5475		return nbytes;
>   5476	}
>   5477	

This is an initialization bug where the "default" value may not be handled
correctly in certain cases, such as:

  e.g. echo none > memory.swap.priority

I should have checked this more carefully. I will fix the issue and add
a test case in the next patch revision.

Best regards,
Youngjun Park

  reply	other threads:[~2025-07-22 14:09 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-16 20:20 [PATCH 0/4] mm/swap, memcg: Support per-cgroup swap device priorities Youngjun Park
2025-07-16 20:20 ` [PATCH 1/4] mm/swap, memcg: Introduce infrastructure for cgroup-based swap priority Youngjun Park
2025-07-17 11:20   ` kernel test robot
2025-07-22 14:09     ` YoungJun Park [this message]
2025-07-18 17:08   ` kernel test robot
2025-07-22 14:11     ` YoungJun Park
2025-07-21 15:13   ` kernel test robot
2025-07-22 14:14     ` YoungJun Park
2025-07-22  8:41   ` Michal Koutný
2025-07-22 14:05     ` YoungJun Park
2025-07-22 18:41       ` YoungJun Park
2025-08-14 14:03         ` Michal Koutný
2025-08-15 15:10           ` Chris Li
2025-08-16 17:21             ` YoungJun Park
2025-08-16 19:15               ` Chris Li
2025-08-19 10:12                 ` YoungJun Park
2025-08-20  0:52                   ` Chris Li
2025-08-20 14:39                     ` YoungJun Park
2025-08-21 20:39                       ` Chris Li
2025-08-22  5:45                         ` YoungJun Park
2025-08-22 16:48                           ` Chris Li
2025-08-24 12:05                             ` YoungJun Park
2025-08-26  8:19                               ` Chris Li
2025-08-26 12:57                                 ` YoungJun Park
2025-08-26 14:30                                   ` Chris Li
2025-08-30  4:05                                     ` YoungJun Park
2025-08-30  7:13                                       ` Chris Li
2025-08-31 13:53                                         ` YoungJun Park
2025-08-31 16:45                                           ` Chris Li
2025-09-01 16:03                                             ` YoungJun Park
2025-09-01 16:06                                             ` YoungJun Park
2025-09-01 22:40                                               ` Chris Li
2025-08-24 14:19                             ` YoungJun Park
2025-08-16 16:41           ` YoungJun Park
2025-07-16 20:20 ` [PATCH 2/4] mm: swap: Apply per-cgroup swap priority mechanism to swap layer Youngjun Park
2025-07-16 20:20 ` [PATCH 3/4] mm: memcg: Add swap cgroup priority inheritance mechanism Youngjun Park
2025-07-16 20:20 ` [PATCH 4/4] mm: swap: Per-cgroup per-CPU swap device cache with shared clusters Youngjun Park
2025-07-22 17:44   ` Kairui Song
2025-07-22 18:30     ` YoungJun Park

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=aH+boS+lxLapI796@yjaykim-PowerEdge-T330 \
    --to=youngjun.park@lge.com \
    --cc=akpm@linux-foundation.org \
    --cc=baohua@kernel.org \
    --cc=bhe@redhat.com \
    --cc=cgroups@vger.kernel.org \
    --cc=chrisl@kernel.org \
    --cc=gunho.lee@lge.com \
    --cc=hannes@cmpxchg.org \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=kasong@tencent.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lkp@intel.com \
    --cc=mhocko@kernel.org \
    --cc=mkoutny@suse.com \
    --cc=muchun.song@linux.dev \
    --cc=nphamcs@gmail.com \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=roman.gushchin@linux.dev \
    --cc=shakeel.butt@linux.dev \
    --cc=shikemeng@huaweicloud.com \
    --cc=taejoon.song@lge.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).