On Mon, 29 Jul 2024, Michal Hocko wrote:
Because it is really hard to figure out what it is supposed to mean. If the caller uses __GFP_NOFAIL then it is (should be) impossible and if NOFAIL is not used then why does it need to check for (gfp & ~__GFP_NOFAIL) != GFP_KERNEL?
Agreed, this is pointless - and cannot recall why it was justified to have in the first place. But I think we should revert back to the original check then, which is there to distinguish failure cases between normal (GFP_KERNEL) and nested (GFP_ATOMIC) contexts. Removing the check altogether would change the fallback for regular allocations. So this would be: - if (tbl == NULL && (gfp & ~__GFP_NOFAIL) != GFP_KERNEL) { + if (tbl == NULL && gfp != GFP_KERNEL) { Thanks, Davidlohr