On Tue, Sep 3, 2024 at 10:29 AM Theodore Ts'o <tytso@xxxxxxx> wrote: > > On Fri, Aug 23, 2024 at 04:22:37PM +0800, zhaoyang.huang wrote: > > > > +#ifndef CONFIG_CMA > > bh = sb_getblk(inode->i_sb, map.m_pblk); > > +#else > > + bh = sb_getblk_gfp(inode->i_sb, map.m_pblk, 0); > > +#endif > > So all of these patches to try to work around your issue with CMA are > a bit ugly. But passing in a GFP mask of zero is definitely not the > right way to go about thing, since there might be certain GFP masks > that are required by a particular block device. What I think you are > trying to do is to avoid setting the __GFP_MOVEABLE flag. So in that > case, in the CMA path something like this is what you want: > > bh = getblk_unmoveable(sb->s_bdev, map.m_pblk, sb->s_blocksize); > > I'd also sugest only trying to use this is the file system has > journaling enabled. If the file system is an ext2 file system without > a journal, there's no reason avoid using the CMA region agree. > assume the reason why the buffer cache is trying to use the moveable > flag is because the amount of non-CMA memory might be a precious > resource in some systems. I don't think so. All migrate type page blocks possess the same position as each other as they could fallback to all migrate types when current fails. I guess the purpose could be to enlarge the scope of available memory as __GFP_MOVEABLE has the capability of recruiting CMA. > > - Ted