From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Dumazet Subject: Re: [PATCH net-next] sch_netem: faster rb tree removal Date: Sun, 24 Sep 2017 22:27:20 -0700 Message-ID: <1506317240.6617.5.camel@edumazet-glaptop3.roam.corp.google.com> References: <1506190048.29839.206.camel@edumazet-glaptop3.roam.corp.google.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Cc: David Miller , netdev , Stephen Hemminger To: David Ahern Return-path: Received: from mail-io0-f173.google.com ([209.85.223.173]:51519 "EHLO mail-io0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753273AbdIYF1Y (ORCPT ); Mon, 25 Sep 2017 01:27:24 -0400 Received: by mail-io0-f173.google.com with SMTP id l15so8703749iol.8 for ; Sun, 24 Sep 2017 22:27:23 -0700 (PDT) In-Reply-To: Sender: netdev-owner@vger.kernel.org List-ID: On Sun, 2017-09-24 at 20:05 -0600, David Ahern wrote: > On 9/24/17 7:57 PM, David Ahern wrote: > > Hi Eric: > > > > I'm guessing the cost is in the rb_first and rb_next computations. Did > > you consider something like this: > > > > struct rb_root *root > > struct rb_node **p = &root->rb_node; > > > > while (*p != NULL) { > > struct foobar *fb; > > > > fb = container_of(*p, struct foobar, rb_node); > > // fb processing > rb_erase(&nh->rb_node, root); > > > p = &root->rb_node; > > } > > > > Oops, dropped the rb_erase in my consolidating the code to this snippet. Hi David This gives about same numbers than method_1 I tried with 10^7 skbs in the tree : Your suggestion takes 66ns per skb, while the one I chose takes 37ns per skb. Thanks.