* [linux-next:master 8008/8345] mm/shrinker.c:100:1-7: preceding lock on line 83 (fwd)
@ 2023-09-29 14:33 Julia Lawall
2023-09-29 16:03 ` Qi Zheng
0 siblings, 1 reply; 2+ messages in thread
From: Julia Lawall @ 2023-09-29 14:33 UTC (permalink / raw)
To: Qi Zheng
Cc: Andrew Morton, Linux Memory Management List, Muchun Song, oe-kbuild-all
Should shrinker_mutex be released on the error path?
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>
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [linux-next:master 8008/8345] mm/shrinker.c:100:1-7: preceding lock on line 83 (fwd)
2023-09-29 14:33 [linux-next:master 8008/8345] mm/shrinker.c:100:1-7: preceding lock on line 83 (fwd) Julia Lawall
@ 2023-09-29 16:03 ` Qi Zheng
0 siblings, 0 replies; 2+ messages in thread
From: Qi Zheng @ 2023-09-29 16:03 UTC (permalink / raw)
To: Julia Lawall
Cc: Andrew Morton, Linux Memory Management List, Muchun Song, oe-kbuild-all
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>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-09-29 16:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-29 14:33 [linux-next:master 8008/8345] mm/shrinker.c:100:1-7: preceding lock on line 83 (fwd) Julia Lawall
2023-09-29 16:03 ` Qi Zheng
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox