Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp5452251imm; Tue, 16 Oct 2018 10:25:51 -0700 (PDT) X-Google-Smtp-Source: ACcGV60k44er29Zqu3E0CbClpVFDnrQIyd4cwptH3trrD8118w0ybX2se1SpgTWng0RMP64Z+c51 X-Received: by 2002:a62:670a:: with SMTP id b10-v6mr22850823pfc.243.1539710751827; Tue, 16 Oct 2018 10:25:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539710751; cv=none; d=google.com; s=arc-20160816; b=G2HX3ITTmuIVaiLeKnA417bshMs6w95t8+YyjxSK7fdLhh2IKaesFuRBMG9XBPYqf4 JuPlghi/giiuSeWbVfqVo6zDbdJ40Dq5m63VgcgGEjfDM2UQqo8gGVSTAGKg5eMw1nIs jGMMbFkzfvyntboUg+g+wlDVgjlww8NFXtemul9HTG394KvKqbBKVn5cuvTNIHbM7h4D d891yggb44e31iUVt0txbUFa3W8PPkeQk0yZgBAXMlLLHTWcNd3DvbPdUu9muHi/QvHD nO/M/KEYSIwgUtWYdmVfVbWlNCndHhnI0JVUX05Ahj6n52Yuq9czBj37HhpTbL7gUh1/ RPEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=x5A1tRPVKk1Hr0cUC2TYwpboBd6wdsU/6bUKy9w8esU=; b=g/Gh22QWsw6Ptf/cNUfJub31mDa4kwbd2lIh30Q2dLFZGPt+OCyGCbepwto5qKfdGM U3q8gsQrNaXax+TCibnHoOeZuD/AEQtW/kIzVHou/tk8pLlb2csGwFWOtaMtWv4nHnTP ltzNnhzLbHihL8IDU3vJo5luHxUa/KDROQVDrIsFIdeOWDgup9Ayrm+WXqooPdktBDaU 5CBrpfBZmhfoibu8y+bN9Pt+p7jn3DMXT1xlFjqtkXO/rpyaKv3KAMReVk+9Brfvz9+7 rFFmRWt8/4aV0G3sD33xC046UKM/I7Y+TZlhIKHIEQI3bCIbzAzKiLy6vl6oLyUZwvI5 IekA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Fl5Aam69; 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 f185-v6si14250331pgc.339.2018.10.16.10.25.35; Tue, 16 Oct 2018 10:25:51 -0700 (PDT) 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; dkim=pass header.i=@kernel.org header.s=default header.b=Fl5Aam69; 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 S1731916AbeJQBQl (ORCPT + 99 others); Tue, 16 Oct 2018 21:16:41 -0400 Received: from mail.kernel.org ([198.145.29.99]:35376 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730396AbeJQBQk (ORCPT ); Tue, 16 Oct 2018 21:16:40 -0400 Received: from localhost (ip-213-127-77-176.ip.prioritytelecom.net [213.127.77.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id ACE6520658; Tue, 16 Oct 2018 17:25:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1539710714; bh=uWliUIX3j3RmarpkDk95NAq7BE49MM/y25lhc13s2Mg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Fl5Aam69vjBmioFq+0onpX3htBBIkA67iCFccGYy7pP+9LTwP5OOyFCzSlqO4iRLK XIBAtn4KY8Sbyj3uifVNmIK+XqosbBPNEvunO+ByjX/1TznTESWeZDtRkWiyaZv7JP Ffge5VRWCW2d0o0lnlIfmRvp6WguTaFJa77jV9KQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Dumazet , Peter Oskolkov , Florian Westphal , "David S. Miller" Subject: [PATCH 4.9 63/71] net: modify skb_rbtree_purge to return the truesize of all purged skbs. Date: Tue, 16 Oct 2018 19:10:00 +0200 Message-Id: <20181016170542.546553398@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181016170539.315587743@linuxfoundation.org> References: <20181016170539.315587743@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Peter Oskolkov Tested: see the next patch is the series. Suggested-by: Eric Dumazet Signed-off-by: Peter Oskolkov Signed-off-by: Eric Dumazet Cc: Florian Westphal Signed-off-by: David S. Miller (cherry picked from commit 385114dec8a49b5e5945e77ba7de6356106713f4) Signed-off-by: Greg Kroah-Hartman --- include/linux/skbuff.h | 2 +- net/core/skbuff.c | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -2418,7 +2418,7 @@ static inline void __skb_queue_purge(str kfree_skb(skb); } -void skb_rbtree_purge(struct rb_root *root); +unsigned int skb_rbtree_purge(struct rb_root *root); void *netdev_alloc_frag(unsigned int fragsz); --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -2425,23 +2425,27 @@ EXPORT_SYMBOL(skb_queue_purge); /** * skb_rbtree_purge - empty a skb rbtree * @root: root of the rbtree to empty + * Return value: the sum of truesizes of all purged skbs. * * Delete all buffers on an &sk_buff rbtree. Each buffer is removed from * the list and one reference dropped. This function does not take * any lock. Synchronization should be handled by the caller (e.g., TCP * out-of-order queue is protected by the socket lock). */ -void skb_rbtree_purge(struct rb_root *root) +unsigned int skb_rbtree_purge(struct rb_root *root) { struct rb_node *p = rb_first(root); + unsigned int sum = 0; while (p) { struct sk_buff *skb = rb_entry(p, struct sk_buff, rbnode); p = rb_next(p); rb_erase(&skb->rbnode, root); + sum += skb->truesize; kfree_skb(skb); } + return sum; } /**