From: Andy Walls <awalls@md.metrocast.net>
To: Tejun Heo <tj@kernel.org>
Cc: linux-kernel@vger.kernel.org,
Andrew Morton <akpm@linux-foundation.org>,
Avi Kivity <avi@redhat.com>,
kvm@vger.kernel.org, ivtv-devel@ivtvdriver.org,
linux-media@vger.kernel.org,
Grant Likely <grant.likely@secretlab.ca>,
spi-devel-general@lists.sourceforge.net,
Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: [PATCH 1/2] kthread_worker: reorganize to prepare for flush_kthread_work() reimplementation
Date: Sat, 21 Jul 2012 13:13:27 -0400 [thread overview]
Message-ID: <1342890808.2504.3.camel@palomino.walls.org> (raw)
In-Reply-To: <20120719211541.GB32763@google.com>
On Thu, 2012-07-19 at 14:15 -0700, Tejun Heo wrote:
> From c9bba34243a86fb3ac82d1bdd0ce4bf796b79559 Mon Sep 17 00:00:00 2001
> From: Tejun Heo <tj@kernel.org>
> Date: Thu, 19 Jul 2012 13:52:53 -0700
>
> Make the following two non-functional changes.
>
> * Separate out insert_kthread_work() from queue_kthread_work().
>
> * Relocate struct kthread_flush_work and kthread_flush_work_fn()
> definitions above flush_kthread_work().
>
> Signed-off-by: Tejun Heo <tj@kernel.org>
> ---
> kernel/kthread.c | 40 ++++++++++++++++++++++++----------------
> 1 files changed, 24 insertions(+), 16 deletions(-)
>
> diff --git a/kernel/kthread.c b/kernel/kthread.c
> index 3d3de63..7b8a678 100644
> --- a/kernel/kthread.c
> +++ b/kernel/kthread.c
> @@ -378,6 +378,17 @@ repeat:
> }
> EXPORT_SYMBOL_GPL(kthread_worker_fn);
>
> +/* insert @work before @pos in @worker */
Hi Tejun,
Would a comment that the caller should be holding worker->lock be useful
here? Anyway, comment or not:
Acked-by: Andy Walls <awall@md.metrocast.net>
Regards,
Andy
> +static void insert_kthread_work(struct kthread_worker *worker,
> + struct kthread_work *work,
> + struct list_head *pos)
> +{
> + list_add_tail(&work->node, pos);
> + work->queue_seq++;
> + if (likely(worker->task))
> + wake_up_process(worker->task);
> +}
> +
> /**
> * queue_kthread_work - queue a kthread_work
> * @worker: target kthread_worker
> @@ -395,10 +406,7 @@ bool queue_kthread_work(struct kthread_worker *worker,
>
> spin_lock_irqsave(&worker->lock, flags);
> if (list_empty(&work->node)) {
> - list_add_tail(&work->node, &worker->work_list);
> - work->queue_seq++;
> - if (likely(worker->task))
> - wake_up_process(worker->task);
> + insert_kthread_work(worker, work, &worker->work_list);
> ret = true;
> }
> spin_unlock_irqrestore(&worker->lock, flags);
> @@ -406,6 +414,18 @@ bool queue_kthread_work(struct kthread_worker *worker,
> }
> EXPORT_SYMBOL_GPL(queue_kthread_work);
>
> +struct kthread_flush_work {
> + struct kthread_work work;
> + struct completion done;
> +};
> +
> +static void kthread_flush_work_fn(struct kthread_work *work)
> +{
> + struct kthread_flush_work *fwork =
> + container_of(work, struct kthread_flush_work, work);
> + complete(&fwork->done);
> +}
> +
> /**
> * flush_kthread_work - flush a kthread_work
> * @work: work to flush
> @@ -436,18 +456,6 @@ void flush_kthread_work(struct kthread_work *work)
> }
> EXPORT_SYMBOL_GPL(flush_kthread_work);
>
> -struct kthread_flush_work {
> - struct kthread_work work;
> - struct completion done;
> -};
> -
> -static void kthread_flush_work_fn(struct kthread_work *work)
> -{
> - struct kthread_flush_work *fwork =
> - container_of(work, struct kthread_flush_work, work);
> - complete(&fwork->done);
> -}
> -
> /**
> * flush_kthread_worker - flush all current works on a kthread_worker
> * @worker: worker to flush
next prev parent reply other threads:[~2012-07-21 17:16 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-19 21:15 [PATCHSET] kthread_worker: reimplement flush_kthread_work() to allow freeing during execution Tejun Heo
2012-07-19 21:15 ` [PATCH 1/2] kthread_worker: reorganize to prepare for flush_kthread_work() reimplementation Tejun Heo
2012-07-21 17:13 ` Andy Walls [this message]
2012-07-22 16:46 ` Tejun Heo
2012-07-22 20:42 ` Andy Walls
2012-07-22 17:22 ` [PATCH UPDATED " Tejun Heo
2012-07-19 21:16 ` [PATCH 2/2] kthread_worker: reimplement flush_kthread_work() to allow freeing the work item being executed Tejun Heo
2012-07-21 18:20 ` Andy Walls
2012-07-22 16:49 ` Tejun Heo
2012-07-22 20:46 ` Andy Walls
2012-07-23 17:12 ` Tejun Heo
2012-07-24 11:17 ` Andy Walls
2012-07-22 20:39 ` Andy Walls
2012-09-14 22:50 ` [PATCHSET] kthread_worker: reimplement flush_kthread_work() to allow freeing during execution Colin Cross
2012-09-17 19:40 ` Tejun Heo
2012-09-17 20:28 ` Greg KH
2012-09-28 0:19 ` Greg KH
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=1342890808.2504.3.camel@palomino.walls.org \
--to=awalls@md.metrocast.net \
--cc=akpm@linux-foundation.org \
--cc=avi@redhat.com \
--cc=grant.likely@secretlab.ca \
--cc=ivtv-devel@ivtvdriver.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=spi-devel-general@lists.sourceforge.net \
--cc=tj@kernel.org \
--cc=torvalds@linux-foundation.org \
/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;
as well as URLs for NNTP newsgroup(s).