On Fri 09-11-18 19:07:49, Tetsuo Handa wrote: > On 2018/11/09 18:56, Michal Hocko wrote: > > Does this following look better? > > Yes. > > >> Also, why not to add BUG_ON(gfp_mask & __GFP_NOFAIL); here? > > > > Because we do not want to blow up the kernel just because of a stupid > > usage of the allocator. Can you think of an example where it would > > actually make any sense? > > > > I would argue that such a theoretical abuse would blow up on an > > unchecked NULL ptr access. Isn't that enough? > > We after all can't avoid blowing up the kernel even if we don't add BUG_ON(). > Stopping with BUG_ON() is saner than NULL pointer dereference messages. I disagree (strongly to be more explicit). You never know the context the allocator is called from. We do not want to oops with a random state (locks heled etc). If the access blows up in the user then be it, the bug will be clear and to be fixed but BUG_ON on an invalid core kernel function is just a bad idea. I believe Linus was quite explicit about it and I fully agree with him. Besides that this is really off-topic to the issue at hands. Don't you think? -- Michal Hocko SUSE Labs