aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/padata.h
diff options
context:
space:
mode:
authorSteffen Klassert <steffen.klassert@secunet.com>2010-05-18 23:43:14 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2010-05-18 23:43:14 -0400
commitd46a5ac7a7e2045e33c6ad6ffb8cf18a7e86a15a (patch)
tree2ccfba3ee24ed28e80ae3e3be330a7b44f77dbcf /include/linux/padata.h
parent18eb8ea6ee4cc9ed39b45f95b734f523bcfb586b (diff)
padata: Use a timer to handle remaining objects in the reorder queues
padata_get_next needs to check whether the next object that need serialization must be parallel processed by the local cpu. This check was wrong implemented and returned always true, so the try_again loop in padata_reorder was never taken. This can lead to object leaks in some rare cases due to a race that appears with the trylock in padata_reorder. The try_again loop was not a good idea after all, because a cpu could take that loop frequently, so we handle this with a timer instead. This patch adds a timer to handle the race that appears with the trylock. If cpu1 queues an object to the reorder queue while cpu2 holds the pd->lock but left the while loop in padata_reorder already, cpu2 can't care for this object and cpu1 exits because it can't get the lock. Usually the next cpu that takes the lock cares for this object too. We need the timer just if this object was the last one that arrives to the reorder queues. The timer function sends it out in this case. Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'include/linux/padata.h')
-rw-r--r--include/linux/padata.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/linux/padata.h b/include/linux/padata.h
index 51611da9c498..64836a63bd17 100644
--- a/include/linux/padata.h
+++ b/include/linux/padata.h
@@ -24,6 +24,7 @@
24#include <linux/workqueue.h> 24#include <linux/workqueue.h>
25#include <linux/spinlock.h> 25#include <linux/spinlock.h>
26#include <linux/list.h> 26#include <linux/list.h>
27#include <linux/timer.h>
27 28
28struct padata_priv { 29struct padata_priv {
29 struct list_head list; 30 struct list_head list;
@@ -60,6 +61,7 @@ struct parallel_data {
60 unsigned int max_seq_nr; 61 unsigned int max_seq_nr;
61 cpumask_var_t cpumask; 62 cpumask_var_t cpumask;
62 spinlock_t lock; 63 spinlock_t lock;
64 struct timer_list timer;
63}; 65};
64 66
65struct padata_instance { 67struct padata_instance {