Re: [akpm-mm:mm-new 193/194] lib/alloc_tag.c:815:25: sparse: sparse: cast removes address space '__rcu' of expression

Hao Ge
2026-03-31T08:49:49Z

Hi

On 2026/3/29 12:36, kernel test robot wrote:
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-new
> head: df2267b6380964f1305128001f05bc043ddf1f37
> commit: 8bee7b4b574f880ff2c7491212e2ef01cd82f2fd [193/194] mm/alloc_tag: clear codetag for pages allocated before page_ext initialization
> config: openrisc-randconfig-r121-20260329 (https://download.01.org/0day-ci/archive/20260329/202603291211.YhY0R0se-lkp@intel.com/config)
> compiler: or1k-linux-gcc (GCC) 10.5.0
> sparse: v0.6.5-rc1
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260329/202603291211.YhY0R0se-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/202603291211.YhY0R0se-lkp@intel.com/
>
> sparse warnings: (new ones prefixed by >>)
>>> lib/alloc_tag.c:815:25: sparse: sparse: cast removes address space '__rcu' of expression
>>> lib/alloc_tag.c:815:25: sparse: sparse: incompatible types in comparison expression (different address spaces):
> lib/alloc_tag.c:815:25: sparse: void ( [noderef] __rcu * )( ... )
> lib/alloc_tag.c:815:25: sparse: void ( * )( ... )
> lib/alloc_tag.c:828:9: sparse: sparse: incompatible types in comparison expression (different address spaces):
> lib/alloc_tag.c:828:9: sparse: void ( [noderef] __rcu * )( ... )
> lib/alloc_tag.c:828:9: sparse: void ( * )( ... )
>
> vim +/__rcu +815 lib/alloc_tag.c
>
> 802
> 803 typedef void (*alloc_tag_add_func)(unsigned long pfn);
> 804 static alloc_tag_add_func __rcu alloc_tag_add_early_pfn_ptr __refdata =
> 805 __alloc_tag_add_early_pfn;
> 806
> 807 void alloc_tag_add_early_pfn(unsigned long pfn)
> 808 {
> 809 alloc_tag_add_func alloc_tag_add;
> 810
> 811 if (static_key_enabled(&mem_profiling_compressed))
> 812 return;
> 813
> 814 rcu_read_lock();
> > 815 alloc_tag_add = rcu_dereference(alloc_tag_add_early_pfn_ptr);
> 816 if (alloc_tag_add)
> 817 alloc_tag_add(pfn);
> 818 rcu_read_unlock();
> 819 }
> 820
>
Thanks.

The v4 patch I've just posted has fixed the issue. Thanks for your report.

Thanks

Hao