From: "BALBIR SINGH" <balbir.singh@wipro.com>
To: Linus Torvalds <torvalds@transmeta.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [Lse-tech] Re: RFC: patch to allow lock-free traversal of lists with insertion
Date: Wed, 10 Oct 2001 11:31:08 +0530 [thread overview]
Message-ID: <3BC3E424.1070901@wipro.com> (raw)
In-Reply-To: <Pine.LNX.4.33.0110092236210.1305-100000@penguin.transmeta.com>
[-- Attachment #1: Type: text/plain, Size: 2995 bytes --]
Linus Torvalds wrote:
>On Wed, 10 Oct 2001, BALBIR SINGH wrote:
>
>>>And THAT is the hard part. Doing lookup without locks ends up being
>>>pretty much worthless, because you need the locks for the removal
>>>anyway, at which point the whole thing looks pretty moot.
>>>
>>What about cases like the pci device list or any other such list. Sometimes
>>you do not care if somebody added something, while you were looking through
>>the list as long as you do not get illegal addresses or data.
>>Wouldn't this be very useful there? Most of these lists come up
>>at system startup and change rearly, but we look through them often.
>>
>
>It's not about "change rarely". You cannot use a non-locking lookup if
>they _ever_ remove anything.
>
>I can't think of many lists like that. The PCI lists certainly are both
>add/remove: cardbus bridges and hotplug-PCI means that they are not just
>purely "enumerate at bootup".
>
I agree, I just thought of one case quickly. Assume that somebody did a cat /proc/pci.
Meanwhile somebody is adding a new pci device (hotplug PCI) simultaneously (which is very rare).
I would not care if the new device showed up in the output of /proc/pci this time. It would
definitely show up next time. Meanwhile locking the list (just in case it changes) is an
overhead in the case above. I was referring to these cases in my earlier mail.
>
>Sure, maybe there are _some_ things that don't need to ever be removed,
>but I can't think of any interesting data structure off-hand. Truly static
>stuff tends to be allocated in an array that is sized once - array lookups
>are much faster than traversing a linked list anyway.
>
>So the linked list approach tends to make sense for things that _aren't_
>just static, but I don't know of anything that only grows and grows. In
>fact, that would sound like a horrible memory leak to me if we had
>something like that. Even slow growth is bad if you want up-times measured
>in years.
>
>Now, in all fairness I can imagine hacky lock-less removals too. To get
>them to work, you have to (a) change the "next" pointer to point to the
>next->next (and have some serialization between removals, but removals
>only, to make sure you don't have next->next also going away from you) and
>(b) leave the old "next" pointer (and thus the data structure) around
>until you can _prove_ that nobody is looking anything up any more, and
>that the now-defunct data structure can truly be removed.
>
The problem with removals is that somebody could be adding an element simulataneously
to the "next" element. Which might cause problems. I hope I correctly understood
the scenario here.
>
>However, apart from locking, there aren't all that many ways to "prove"
>that non-use. You could probably do it with interesting atomic sequence
>numbers etc, although by the time you generate atomic sequence numbers
>your lookup is already getting heavier - to the point where locking
>probably isn't so bad an idea any more.
>
> Linus
>
>
Balbir
[-- Attachment #2: Wipro_Disclaimer.txt --]
[-- Type: text/plain, Size: 853 bytes --]
----------------------------------------------------------------------------------------------------------------------
Information transmitted by this E-MAIL is proprietary to Wipro and/or its Customers and
is intended for use only by the individual or entity to which it is
addressed, and may contain information that is privileged, confidential or
exempt from disclosure under applicable law. If you are not the intended
recipient or it appears that this mail has been forwarded to you without
proper authority, you are notified that any use or dissemination of this
information in any manner is strictly prohibited. In such cases, please
notify us immediately at mailto:mailadmin@wipro.com and delete this mail
from your records.
----------------------------------------------------------------------------------------------------------------------
next prev parent reply other threads:[~2001-10-10 6:00 UTC|newest]
Thread overview: 67+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-10-09 15:45 RFC: patch to allow lock-free traversal of lists with insertion Paul McKenney
2001-10-09 17:00 ` Richard Henderson
2001-10-10 3:33 ` Paul Mackerras
2001-10-10 17:02 ` Richard Henderson
2001-10-10 2:05 ` [Lse-tech] " Andrea Arcangeli
2001-10-10 5:05 ` Linus Torvalds
2001-10-10 5:17 ` BALBIR SINGH
2001-10-10 5:29 ` Davide Libenzi
2001-10-10 5:46 ` Linus Torvalds
2001-10-10 6:01 ` BALBIR SINGH [this message]
2001-10-10 15:23 ` Victor Yodaiken
2001-10-10 7:14 ` kdb requires kallsyms Kirill Ratkin
2001-10-10 7:38 ` BALBIR SINGH
2001-10-10 6:16 ` [Lse-tech] Re: RFC: patch to allow lock-free traversal of lists with insertion Paul Mackerras
2001-10-10 6:30 ` Linus Torvalds
2001-10-10 7:36 ` Paul Mackerras
2001-10-10 15:54 ` Victor Yodaiken
2001-10-10 21:56 ` Keith Owens
2001-10-10 22:24 ` Victor Yodaiken
2001-10-10 23:46 ` David S. Miller
2001-10-11 0:24 ` Davide Libenzi
2001-10-10 11:54 ` Keith Owens
2001-10-10 13:42 ` AIC7XXX war
2001-10-10 21:40 ` AIC7XXX Luigi Genoni
2001-10-10 13:24 ` [Lse-tech] Re: RFC: patch to allow lock-free traversal of lists with insertion Ivan Kokshaysky
2001-10-10 13:41 ` Andrea Arcangeli
-- strict thread matches above, loose matches on Subject: below --
2001-10-10 4:43 Paul McKenney
2001-10-10 6:54 Dipankar Sarma
2001-10-10 7:06 Dipankar Sarma
2001-10-10 7:21 ` BALBIR SINGH
2001-10-10 9:06 ` Dipankar Sarma
2001-10-10 7:58 Dipankar Sarma
[not found] <20011010182730.0077454b.rusty@rustcorp.com.au>
2001-10-10 9:36 ` Linus Torvalds
2001-10-11 6:50 ` Rusty Russell
2001-10-10 10:06 Dipankar Sarma
2001-10-10 10:18 ` Linus Torvalds
2001-10-10 11:43 ` Dipankar Sarma
2001-10-12 3:27 ` Rusty Russell
2001-10-12 16:56 ` Linus Torvalds
2001-10-12 18:53 ` Dipankar Sarma
2001-10-13 7:25 ` Rusty Russell
2001-10-10 15:24 Paul McKenney
2001-10-10 16:58 ` Andrea Arcangeli
2001-10-10 17:25 ` Linus Torvalds
2001-10-12 5:06 ` Rusty Russell
2001-10-12 16:28 ` Linus Torvalds
2001-10-12 19:50 ` Al Dunsmuir
2001-10-13 1:07 ` Paul Mackerras
2001-10-13 1:54 ` Davide Libenzi
2001-10-13 2:04 ` Linus Torvalds
2001-10-13 2:31 ` Davide Libenzi
2001-10-13 2:46 ` Davide Libenzi
2001-10-13 3:30 ` Linus Torvalds
2001-10-13 2:49 ` Paul Mackerras
2001-10-13 2:00 ` Linus Torvalds
2001-10-13 7:38 ` Rusty Russell
2001-10-10 16:00 Paul McKenney
2001-10-10 21:44 Paul McKenney
2001-10-11 10:34 Dipankar Sarma
2001-10-13 14:42 Paul McKenney
2001-10-13 17:23 ` Linus Torvalds
2001-10-13 17:28 ` Linus Torvalds
2001-10-14 7:25 ` Dipankar Sarma
2001-10-13 18:42 ` Andi Kleen
2001-10-13 19:15 ` Alexander Viro
2001-10-13 20:44 ` Rusty Russell
2001-10-13 21:19 ` Rusty Russell
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=3BC3E424.1070901@wipro.com \
--to=balbir.singh@wipro.com \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@transmeta.com \
/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