From: Stephen Hemminger <stephen@networkplumber.org>
To: "Jason A. Donenfeld" <Jason@zx2c4.com>
Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
davem@davemloft.net, Greg KH <gregkh@linuxfoundation.org>
Subject: Re: [PATCH v1 3/3] net: WireGuard secure network tunnel
Date: Tue, 31 Jul 2018 13:27:01 -0700 [thread overview]
Message-ID: <20180731132701.522b55e2@xeon-e3> (raw)
In-Reply-To: <20180731191102.2434-4-Jason@zx2c4.com>
On Tue, 31 Jul 2018 21:11:02 +0200
"Jason A. Donenfeld" <Jason@zx2c4.com> wrote:
> +#define push(stack, p, len) ({ \
> + if (rcu_access_pointer(p)) { \
> + BUG_ON(len >= 128); \
> + stack[len++] = rcu_dereference_protected(p, lockdep_is_held(lock)); \
> + } \
> + true; \
> +})
> +static void free_root_node(struct allowedips_node __rcu *top, struct mutex *lock)
> +{
> + struct allowedips_node *stack[128], *node;
> + unsigned int len;
> +
> + for (len = 0, push(stack, top, len); len > 0 && (node = stack[--len]) && push(stack, node->bit[0], len) && push(stack, node->bit[1], len);)
> + call_rcu_bh(&node->rcu, node_free_rcu);
> +}
This looks like you are doing traversal to free a tree. The stack is there so that you do the rcu callbacks
in the proper order. Won't this create an lot of RCU work at once?
next prev parent reply other threads:[~2018-07-31 20:27 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-31 19:10 [PATCH v1 0/3] WireGuard: Secure Network Tunnel Jason A. Donenfeld
2018-07-31 19:11 ` [PATCH v1 1/3] random: Make crng state queryable Jason A. Donenfeld
2018-08-02 21:35 ` Theodore Y. Ts'o
2018-07-31 19:11 ` [PATCH v1 3/3] net: WireGuard secure network tunnel Jason A. Donenfeld
2018-07-31 20:02 ` Andrew Lunn
2018-07-31 20:22 ` Stephen Hemminger
2018-07-31 20:27 ` Stephen Hemminger [this message]
2018-08-03 0:35 ` Jason A. Donenfeld
2018-08-03 14:39 ` Andrew Lunn
2018-08-01 1:21 ` Shawn Landden
2018-08-13 15:40 ` [PATCH v1 0/3] WireGuard: Secure Network Tunnel James Bottomley
2018-08-13 15:53 ` Willy Tarreau
2018-08-13 17:02 ` Jason A. Donenfeld
2018-08-13 17:37 ` James Bottomley
2018-08-13 17:55 ` Jason A. Donenfeld
2018-08-13 18:04 ` James Bottomley
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180731132701.522b55e2@xeon-e3 \
--to=stephen@networkplumber.org \
--cc=Jason@zx2c4.com \
--cc=davem@davemloft.net \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox