All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@tv-sign.ru>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Ingo Molnar <mingo@elte.hu>, David Howells <dhowells@redhat.com>,
	Daniel Drake <dsd@gentoo.org>,
	linux-kernel@vger.kernel.org
Subject: [PATCH 4/3] make cancel_rearming_delayed_work() work on any workqueue, not just keventd_wq
Date: Mon, 12 Feb 2007 00:15:24 +0300	[thread overview]
Message-ID: <20070211211524.GA203@tv-sign.ru> (raw)

cancel_rearming_delayed_workqueue(wq, dwork) doesn't need the first parameter.
We don't hang on un-queued dwork any longer, and work->data doesn't change its
type. This means we can always figure out "wq" from dwork when it is needed.

Remove this parameter, and rename the function to cancel_rearming_delayed_work().
Re-create an inline "obsolete" cancel_rearming_delayed_workqueue(wq) which just
calls cancel_rearming_delayed_work().

Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>

 include/linux/workqueue.h |   13 ++++++++++---
 kernel/workqueue.c        |   26 +++++++++-----------------
 2 files changed, 19 insertions(+), 20 deletions(-)

--- 6.20-rc6-mm3/include/linux/workqueue.h~4_crdw	2007-02-10 18:16:15.000000000 +0300
+++ 6.20-rc6-mm3/include/linux/workqueue.h	2007-02-11 23:27:28.000000000 +0300
@@ -185,9 +185,6 @@ extern int current_is_keventd(void);
 extern int keventd_up(void);
 
 extern void init_workqueues(void);
-void cancel_rearming_delayed_work(struct delayed_work *work);
-void cancel_rearming_delayed_workqueue(struct workqueue_struct *,
-				       struct delayed_work *);
 int execute_in_process_context(work_func_t fn, struct execute_work *);
 
 /*
@@ -205,4 +202,14 @@ static inline int cancel_delayed_work(st
 	return ret;
 }
 
+void cancel_rearming_delayed_work(struct delayed_work *work);
+
+/* Obsolete. use cancel_rearming_delayed_work() */
+static inline
+void cancel_rearming_delayed_workqueue(struct workqueue_struct *wq,
+					struct delayed_work *work)
+{
+	cancel_rearming_delayed_work(work);
+}
+
 #endif
--- 6.20-rc6-mm3/kernel/workqueue.c~4_crdw	2007-02-10 19:07:41.000000000 +0300
+++ 6.20-rc6-mm3/kernel/workqueue.c	2007-02-11 23:32:34.000000000 +0300
@@ -555,36 +555,28 @@ void flush_work_keventd(struct work_stru
 EXPORT_SYMBOL(flush_work_keventd);
 
 /**
- * cancel_rearming_delayed_workqueue - kill off a delayed work whose handler rearms the delayed work.
+ * cancel_rearming_delayed_work - kill off a delayed work whose handler rearms the delayed work.
  * @wq:   the controlling workqueue structure
  * @dwork: the delayed work struct
  *
  * Note that the work callback function may still be running on return from
  * cancel_delayed_work(). Run flush_workqueue() or flush_work() to wait on it.
  */
-void cancel_rearming_delayed_workqueue(struct workqueue_struct *wq,
-				       struct delayed_work *dwork)
+void cancel_rearming_delayed_work(struct delayed_work *dwork)
 {
+	struct cpu_workqueue_struct *cwq = get_wq_data(&dwork->work);
+
 	/* Was it ever queued ? */
-	if (!get_wq_data(&dwork->work))
-		return;
+	if (cwq != NULL) {
+		struct workqueue_struct *wq = cwq->wq;
 
-	while (!cancel_delayed_work(dwork))
-		flush_workqueue(wq);
+		while (!cancel_delayed_work(dwork))
+			flush_workqueue(wq);
+	}
 }
 EXPORT_SYMBOL(cancel_rearming_delayed_workqueue);
 
 /**
- * cancel_rearming_delayed_work - kill off a delayed keventd work whose handler rearms the delayed work.
- * @dwork: the delayed work struct
- */
-void cancel_rearming_delayed_work(struct delayed_work *dwork)
-{
-	cancel_rearming_delayed_workqueue(keventd_wq, dwork);
-}
-EXPORT_SYMBOL(cancel_rearming_delayed_work);
-
-/**
  * execute_in_process_context - reliably execute the routine with user context
  * @fn:		the function to execute
  * @ew:		guaranteed storage for the execute work structure (must


             reply	other threads:[~2007-02-11 21:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-11 21:15 Oleg Nesterov [this message]
2007-02-12  0:52 ` [PATCH 4/3] make cancel_rearming_delayed_work() work on any workqueue, not just keventd_wq Oleg Nesterov

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=20070211211524.GA203@tv-sign.ru \
    --to=oleg@tv-sign.ru \
    --cc=akpm@linux-foundation.org \
    --cc=dhowells@redhat.com \
    --cc=dsd@gentoo.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.