Re: [PATCH 2/3] mm: use get_i_mmap_root to access the file's i_mmap

Huang Shijie
2026-04-13T06:55:07Z

On Mon, Apr 13, 2026 at 06:44:30AM +0000, sashiko-bot@kernel.org wrote:
> Sashiko AI review found 1 potential issue(s):
> - [Low] Compilation error in mm/nommu.c due to incorrect struct inode member access.
> --
>
> commit e38eaf1de7eaee855cd4763bac9c006d3d26fa76
> Author: Huang Shijie <huangsj@hygon.cn>
>
> mm: use get_i_mmap_root to access the file's i_mmap
>
> This commit introduces get_i_mmap_root() to access the i_mmap interval tree
> in struct address_space and refactors multiple architectures and subsystems
> to use this new helper.
>
> > diff --git a/mm/nommu.c b/mm/nommu.c
> > index ed3934bc2de48..418c8c91689df 100644
> > --- a/mm/nommu.c
> > +++ b/mm/nommu.c
>
> [ ... ]
>
> > @@ -1804,6 +1804,7 @@ EXPORT_SYMBOL_GPL(copy_remote_vm_str);
> > int nommu_shrink_inode_mappings(struct inode *inode, size_t size,
> > size_t newsize)
> > {
> > + struct rb_root_cached *root = get_i_mmap_root(&inode->mapping);
>
> Does this cause a compilation error for nommu configurations? It looks like
> struct inode uses the member name i_mapping, rather than mapping.
>
> Also, since i_mapping is a pointer to an address_space, taking its address
> with the & operator passes a pointer-to-pointer, whereas get_i_mmap_root()
> expects a struct address_space *. Could this be updated to use
> get_i_mmap_root(inode->i_mapping) instead?
Yes. thanks for pointing this.

Thanks
Huang Shijie