All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@osdl.org>
To: Giacomo <delleceste@gmail.com>
Cc: netfilter devel <netfilter-devel@lists.netfilter.org>
Subject: Re: locking while reading linked lists.
Date: Wed, 23 Nov 2005 07:51:36 -0800	[thread overview]
Message-ID: <20051123075136.6036713f@localhost.localdomain> (raw)
In-Reply-To: <885896af0511230016r3eb7b0b7j@mail.gmail.com>

On Wed, 23 Nov 2005 09:16:46 +0100
Giacomo <delleceste@gmail.com> wrote:

> Good morning.
> In a packet filter which i wrote on my own, i have a linked list of structures
> which i read periodically by means of list_for_each_safe macro.
> These structures have a timer, when it expires, the entry is deleted.
> The timer can on the other way be updated by mod_timer.
> 
> The context of execution is that of a software interrupt (i attach my code at
> netfilter hooks), and some times (after tenths of millions of packets filtered)
> the system goes into panic.
> 
> I think i should put some locks when reading in list_for_each or when
> deleting an item, or when updating timers.
> 
> I thought it was not necessary because of the atomic context.
> 
> In fact, should i use read/write_lock? Or spinlocks?

Learn how to use RCU. There is lots of info in Documentation/RCU/
and there are list macro's that make it painless.

      parent reply	other threads:[~2005-11-23 15:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-23  8:16 locking while reading linked lists Giacomo
2005-11-23  8:17 ` Fwd: " Giacomo
2005-11-23 15:51 ` Stephen Hemminger [this message]

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=20051123075136.6036713f@localhost.localdomain \
    --to=shemminger@osdl.org \
    --cc=delleceste@gmail.com \
    --cc=netfilter-devel@lists.netfilter.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.