From: Qi Zheng <zhengqi.arch@bytedance.com>
To: Julia Lawall <julia.lawall@inria.fr>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Linux Memory Management List <linux-mm@kvack.org>,
Muchun Song <songmuchun@bytedance.com>,
oe-kbuild-all@lists.linux.dev
Subject: Re: [linux-next:master 8008/8345] mm/shrinker.c:100:1-7: preceding lock on line 83 (fwd)
Date: Sat, 30 Sep 2023 00:03:00 +0800 [thread overview]
Message-ID: <b25c58b8-763d-7913-2d16-7f6bb53220f2@bytedance.com> (raw)
In-Reply-To: <alpine.DEB.2.22.394.2309291632020.3137@hadrien>
Hi Julia,
On 2023/9/29 22:33, Julia Lawall wrote:
> Should shrinker_mutex be released on the error path?
Yes, and this has been fixed by
https://lore.kernel.org/lkml/20230928141517.12164-1-zhengqi.arch@bytedance.com/.
Thanks,
Qi
>
> julia
>
> ---------- Forwarded message ----------
> Date: Fri, 29 Sep 2023 21:31:25 +0800
> From: kernel test robot <lkp@intel.com>
> To: oe-kbuild@lists.linux.dev
> Cc: lkp@intel.com, Julia Lawall <julia.lawall@inria.fr>
> Subject: [linux-next:master 8008/8345] mm/shrinker.c:100:1-7: preceding lock on
> line 83
>
> BCC: lkp@intel.com
> CC: oe-kbuild-all@lists.linux.dev
> CC: Linux Memory Management List <linux-mm@kvack.org>
> TO: Qi Zheng <zhengqi.arch@bytedance.com>
> CC: Andrew Morton <akpm@linux-foundation.org>
> CC: Linux Memory Management List <linux-mm@kvack.org>
> CC: Muchun Song <songmuchun@bytedance.com>
>
> Hi Qi,
>
> FYI, the error/warning was bisected to this commit, please ignore it if it's irrelevant.
>
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
> head: df964ce9ef9fea10cf131bf6bad8658fde7956f6
> commit: 3b0ec351e30dfbe71675deb22da8a9fe1894c87f [8008/8345] mm: shrinker: convert shrinker_rwsem to mutex
> :::::: branch date: 9 hours ago
> :::::: commit date: 3 days ago
> config: x86_64-randconfig-103-20230927 (https://download.01.org/0day-ci/archive/20230929/202309292114.VMjkyBBq-lkp@intel.com/config)
> compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
> reproduce: (https://download.01.org/0day-ci/archive/20230929/202309292114.VMjkyBBq-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>
> | Reported-by: Julia Lawall <julia.lawall@inria.fr>
> | Closes: https://lore.kernel.org/r/202309292114.VMjkyBBq-lkp@intel.com/
>
> cocci warnings: (new ones prefixed by >>)
>>> mm/shrinker.c:100:1-7: preceding lock on line 83
>
> vim +100 mm/shrinker.c
>
> 2babd0d6e9cfca Qi Zheng 2023-09-11 76
> 2babd0d6e9cfca Qi Zheng 2023-09-11 77 int alloc_shrinker_info(struct mem_cgroup *memcg)
> 2babd0d6e9cfca Qi Zheng 2023-09-11 78 {
> 2babd0d6e9cfca Qi Zheng 2023-09-11 79 struct shrinker_info *info;
> b6884b5f15cf5a Qi Zheng 2023-09-11 80 int nid, ret = 0;
> b6884b5f15cf5a Qi Zheng 2023-09-11 81 int array_size = 0;
> 2babd0d6e9cfca Qi Zheng 2023-09-11 82
> 3b0ec351e30dfb Qi Zheng 2023-09-11 @83 mutex_lock(&shrinker_mutex);
> b6884b5f15cf5a Qi Zheng 2023-09-11 84 array_size = shrinker_unit_size(shrinker_nr_max);
> 2babd0d6e9cfca Qi Zheng 2023-09-11 85 for_each_node(nid) {
> b6884b5f15cf5a Qi Zheng 2023-09-11 86 info = kvzalloc_node(sizeof(*info) + array_size, GFP_KERNEL, nid);
> b6884b5f15cf5a Qi Zheng 2023-09-11 87 if (!info)
> b6884b5f15cf5a Qi Zheng 2023-09-11 88 goto err;
> 2babd0d6e9cfca Qi Zheng 2023-09-11 89 info->map_nr_max = shrinker_nr_max;
> b6884b5f15cf5a Qi Zheng 2023-09-11 90 if (shrinker_unit_alloc(info, NULL, nid))
> b6884b5f15cf5a Qi Zheng 2023-09-11 91 goto err;
> 2babd0d6e9cfca Qi Zheng 2023-09-11 92 rcu_assign_pointer(memcg->nodeinfo[nid]->shrinker_info, info);
> 2babd0d6e9cfca Qi Zheng 2023-09-11 93 }
> 3b0ec351e30dfb Qi Zheng 2023-09-11 94 mutex_unlock(&shrinker_mutex);
> 2babd0d6e9cfca Qi Zheng 2023-09-11 95
> 2babd0d6e9cfca Qi Zheng 2023-09-11 96 return ret;
> b6884b5f15cf5a Qi Zheng 2023-09-11 97
> b6884b5f15cf5a Qi Zheng 2023-09-11 98 err:
> b6884b5f15cf5a Qi Zheng 2023-09-11 99 free_shrinker_info(memcg);
> b6884b5f15cf5a Qi Zheng 2023-09-11 @100 return -ENOMEM;
> 2babd0d6e9cfca Qi Zheng 2023-09-11 101 }
> 2babd0d6e9cfca Qi Zheng 2023-09-11 102
>
> :::::: The code at line 100 was first introduced by commit
> :::::: b6884b5f15cf5acf6886ec0704d799035477ad7e mm: shrinker: add a secondary array for shrinker_info::{map, nr_deferred}
>
> :::::: TO: Qi Zheng <zhengqi.arch@bytedance.com>
> :::::: CC: Andrew Morton <akpm@linux-foundation.org>
>
prev parent reply other threads:[~2023-09-29 16:03 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-29 14:33 Julia Lawall
2023-09-29 16:03 ` Qi Zheng [this message]
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=b25c58b8-763d-7913-2d16-7f6bb53220f2@bytedance.com \
--to=zhengqi.arch@bytedance.com \
--cc=akpm@linux-foundation.org \
--cc=julia.lawall@inria.fr \
--cc=linux-mm@kvack.org \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=songmuchun@bytedance.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