On Thu, Apr 08, 2021 at 07:28:01AM +0800, Wang Yugui wrote:
> Hi,
>
> > > > > upper caller:
> > > > > nofs_flag = memalloc_nofs_save();
> > > > > ret = btrfs_drew_lock_init(&root->snapshot_lock);
> > > > > memalloc_nofs_restore(nofs_flag);
> >
> > The issue is here. nofs is set which means percpu attempts an atomic
> > allocation. If it cannot find anything already allocated it isn't happy.
> > This was done before memalloc_nofs_{save/restore}() were pervasive.
> >
> > Percpu should probably try to allocate some pages if possible even if
> > nofs is set.
>
> Thanks.
>
> I will wait for the patch, and then test it.
>
I'm currently a bit busy with some other things. Adding support I don't
think will be much work, just a little bit tricky.
I recommend carrying what you have minus the change to reserved percpu
memory for now. If I'm the one to write it, I'll cc you.
Thanks,
Dennis