net-memcg: pass in gfp_t mask to mem_cgroup_charge_skmem()
authorWei Wang <weiwan@google.com>
Tue, 17 Aug 2021 19:40:03 +0000 (12:40 -0700)
committerDavid S. Miller <davem@davemloft.net>
Wed, 18 Aug 2021 10:39:44 +0000 (11:39 +0100)
commit4b1327be9fe57443295ae86fe0fcf24a18469e9f
treecab0b45edc0c01d5fbac35ba3c63bdcd17428d7d
parentab44035d308227723b490487ff0feba521e87029
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>
include/linux/memcontrol.h
include/net/sock.h
mm/memcontrol.c
net/core/sock.c
net/ipv4/inet_connection_sock.c
net/ipv4/tcp_output.c