From: Sven Eckelmann <sven.eckelmann@gmx.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 13:21:36 +0200 [thread overview]
Message-ID: <201004051321.45958.sven.eckelmann@gmx.de> (raw)
In-Reply-To: <20100405024603.GA11965@pandem0nium>
[-- Attachment #1: Type: Text/Plain, Size: 2161 bytes --]
On Monday 05 April 2010 04:46:03 Simon Wunderlich wrote:
> Index: a/batman-adv-kernelland/send.c
> ===================================================================
> --- a/batman-adv-kernelland/send.c (revision 1616)
> +++ a/batman-adv-kernelland/send.c (working copy)
> @@ -382,12 +382,21 @@
> {
> struct forw_packet *forw_packet;
>
> + if (atomic_dec_and_test(&bcast_queue_left)) {
> + bat_dbg(DBG_BATMAN, "bcast packet queue full\n");
> + atomic_inc(&bcast_queue_left);
> + return;
> + }
> +
[....]
> --- a/batman-adv-kernelland/aggregation.c (revision 1616)
> +++ a/batman-adv-kernelland/aggregation.c (working copy)
> @@ -106,13 +106,27 @@
> struct forw_packet *forw_packet_aggr;
> unsigned long flags;
>
> + /* own packet should always be scheduled */
> + if (!own_packet) {
> + if (atomic_dec_and_test(&batman_queue_left)) {
> + bat_dbg(DBG_BATMAN, "batman packet queue full\n");
> + atomic_inc(&batman_queue_left);
> + return;
> + }
> + }
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: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
next prev parent reply other threads:[~2010-04-05 11:21 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 [this message]
2010-04-05 14:40 ` Simon Wunderlich
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=201004051321.45958.sven.eckelmann@gmx.de \
--to=sven.eckelmann@gmx.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