[RH7] netlink: silence high-order memory allocation warning in netlink_ack

Submitted by Vasily Averin on Dec. 21, 2020, 8:11 p.m.

Details

Message ID 99362b2e-a0bb-4a90-d212-3a9e04661a69@virtuozzo.com
State New
Series "netlink: silence high-order memory allocation warning in netlink_ack"
Headers show

Commit Message

Vasily Averin Dec. 21, 2020, 8:11 p.m.
In some cases netlink_ack() legally does high-order memory allocation.

 ------------[ cut here ]------------
 WARNING: CPU: 4 PID: 258995 at mm/page_alloc.c:3533 __alloc_pages_nodemask+0x1b1/0x600
 order 4 >= 3, gfp 0x2040d0
 Call Trace:
  [<ffffffff97c9d1ba>] __warn+0xfa/0x100
  [<ffffffff97c9d21f>] warn_slowpath_fmt+0x5f/0x80
  [<ffffffff97ddfaa1>] __alloc_pages_nodemask+0x1b1/0x600
  [<ffffffff983b4bb9>] kmalloc_large_node+0x5f/0x80
  [<ffffffff97e47ff2>] __kmalloc_node_track_caller+0x292/0x300
  [<ffffffff98272734>] __kmalloc_reserve.isra.32+0x44/0xa0
  [<ffffffff9827377d>] __alloc_skb+0x8d/0x2d0
  [<ffffffff982c80b9>] netlink_ack+0x49/0x110
  [<ffffffff97d4e267>] audit_receive+0x67/0xa0
  [<ffffffff982c7b8c>] netlink_unicast+0x1bc/0x240
  [<ffffffff982c7f5e>] netlink_sendmsg+0x34e/0x460
  [<ffffffff98269480>] sock_sendmsg+0xb0/0xf0
  [<ffffffff9826a379>] ___sys_sendmsg+0x3e9/0x400
  [<ffffffff9826ba01>] __sys_sendmsg+0x51/0x90
  [<ffffffff9826ba52>] SyS_sendmsg+0x12/0x20
  [<ffffffff983cbf92>] system_call_fastpath+0x25/0x2a

This patch disables warning generation in this case.
https://jira.sw.ru/browse/PSBM-120889
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
 net/netlink/af_netlink.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index eb2b5de..bcd9ef3 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -2239,7 +2239,8 @@  void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err)
 		payload += nlmsg_len(nlh);
 
 	skb = netlink_alloc_skb(in_skb->sk, nlmsg_total_size(payload),
-				NETLINK_CB(in_skb).portid, GFP_KERNEL);
+				NETLINK_CB(in_skb).portid, 
+				GFP_KERNEL|__GFP_ORDER_NOWARN);
 	if (!skb) {
 		struct sock *sk;