Received: by 2002:ac0:8845:0:0:0:0:0 with SMTP id g63csp115114img; Wed, 27 Feb 2019 18:03:50 -0800 (PST) X-Google-Smtp-Source: AHgI3Ibnpg2ePKF+vCyQ4GljfOjUTpvHilIeCOAUKdP7tGXzkYGcJSdcpAdXD+LgeXdP+WfSMkUE X-Received: by 2002:a63:1960:: with SMTP id 32mr5952803pgz.171.1551319429933; Wed, 27 Feb 2019 18:03:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551319429; cv=none; d=google.com; s=arc-20160816; b=Edd/S3pORgPrzU46DF8OadD0kYLYOEYAdFDK1wRfnk8tUGddxsNQwgmW0zxhPGRcxi kCZi5qtmlbyAUMz51YpK6MrQwVPNRurlB8T3lyLx00sRVWcuDuELri3FVGMsqdWTASL5 RddCkFirs7Ee4oCyQt9IivhDlrqvivU+AV61ttQWG6SEqTjgdYFds51ZZE5Na2+q1CAr lKfjp7jJYOlxJBStKg/WE03bizxg6kAgOXd6FqPT82Zz4aUurp3ClyGkCUi6r6OjB7DE qjWnHi81u5EqBwr0q8/w3Do7FVCJBr+sfPA9ib6xjDM4jXAfBYsDnLVA3ZVDL/VML4qF QCIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=H9z8wv87EUDBBVkFRDwu5Cz89/EU5fWAQvtr//K3eAY=; b=IUAadrAcanvRS1MGiTOpDPVR3y2km+IZdLvbAU+KJ2R5rnYIwgL1STNhSXeiqBqNIJ 37ITHK1KjdWAvCcybn6HpBN4CpxpQapPOkNB+FSnqClD0dCaDqslGwCTxFvKJD8rnvha RqfmbpJKcuo4WlbIqwlObDhZ2LwjD4SJSzTlK9caDNvEkcgrjZU+EHx3uYNXf0yVHQlH 6pICypjcsknbz/NpVDt1gAc89JOCdZ5olMrICnsSxYQmkvuyzTW4CA1IPcHJJnWgdF/0 8TJk46eQB8EMVOg/nNeakqq3De12PQIheUSmh6sNdE3F/+zjZvcfG13DgyS68gAc0Oa6 b+/w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 8si7770575pgq.591.2019.02.27.18.03.33; Wed, 27 Feb 2019 18:03:49 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730621AbfB1CDM (ORCPT + 99 others); Wed, 27 Feb 2019 21:03:12 -0500 Received: from smtp03.citrix.com ([162.221.156.55]:57987 "EHLO SMTP03.CITRIX.COM" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730240AbfB1CDM (ORCPT ); Wed, 27 Feb 2019 21:03:12 -0500 X-IronPort-AV: E=Sophos;i="5.58,421,1544486400"; d="scan'208";a="79285347" From: Igor Druzhinin To: , , CC: , , , Igor Druzhinin Subject: [PATCH] xen-netback: fix occasional leak of grant ref mappings under memory pressure Date: Thu, 28 Feb 2019 02:03:02 +0000 Message-ID: <1551319382-32595-1-git-send-email-igor.druzhinin@citrix.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Zero-copy callback flag is not yet set on frag list skb at the moment xenvif_handle_frag_list() returns -ENOMEM. This eventually results in leaking grant ref mappings since xenvif_zerocopy_callback() is never called for these fragments. Those eventually build up and cause Xen to kill Dom0 as the slots get reused for new mappings. That behavior is observed under certain workloads where sudden spikes of page cache usage for writes coexist with active atomic skb allocations. Signed-off-by: Igor Druzhinin --- drivers/net/xen-netback/netback.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c index 80aae3a..2023317 100644 --- a/drivers/net/xen-netback/netback.c +++ b/drivers/net/xen-netback/netback.c @@ -1146,9 +1146,12 @@ static int xenvif_tx_submit(struct xenvif_queue *queue) if (unlikely(skb_has_frag_list(skb))) { if (xenvif_handle_frag_list(queue, skb)) { + struct sk_buff *nskb = + skb_shinfo(skb)->frag_list; if (net_ratelimit()) netdev_err(queue->vif->dev, "Not enough memory to consolidate frag_list!\n"); + xenvif_skb_zerocopy_prepare(queue, nskb); xenvif_skb_zerocopy_prepare(queue, skb); kfree_skb(skb); continue; -- 2.7.4