On Tue, Aug 6, 2024 at 10:30 AM Barry Song <21cn...@gmail.com> wrote: > > On Mon, Aug 5, 2024 at 8:21 PM Jason Wang <jasow...@redhat.com> wrote: > > > > Barry said [1]: > > > > """ > > mm doesn't support non-blockable __GFP_NOFAIL allocation. Because > > __GFP_NOFAIL without direct reclamation may just result in a busy > > loop within non-sleepable contexts. > > ""“ > > the current code will result in returning a NULL pointer but > not a busy-loop. > > static inline struct page * > __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order, > struct alloc_context *ac) > { > ... > /* > * Make sure that __GFP_NOFAIL request doesn't leak out and make sure > * we always retry > */ > if (gfp_mask & __GFP_NOFAIL) { > /* > * All existing users of the __GFP_NOFAIL are blockable, so > warn > * of any new users that actually require GFP_NOWAIT > */ > if (WARN_ON_ONCE_GFP(!can_direct_reclaim, gfp_mask)) > goto fail; > ... > } > ... > fail: > warn_alloc(gfp_mask, ac->nodemask, > "page allocation failure: order:%u", order); > got_pg: > return page; > } > > > We have two choices to address the issue: > 1. busy-loop > 2. BUG_ON > > the below patch chose 2: > https://lore.kernel.org/linux-mm/20240731000155.109583-5-21cn...@gmail.com/ >
I will add those to V2. Thanks