summaryrefslogtreecommitdiff
path: root/include/linux/list.h
AgeCommit message (Collapse)Author
2005-10-17[PATCH] list: add missing rcu_dereference on first elementHerbert Xu
It seems that all the list_*_rcu primitives are missing a memory barrier on the very first dereference. For example, #define list_for_each_rcu(pos, head) \ for (pos = (head)->next; prefetch(pos->next), pos != (head); \ pos = rcu_dereference(pos->next)) It will go something like: pos = (head)->next prefetch(pos->next) pos != (head) do stuff We're missing a barrier here. pos = rcu_dereference(pos->next) fetch pos->next barrier given by rcu_dereference(pos->next) store pos Without the missing barrier, the pos->next value may turn out to be stale. In fact, if "do stuff" were also dereferencing pos and relying on list_for_each_rcu to provide the barrier then it may also break. So here is a patch to make sure that we have a barrier for the first element in the list. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Acked-by: "Paul E. McKenney" <paulmck@us.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-08-29[LIST]: Add docbook header comments for hlist_add_{before,after}_rcu()Paul E. McKenney
Signed-off-by: David S. Miller <davem@davemloft.net>
2005-08-29[IPV4]: Prepare FIB core for RCU.Robert Olsson
* RCU versions of hlist_***_rcu * fib_alias partial rcu port just whats needed now. Signed-off-by: Robert Olsson <Robert.Olsson@data.slu.se> Signed-off-by: Stephen Hemminger <shemminger@osdl.org> Signed-off-by: David S. Miller <davem@davemloft.net>
2005-08-29[CCID3]: Separate most of the packet history codeArnaldo Carvalho de Melo
This also changes the list_for_each_entry_safe_continue behaviour to match its kerneldoc comment, that is, to start after the pos passed. Also adds several helper functions from previously open coded fragments, making the code more clear. Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
2005-08-29[LIST]: Introduce list_for_each_entry_safe_continueArnaldo Carvalho de Melo
Used in the dccp CCID3 code, that is going to be submitted RSN. Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net> Signed-off-by: David S. Miller <davem@davemloft.net>
2005-06-25[PATCH] RCU: clean up a few remaining synchronize_kernel() callsPaul E. McKenney
2.6.12-rc6-mm1 has a few remaining synchronize_kernel()s, some (but not all) in comments. This patch changes these synchronize_kernel() calls (and comments) to synchronize_rcu() or synchronize_sched() as follows: - arch/x86_64/kernel/mce.c mce_read(): change to synchronize_sched() to handle races with machine-check exceptions (synchronize_rcu() would not cut it given RCU implementations intended for hardcore realtime use. - drivers/input/serio/i8042.c i8042_stop(): change to synchronize_sched() to handle races with i8042_interrupt() interrupt handler. Again, synchronize_rcu() would not cut it given RCU implementations intended for hardcore realtime use. - include/*/kdebug.h comments: change to synchronize_sched() to handle races with NMIs. As before, synchronize_rcu() would not cut it... - include/linux/list.h comment: change to synchronize_rcu(), since this comment is for list_del_rcu(). - security/keys/key.c unregister_key_type(): change to synchronize_rcu(), since this is interacting with RCU read side. - security/keys/process_keys.c install_session_keyring(): change to synchronize_rcu(), since this is interacting with RCU read side. Signed-off-by: "Paul E. McKenney" <paulmck@us.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-04-16[PATCH] Fix comment in list.h that refers to nonexistent APIPaul E. McKenney
The hlist_for_each_entry_rcu() comment block refers to a nonexistent hlist_add_rcu() API, needs to change to hlist_add_head_rcu(). Signed-off-by: Paul E. McKenney <paulmck@us.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-01-10[PATCH] optimize prefetch() usage in list_for_each_xxxOleg Nesterov
This patch changes list_for_each_xxx iterators from: for (pos = (head)->next, prefetch(pos->next); pos != (head); pos = pos->next, prefetch(pos->next)) to: for (pos = (head)->next; prefetch(pos->next), pos != (head); pos = pos->next) Reduces my vmlinux .text size by 4401 bytes. Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2004-10-27[PATCH] RCU: use rcu_assign_pointer()Paul E. McKenney
This patch uses the rcu_assign_pointer() API to eliminate a number of explicit memory barriers from code using RCU. This has been tested successfully on i386 and ppc64. Signed-off-by: <paulmck@us.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2004-09-22[PATCH] list_replace_rcu() in include/linux/list.hKaiGai Kohei
This attached patch adds list_replace_rcu() to include/linux/list.h for atomic updating operations according to RCU-model. void list_replace_rcu(struct list_head *old, struct list_head *new) The 'old' element is detached from the linked list, and the 'new' element is inserted to the same point of the linked list concurrently. This patch is necessary for the performance improvement of SELinux. See, http://lkml.org/lkml/2004/8/16/54 (Subject: RCU issue with SELinux) http://lkml.org/lkml/2004/8/30/63 (Subject: [PATCH]SELinux performance improvement by RCU) Signed-off-by: KaiGai, Kohei <kaigai@ak.jp.nec.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2004-08-22[PATCH] rcu: abstracted RCU dereferencingDipankar Sarma
Use abstracted RCU API to dereference RCU protected data. Hides barrier details. Patch from Paul McKenney. This patch introduced an rcu_dereference() macro that replaces most uses of smp_read_barrier_depends(). The new macro has the advantage of explicitly documenting which pointers are protected by RCU -- in contrast, it is sometimes difficult to figure out which pointer is being protected by a given smp_read_barrier_depends() call. Signed-off-by: Paul McKenney <paulmck@us.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2004-07-29Merge nuts.davemloft.net:/disk1/BK/network-2.6David S. Miller
into nuts.davemloft.net:/disk1/BK/net-2.6
2004-07-29[BRIDGE]: forwarding table RCUStephen Hemminger
Convert the bridge forwarding database over to using RCU. This avoids a read_lock and atomic_inc/dec in the fast path of output. Signed-off-by: Stephen Hemminger <shemminger@osdl.org> Signed-off-by: David S. Miller <davem@redhat.com>
2004-07-28[PATCH] hlist_for_each_safe cleanupStephen Hemminger
Make code for hlist_for_each_safe use better code (same as hlist_for_each_entry_safe). Get rid of comment about prefetch, because that was fixed a while ago. Only current use of this is in the bridge code, that I maintain. Signed-off-by: Stephen Hemminger <shemminger@osdl.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2004-07-15[PATCH] misc sparse cleanupsAlexander Viro
- missing ; between default: and } in sun4setup.c - cast of pointer to unsigned long long instead of unsigned long in x86_64 signal.c - missed annotations for ioctl structure in sparc64 openpromio.h (should've been in the same patch as the rest of drivers/sbus/* annotations) - 0->NULL in list.h and pmdisk.c
2004-04-19[PATCH] hlist_add_after() fixAndrew Morton
From: "Pedro Emanuel M. D. Pinto" <pepinto@student.dei.uc.pt> This currently-unused function is incorrectly implemented. Fix.
2004-04-11[PATCH] list.h cleanupAndrew Morton
- s/__inline__/inline/ - Remove lots of extraneous andi-was-here trailing whitespace
2004-04-11[PATCH] Improve list.h documentation for _rcu() primitivesAndrew Morton
From: "Paul E. McKenney" <paulmck@us.ibm.com> The attached patch improves the documentation of the _rcu list primitives.
2004-02-11Fix "bus_for_each_dev()" and "bus_for_each_drv()", which did notLinus Torvalds
correctly handle the "restart from this device/driver" case, and caused oopses with ieee1394. This just uses "list_for_each_entry_continue()" instead. Add helper macro to make usage of "list_for_each_entry_continue()" a bit more readable.
2003-12-29[PATCH] list_empty_careful() documentation.Andrew Morton
From: Ingo Molnar <mingo@elte.hu> I'd also suggest the following patch below, to clarify the use of unsynchronized list_empty(). list_empty_careful() can only be safe in the very specific case of "one-shot" list entries which might be removed by another CPU. (but nothing else can happen to them and this is their only final state.) list_empty_careful() is otherwise completely unsynchronized on both the compiler and CPU level and is not 'SMP safe' in any way.
2003-12-11Fix subtle bug in "finish_wait()", which can cause kernel stackLinus Torvalds
corruption on SMP because of another CPU still accessing a waitqueue even after it was de-allocated. Use a careful version of the list emptiness check to make sure we don't de-allocate the stack frame before the waitqueue is all done.
2003-10-04[PATCH] Change list_emtpy() to take a const pointerRusty Russell
From: "Perez-Gonzalez, Inaky" <inaky.perez-gonzalez@intel.com>
2003-10-04[PATCH] hlist constificationRusty Russell
From: Mitchell Blank Jr <mitch@sfgoth.com> Make some more of the hlist functions accept constant arguments.
2003-10-04[PATCH] kernel documentation fixesAndrew Morton
From: Michael Still <mikal@stillhq.com> The patch squelches build errors in the kernel-doc make targets by adding documentation to arguements previously not documented, and updating the argument names where they have changed.
2003-09-29[KERNEL]: Introduce list_for_each_entry_continue.Julian Anastasov
2003-06-15o list.h: implement hlist_for_each_entry_{from,continue}Arnaldo Carvalho de Melo
2003-06-11Fix rcu list poisoning - since another CPU may be traversing the listLinus Torvalds
as we delete the entry, we can only poison the back pointer, not the traversal pointer (rcu traversal only ever walks forward). Make __d_drop() take this into account.
2003-06-10Merge bk://ldm.bkbits.net/linux-2.5-coreLinus Torvalds
into home.transmeta.com:/home/torvalds/v2.5/linux
2003-06-10Hand mergePatrick Mochel
2003-06-10Re-introduce debugging code in list handling, poisoning staleLinus Torvalds
list pointers to give us a nice oops if somebody is doing something bad. Also introduce hlist_del_rcu_init() - same as hlist_del_init().
2003-06-09[list.h] Add list_for_each_entry_reversePatrick Mochel
2003-06-07o list.h: improve hlistArnaldo Carvalho de Melo
This changeset: 1. Implements hlist_add_after 2. uses prefetch in hlist_for_each, using a trick that ends up being equivalent to having the prefetch instruction in the first block of the hlist_for_each for block, the compiler optimizes the second "test" away, as its result is constant 3. implements hlist_for_each_entry and hlist_for_each_entry safe, using a struct hlist_node as iterator to avoid the extra branches a similar implementation to list_for_each_entry would have if used a typed iterator, but while avoiding having to have the explicit hlist_entry as in hlist_for_each. 4. Converts the hlist_for_each users that had explicit prefetches, i.e. removed the explicit prefetch 5. fix a harmless list_entry use in a hlist_for_each in inode.c
2003-05-04o list.h: implement list_for_each_entry_safeArnaldo Carvalho de Melo
2003-04-29[BRIDGE}: Change bridge forwarding table to use hlist.Stephen Hemminger
2003-04-28[NETFILTER]: Use Read Copy Update.Stephen Hemminger
2003-04-25[BRIDGE]: Use RCU for port table.Stephen Hemminger
2003-03-22[PATCH] make list.h barriers smp-onlyAndrew Morton
From: Dipankar Sarma <dipankar@in.ibm.com> This patch makes the list macros use smp-only version of the barriers, no need to hurt UP performance.
2003-03-14Revert duplicate <linux/stddef.h> addition.Linus Torvalds
2003-03-10[PATCH] include stddef.h in include/linux/list.hGreg Ungerer
This patches add an include to stddef.h into include/linux/list.h. It uses the NULL define.
2003-03-06[PATCH] missing includeAnton Blanchard
list.h must now include stddef since it uses NULL.
2003-03-03[PATCH] dcache/inode hlist patchkitAndi Kleen
- Inode and dcache Hash table only needs half the memory/cache because of using hlists. - Simplify dcache-rcu code. With NULL end markers in the hlists is_bucket is not needed anymore. Also the list walking code generates better code on x86 now because it doesn't need to dedicate a register for the list head. - Reorganize struct dentry to be more cache friendly. All the state accessed for the hash walk is in one chunk now together with the inline name (all at the end) - Add prefetching for all the list walks. Old hash lookup code didn't use it. - Some other minor cleanup.
2002-10-28[PATCH] remove LVM1 leftovers from the treeChristoph Hellwig
Now that the devicemapper hit the tree there's no more reason to keep the uncompiling LVM1 code around and it's various hacks to other files around, this patch removes it.
2002-10-18[PATCH] RCU helper patchset 2/2Dipankar Sarma
This adds a set of list macros that make handling of list protected by RCU simpler. The interfaces added are - list_add_rcu list_add_tail_rcu - Adds an element by taking care of memory barrier (wmb()). list_del_rcu - Deletes an element but doesn't re-initialize the pointers in the element for supporting RCU based traversal. list_for_each_rcu __list_for_each_rcu - Traversal of RCU protected list - takes care of memory barriers transparently.
2002-10-04[PATCH] remove debug code from list_del()Andrew Morton
It hasn't caught any bugs, and it is causing confusion over whether this is a permanent part of list_del() behaviour.
2002-09-22[PATCH] pidhash cleanups, tgid-2.5.38-F3Ingo Molnar
This does the following things: - removes the ->thread_group list and uses a new PIDTYPE_TGID pid class to handle thread groups. This cleans up lots of code in signal.c and elsewhere. - fixes sys_execve() if a non-leader thread calls it. (2.5.38 crashed in this case.) - renames list_for_each_noprefetch to __list_for_each. - cleans up delayed-leader parent notification. - introduces link_pid() to optimize PIDTYPE_TGID installation in the thread-group case. I've tested the patch with a number of threaded and non-threaded workloads, and it works just fine. Compiles & boots on UP and SMP x86. The session/pgrp bugs reported to lkml are probably still open, they are the next on my todo - now that we have a clean pidhash architecture they should be easier to fix.
2002-09-19[PATCH] generic-pidhash-2.5.36-J2, BK-currIngo Molnar
This is the latest version of the generic pidhash patch. The biggest change is the removal of separately allocated pid structures: they are now part of the task structure and the first task that uses a PID will provide the pid structure. Task refcounting is used to avoid the freeing of the task structure before every member of a process group or session has exited. This approach has a number of advantages besides the performance gains. Besides simplifying the whole hashing code significantly, attach_pid() is now fundamentally atomic and can be called during create_process() without worrying about task-list side-effects. It does not have to re-search the pidhash to find out about raced PID-adding either, and attach_pid() cannot fail due to OOM. detach_pid() can do a simple put_task_struct() instead of the kmem_cache_free(). The only minimal downside is the potential pending task structures after session leaders or group leaders have exited - but the number of orphan sessions and process groups is usually very low - and even if it's higher, this can be regarded as a slow execution of the final deallocation of the session leader, not some additional burden.
2002-09-03[PATCH] list_t removalRusty Russell
This removes list_t, which is a gratuitous typedef for a "struct list_head". Unless there is good reason, the kernel doesn't usually typedef, as typedefs cannot be predeclared unlike structs.
2002-08-27[PATCH] list_for_each_entryRusty Russell
This adds list_for_each_entry, which is the equivalent of list_for_each and list_entry, except only one variable is needed.
2002-07-28[PATCH] misc fixesAndrew Morton
There are a few VM-related patches in this series. Mainly fixes; feature work is on hold. We have some fairly serious locking contention problems with the reverse mapping's pte_chains. Until we have a clear way out of that I believe that it is best to not merge code which has a lot of rmap dependency. It is apparent that these problems will not be solved by tweaking - some redesign is needed. In the 2.5 timeframe the only practical solution appears to be page table sharing, based on Daniel's February work. Daniel and Dave McCracken are working that. Some bits and pieces here: - list_splice() has an open-coded list_empty() in it. Use list_empty() instead. - in shrink_cache() we have a local `nr_pages' which shadows another local. Rename the inner one. (Nikita Danilov) - Add a BUG() on a can't-happen code path in page_remove_rmap(). - Tighten up the bug checks in the BH completion handlers - if the buffer is still under IO then it must be locked, because we unlock it inside the page_uptodate_lock.
2002-07-23[PATCH] type safe(r) list_entry repacement: container_ofNeil Brown
Define container_of which cast from member to struct with some type checking. This is much like list_entry but is cearly for things other than lists. List_entry now uses container_of.