public inbox for b.a.t.m.a.n@lists.open-mesh.org
 help / color / mirror / Atom feed
From: Simon Wunderlich <simon.wunderlich@s2003.tu-chemnitz.de>
To: The list for a Better Approach To Mobile Ad-hoc Networking
	<b.a.t.m.a.n@lists.open-mesh.org>
Subject: Re: [B.A.T.M.A.N.] [PATCH] batman-adv: Limit queue lengths for	batman and broadcast packets
Date: Mon, 5 Apr 2010 16:40:35 +0200	[thread overview]
Message-ID: <20100405144035.GA13768@pandem0nium> (raw)
In-Reply-To: <201004051321.45958.sven.eckelmann@gmx.de>

[-- Attachment #1: Type: text/plain, Size: 1712 bytes --]

Hey Sven,

you are right, this might be indeed a problem. I'll send an updated patch
which removes the problem by employing atomic_add_unless().

Marek also pointed out that global variables are not very pretty as we are
moving all the global stuff into bat_priv to allow multiple mesh soft 
interfaces later. However I'd first send the patch with globals as is and
move them later in another patch.

best regards,
	Simon

On Mon, Apr 05, 2010 at 01:21:36PM +0200, Sven Eckelmann wrote:
> 
> It should be possible to have multiple events accessing these functions at the 
> same time, or am I wrong?
> 
> Just say we have following situation (queue is full; full == 1):
> 
>  * bcast comes in and we start add_bcast_packet_to_list  and
>    dec_test(left) == 1 -> damn, no room left for us
> -> for easier understanding: someone steals our cpu or the processing is
>     otherwise interleaved with following
>  * another bcast comes in and wants attention (left is now 0):
>    dec_test(left) == 0 (because left is now -1... or 0xfff....fff). Lets enqueue
>    it and do the rest
>  * first bcast continues and and does atomic_inc(left) -> now it is 0
>  * now a storm of bcasts comes in and all do atomic_dec_and_test... each one
>     will be accepted because left is already zero and needs a looooong time to
>     be 0 again (or enough bcast packets were processed from the queue to get
>    positive again)
> 
> I am not 100% sure if this really can happen, but I thought that it was a hard 
> requirement for TCP port passed processor selection for parallel processing of 
> incoming packets on multicore/multiprocessor architectures. 
> 
> Best regards,
> 	Sven



[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

  reply	other threads:[~2010-04-05 14:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-05  2:46 [B.A.T.M.A.N.] [PATCH] batman-adv: Limit queue lengths for batman and broadcast packets Simon Wunderlich
2010-04-05 11:21 ` Sven Eckelmann
2010-04-05 14:40   ` Simon Wunderlich [this message]
2010-04-05 15:06     ` [B.A.T.M.A.N.] [PATCHv2] " Simon Wunderlich
2010-04-07  8:11       ` [B.A.T.M.A.N.] [PATCHv3] " Simon Wunderlich
2010-04-10 23:56         ` Linus Lüssing
2010-04-11  0:42           ` Linus Lüssing
2010-04-12 19:15           ` Simon Wunderlich

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=20100405144035.GA13768@pandem0nium \
    --to=simon.wunderlich@s2003.tu-chemnitz.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