[RFC/PATCH 1/7] Add csd_locked function

From: Michael Neuling
Date: Mon Dec 06 2010 - 18:43:00 EST


Add csd_locked function to determine if a struct call_single_data is
currently locked. This can be used to see if an IPI can be called
again using this call_single_data.

Signed-off-by: Michael Neuling <mikey@xxxxxxxxxxx>
---
kernel/smp.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)

Index: linux-lazy/kernel/smp.c
===================================================================
--- linux-lazy.orig/kernel/smp.c
+++ linux-lazy/kernel/smp.c
@@ -12,6 +12,7 @@
#include <linux/gfp.h>
#include <linux/smp.h>
#include <linux/cpu.h>
+#include <linux/hardirq.h>

static struct {
struct list_head queue;
@@ -131,6 +132,22 @@
}

/*
+ * Determine if a csd is currently locked. This can be used to
+ * determine if an IPI is currently pending using this csd already.
+ */
+int csd_locked(struct call_single_data *data)
+{
+ WARN_ON(preemptible());
+
+ /* Ensure flags have propagated */
+ smp_mb();
+
+ if (data->flags & CSD_FLAG_LOCK)
+ return 1;
+ return 0;
+}
+
+/*
* Insert a previously allocated call_single_data element
* for execution on the given CPU. data must already have
* ->func, ->info, and ->flags set.


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/