net-memcg: pass in gfp_t mask to mem_cgroup_charge_skmem()
Add gfp_t mask as an input parameter to mem_cgroup_charge_skmem(), to give more control to the networking stack and enable it to change memcg charging behavior. In the future, the networking stack may decide to avoid oom-kills when fallbacks are more appropriate. One behavior change in mem_cgroup_charge_skmem() by this patch is to avoid force charging by default and let the caller decide when and if force charging is needed through the presence or absence of __GFP_NOFAIL. Signed-off-by: Wei Wang <weiwan@google.com> Reviewed-by: Shakeel Butt <shakeelb@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
ab44035d30
commit
4b1327be9f
@@ -2400,6 +2400,11 @@ static inline gfp_t gfp_any(void)
|
||||
return in_softirq() ? GFP_ATOMIC : GFP_KERNEL;
|
||||
}
|
||||
|
||||
static inline gfp_t gfp_memcg_charge(void)
|
||||
{
|
||||
return in_softirq() ? GFP_NOWAIT : GFP_KERNEL;
|
||||
}
|
||||
|
||||
static inline long sock_rcvtimeo(const struct sock *sk, bool noblock)
|
||||
{
|
||||
return noblock ? 0 : sk->sk_rcvtimeo;
|
||||
|
||||
Reference in New Issue
Block a user