[RHEL7,COMMIT] ms/netlink: do not enter direct reclaim from netlink_trim()

Submitted by Konstantin Khorenko on May 18, 2020, 7:35 p.m.

Details

Message ID 202005181935.04IJZi26022232@finist-ce7.sw.ru
State New
Series "ms/netlink: do not enter direct reclaim from netlink_trim()"
Headers show

Commit Message

Konstantin Khorenko May 18, 2020, 7:35 p.m.
The commit is pushed to "branch-rh7-3.10.0-1127.8.2.vz7.151.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-1127.8.2.vz7.151.1
------>
commit 46e0291034819d38e85f62f3cff956daa1618b95
Author: Vasily Averin <vvs@virtuozzo.com>
Date:   Mon May 18 22:35:44 2020 +0300

    ms/netlink: do not enter direct reclaim from netlink_trim()
    
    [ Upstream commit e89df813174d]
    
    In commit d35c99ff77ecb ("netlink: do not enter direct reclaim from
    netlink_dump()") we made sure to not trigger expensive memory reclaim.
    
    Problem is that a bit later, netlink_trim() might be called and
    trigger memory reclaim.
    
    netlink_trim() should be best effort, and really as fast as possible.
    Under memory pressure, it is fine to not trim this skb.
    
    Signed-off-by: Eric Dumazet <edumazet@google.com>
    Acked-by: Alexei Starovoitov <ast@kernel.org>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    
    [vvs@: backported]
    https://jira.sw.ru/browse/PSBM-104086
    Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
 net/netlink/af_netlink.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index c36d6c354dfc5..7b3de330d2340 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -1166,7 +1166,10 @@  static struct sk_buff *netlink_trim(struct sk_buff *skb, gfp_t allocation)
 		skb = nskb;
 	}
 
-	pskb_expand_head(skb, 0, -delta, allocation);
+	pskb_expand_head(skb, 0, -delta,
+			 (allocation & ~__GFP_WAIT) |
+			 __GFP_NOWARN | __GFP_NORETRY);
+
 	return skb;
 }