b.a.t.m.a.n.lists.open-mesh.org archive mirror
 help / color / mirror / Atom feed
From: Marek Lindner <lindner_marek@yahoo.de>
To: b.a.t.m.a.n@lists.open-mesh.org
Subject: Re: [B.A.T.M.A.N.] [PATCH] batman-adv: protect bonding with rcu locks
Date: Sun, 16 Jan 2011 12:35:53 +0100	[thread overview]
Message-ID: <201101161235.54223.lindner_marek@yahoo.de> (raw)
In-Reply-To: <20101230020917.GA4707@pandem0nium>

On Thursday 30 December 2010 03:09:17 Simon Wunderlich wrote:
> bonding / alternating candidates need to be secured by rcu locks
> as well. This patch therefore converts the bonding list
> from a plain pointer list to a rcu securable lists and references
> the bonding candidates.

Thanks for your patch! As the bonding / alternating candidate list is the last 
item on the way to an orig_hash_lock free kernel module this patch is a very 
welcome one. However, first tests revealed some memory leaks due to misbehaving 
reference counters. Therefore I took the time to dive deeper into this code 
section and propose an addition to your patch. The changes include:

* The bonding / alternating candidate list is not destroyed & re-created with 
each incoming OGM but candidates are added & deleted in a dynamic fashion.
* The memory leaks have been fixed / a workaround has been found. The "free 
neighbors when an interface is deactivated" patch is also required to get the 
full benefit of these memory leak fixes. 
* I introduced some style changes which are meant to increase readability & 
maintainability. Feedback is welcome.  ;-)

Note: One of the memory leaks turned out to be part of a bigger problem which 
we may or may not have in other code sections as well. purge_orig_neighbors() 
called call_rcu() on the same struct more then once in a short time period, so 
that each consecutive call overwrote the previous one. We have to look into 
this.

While reorganizing the code I stumbled over these lines which are part of the 
interference check:

/* we only care if the other candidate is even considered as candidate. */
if (!list_empty(&tmp_neigh_node2->bonding_list))
         continue;

This seems wrong in this context. If the list is empty then this neighbor is 
not part of the candidate list. Wouldn't you agree ?

Regards,
Marek


  reply	other threads:[~2011-01-16 11:35 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-13  0:18 [B.A.T.M.A.N.] performance patches (v3) Marek Lindner
2010-12-13  0:18 ` [B.A.T.M.A.N.] [PATCH 1/5] batman-adv: protect neigh_nodes used outside of rcu_locks with refcounting Marek Lindner
2010-12-13  0:18 ` [B.A.T.M.A.N.] [PATCH 2/5] batman-adv: protect each hash row with rcu locks Marek Lindner
2010-12-13  0:18 ` [B.A.T.M.A.N.] [PATCH 3/5] batman-adv: protect originator nodes with reference counters Marek Lindner
2010-12-13  0:18 ` [B.A.T.M.A.N.] [PATCH 4/5] batman-adv: protect ogm counter arrays with spinlock Marek Lindner
2010-12-13  0:18 ` [B.A.T.M.A.N.] [PATCH 5/5] batman-adv: remove orig_hash spinlock Marek Lindner
2010-12-30  2:09 ` [B.A.T.M.A.N.] [PATCH] batman-adv: protect bonding with rcu locks Simon Wunderlich
2011-01-16 11:35   ` Marek Lindner [this message]
2011-01-16 11:36     ` [B.A.T.M.A.N.] [PATCH] batman-adv: protect bonding with rcu locks (proposal) Marek Lindner
2011-01-16 17:07     ` [B.A.T.M.A.N.] [PATCH] batman-adv: protect bonding with rcu locks Simon Wunderlich
2011-01-19 20:07 ` [B.A.T.M.A.N.] performance patches (v3) Marek Lindner

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=201101161235.54223.lindner_marek@yahoo.de \
    --to=lindner_marek@yahoo.de \
    --cc=b.a.t.m.a.n@lists.open-mesh.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;
as well as URLs for NNTP newsgroup(s).