On 2020/4/5 11:53 下午, Guoqing Jiang wrote: > On 02.04.20 10:13, Coly Li wrote: >> - scribble = kvmalloc_array(cnt, obj_size, flags); >> + scribble = kvmalloc_array(cnt, obj_size, GFP_KERNEL); > > Maybe it is simpler to call kvmalloc_array between memalloc_noio_save > and memalloc_noio_restore. > And seems sched/mm.h need to be included per the report from LKP. The falgs can be, - GFP_KERNEL: when called from alloc_scratch_buffer() - GFP_NOIO: when called from resize_chunks(). If the scope APIs are used inside scribble_alloc(), the first call path is restricted as noio, which is not expected. So I only use the scope APIs around the location where GFP_NOIO is used. Anyway, Michal Hocko suggests to add the scope APIs in mddev_suspend()/mddev_resume(). Then in the whole code path where md raid array is suspend, we don't need to worry the recursive memory reclaim I/Os onto the array. After checking the complicated raid5 code, I come to realize this suggestion makes sense. I will try to compose a v2 patch following Michal's suggestion. -- Coly Li