* [B.A.T.M.A.N.] [PATCH repost] batman-adv: schedule global entry removal earlier
@ 2013-04-18 13:20 Antonio Quartulli
2013-04-19 11:30 ` Marek Lindner
0 siblings, 1 reply; 2+ messages in thread
From: Antonio Quartulli @ 2013-04-18 13:20 UTC (permalink / raw)
To: b.a.t.m.a.n; +Cc: Marek Lindner, Simon Wunderlich, Antonio Quartulli
Instead of scheduling the global entry removals in
batadv_orig_node_free_rcu() (which would result in
scheduling other RCU callbacks for the next RCU period),
do it in batadv_orig_node_free_ref() directly.
In this way all the callbacks get scheduled in one RCU
period.
CC: Linus Lüssing <linus.luessing@web.de>
CC: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
CC: Marek Lindner <lindner_marek@yahoo.de>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
---
originator.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/originator.c b/originator.c
index f50553a..2de5d4f 100644
--- a/originator.c
+++ b/originator.c
@@ -147,8 +147,6 @@ static void batadv_orig_node_free_rcu(struct rcu_head *rcu)
batadv_nc_purge_orig(orig_node->bat_priv, orig_node, NULL);
batadv_frag_list_free(&orig_node->frag_list);
- batadv_tt_global_del_orig(orig_node->bat_priv, orig_node,
- "originator timed out");
kfree(orig_node->tt_buff);
kfree(orig_node->bcast_own);
@@ -160,11 +158,19 @@ static void batadv_orig_node_free_rcu(struct rcu_head *rcu)
* batadv_orig_node_free_ref - decrement the orig node refcounter and possibly
* schedule an rcu callback for freeing it
* @orig_node: the orig node to free
+ *
+ * Decrement the refcounter and perform the following operations when it reaches
+ * zero:
+ * - remove the reference from any global entry served by this originator
+ * - schedule an RCU callback to free the orig_node
*/
void batadv_orig_node_free_ref(struct batadv_orig_node *orig_node)
{
- if (atomic_dec_and_test(&orig_node->refcount))
+ if (atomic_dec_and_test(&orig_node->refcount)) {
+ batadv_tt_global_del_orig(orig_node->bat_priv, orig_node,
+ "originator timed out");
call_rcu(&orig_node->rcu, batadv_orig_node_free_rcu);
+ }
}
/**
--
1.8.1.5
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [B.A.T.M.A.N.] [PATCH repost] batman-adv: schedule global entry removal earlier
2013-04-18 13:20 [B.A.T.M.A.N.] [PATCH repost] batman-adv: schedule global entry removal earlier Antonio Quartulli
@ 2013-04-19 11:30 ` Marek Lindner
0 siblings, 0 replies; 2+ messages in thread
From: Marek Lindner @ 2013-04-19 11:30 UTC (permalink / raw)
To: b.a.t.m.a.n; +Cc: Simon Wunderlich, Antonio Quartulli
On Thursday, April 18, 2013 21:20:55 Antonio Quartulli wrote:
> Instead of scheduling the global entry removals in
> batadv_orig_node_free_rcu() (which would result in
> scheduling other RCU callbacks for the next RCU period),
> do it in batadv_orig_node_free_ref() directly.
>
> In this way all the callbacks get scheduled in one RCU
> period.
>
> CC: Linus Lüssing <linus.luessing@web.de>
> CC: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
> CC: Marek Lindner <lindner_marek@yahoo.de>
> Signed-off-by: Antonio Quartulli <ordex@autistici.org>
> ---
> originator.c | 12 +++++++++---
> 1 file changed, 9 insertions(+), 3 deletions(-)
I'd rather see a cleaner solution instead making the "less than ideal"
situation worse.
Cheers,
Marek
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-04-19 11:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-18 13:20 [B.A.T.M.A.N.] [PATCH repost] batman-adv: schedule global entry removal earlier Antonio Quartulli
2013-04-19 11:30 ` Marek Lindner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox