Mirror of the lttng-dev mailing list
 help / color / mirror / Atom feed
From: laijs@cn.fujitsu.com (Lai Jiangshan)
Subject: [ltt-dev] [PATCH] ltt-relay: remove work_struct
Date: Fri, 12 Dec 2008 17:13:55 +0800	[thread overview]
Message-ID: <49422B53.3060506@cn.fujitsu.com> (raw)


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)
 {






             reply	other threads:[~2008-12-12  9:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-12  9:13 Lai Jiangshan [this message]
2008-12-12 14:08 ` Mathieu Desnoyers

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=49422B53.3060506@cn.fujitsu.com \
    --to=laijs@cn.fujitsu.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