[ltt-dev] [PATCH] ltt-relay: remove work_struct

Lai Jiangshan laijs at cn.fujitsu.com
Fri Dec 12 04:13:55 EST 2008


Impact: cleanup

work_struct is not need.

Signed-off-by: Lai Jiangshan <laijs at cn.fujitsu.com>
---
--- linux-2.6.27.7-lttng-0.61.orig/ltt/ltt-relay.c	2008-12-03 16:25:24.000000000 +0800
+++ linux-2.6.27.7-lttng-0.61/ltt/ltt-relay.c	2008-12-12 13:04:16.000000000 +0800
@@ -87,7 +87,6 @@ struct ltt_channel_buf_struct {
 					 * Wait queue for blocking user space
 					 * writers
 					 */
-	struct work_struct wake_writers;/* Writers wake-up work struct */
 	atomic_t wakeup_readers;	/* Boolean : wakeup readers waiting ? */
 } ____cacheline_aligned;
 
@@ -241,6 +240,19 @@ static int ltt_remove_buf_file_callback(
 }
 
 /*
+ * Wake writers :
+ *
+ * This must be done after the trace is removed from the RCU list so that there
+ * are no stalled writers.
+ */
+static void ltt_relay_wake_writers(struct ltt_channel_buf_struct *ltt_buf)
+{
+
+	if (waitqueue_active(&ltt_buf->write_wait))
+		wake_up_interruptible(&ltt_buf->write_wait);
+}
+
+/*
  * This function should not be called from NMI interrupt context
  */
 static notrace void ltt_buf_unfull(struct rchan_buf *buf,
@@ -252,8 +264,7 @@ static notrace void ltt_buf_unfull(struc
 	struct ltt_channel_buf_struct *ltt_buf =
 		percpu_ptr(ltt_channel->buf, buf->cpu);
 
-	if (waitqueue_active(&ltt_buf->write_wait))
-		schedule_work(&ltt_buf->wake_writers);
+	ltt_relay_wake_writers(ltt_buf);
 }
 
 /**
@@ -662,14 +673,6 @@ static void ltt_relay_release_channel(st
 	kfree(ltt_chan);
 }
 
-static void ltt_wakeup_writers(struct work_struct *work)
-{
-	struct ltt_channel_buf_struct *ltt_buf =
-		container_of(work, struct ltt_channel_buf_struct, wake_writers);
-
-	wake_up_interruptible(&ltt_buf->write_wait);
-}
-
 /*
  * Create ltt buffer.
  */
@@ -696,7 +699,6 @@ static int ltt_relay_create_buffer(struc
 		local_set(&ltt_buf->commit_count[j], 0);
 	init_waitqueue_head(&ltt_buf->write_wait);
 	atomic_set(&ltt_buf->wakeup_readers, 0);
-	INIT_WORK(&ltt_buf->wake_writers, ltt_wakeup_writers);
 	spin_lock_init(&ltt_buf->full_lock);
 
 	ltt_buffer_begin_callback(buf, trace->start_tsc, 0);
@@ -856,19 +858,6 @@ static void ltt_relay_async_wakeup_chan(
 	}
 }
 
-/*
- * Wake writers :
- *
- * This must be done after the trace is removed from the RCU list so that there
- * are no stalled writers.
- */
-static void ltt_relay_wake_writers(struct ltt_channel_buf_struct *ltt_buf)
-{
-
-	if (waitqueue_active(&ltt_buf->write_wait))
-		schedule_work(&ltt_buf->wake_writers);
-}
-
 static void ltt_relay_finish_buffer(struct ltt_channel_struct *ltt_channel,
 		unsigned int cpu)
 {
--- linux-2.6.27.7-lttng-0.61.orig/ltt/ltt-relay-locked.c	2008-12-03 16:25:22.000000000 +0800
+++ linux-2.6.27.7-lttng-0.61/ltt/ltt-relay-locked.c	2008-12-12 13:09:21.000000000 +0800
@@ -78,7 +78,6 @@ struct ltt_channel_buf_struct {
 					 * Wait queue for blocking user space
 					 * writers
 					 */
-	struct work_struct wake_writers;/* Writers wake-up work struct */
 	int wakeup_readers;		/* Boolean : wakeup readers waiting ? */
 } ____cacheline_aligned;
 
@@ -233,6 +232,19 @@ static int ltt_remove_buf_file_callback(
 }
 
 /*
+ * Wake writers :
+ *
+ * This must be done after the trace is removed from the RCU list so that there
+ * are no stalled writers.
+ */
+static void ltt_relay_wake_writers(struct ltt_channel_buf_struct *ltt_buf)
+{
+
+	if (waitqueue_active(&ltt_buf->write_wait))
+		wake_up_interruptible(&ltt_buf->write_wait);
+}
+
+/*
  * This function should not be called from NMI interrupt context
  */
 static notrace void ltt_buf_unfull(struct rchan_buf *buf,
@@ -244,8 +256,7 @@ static notrace void ltt_buf_unfull(struc
 	struct ltt_channel_buf_struct *ltt_buf =
 		percpu_ptr(ltt_channel->buf, buf->cpu);
 
-	if (waitqueue_active(&ltt_buf->write_wait))
-		schedule_work(&ltt_buf->wake_writers);
+	ltt_relay_wake_writers(ltt_buf);
 }
 
 /**
@@ -661,14 +672,6 @@ static void ltt_relay_release_channel(st
 	kfree(ltt_chan);
 }
 
-static void ltt_wakeup_writers(struct work_struct *work)
-{
-	struct ltt_channel_buf_struct *ltt_buf =
-		container_of(work, struct ltt_channel_buf_struct, wake_writers);
-
-	wake_up_interruptible(&ltt_buf->write_wait);
-}
-
 /*
  * Create ltt buffer.
  */
@@ -689,7 +692,6 @@ static int ltt_relay_create_buffer(struc
 	kref_get(&ltt_chan->kref);
 	ltt_buf->offset = ltt_subbuffer_header_size();
 	init_waitqueue_head(&ltt_buf->write_wait);
-	INIT_WORK(&ltt_buf->wake_writers, ltt_wakeup_writers);
 
 	ltt_buffer_begin_callback(buf, trace->start_tsc, 0);
 	ltt_buf->commit_count[0] += ltt_subbuffer_header_size();
@@ -844,19 +846,6 @@ static void ltt_relay_async_wakeup_chan(
 	}
 }
 
-/*
- * Wake writers :
- *
- * This must be done after the trace is removed from the RCU list so that there
- * are no stalled writers.
- */
-static void ltt_relay_wake_writers(struct ltt_channel_buf_struct *ltt_buf)
-{
-
-	if (waitqueue_active(&ltt_buf->write_wait))
-		schedule_work(&ltt_buf->wake_writers);
-}
-
 static void ltt_relay_finish_buffer(struct ltt_channel_struct *ltt_channel,
 		unsigned int cpu)
 {






More information about the lttng-dev mailing list