From: Namhyung Kim <namhyung@kernel.org>
To: Tejun Heo <tj@kernel.org>
Cc: linux-kernel@vger.kernel.org, torvalds@linux-foundation.org,
joshhunt00@gmail.com, axboe@kernel.dk, rni@google.com,
vgoyal@redhat.com, vwadekar@nvidia.com,
herbert@gondor.hengli.com.au, davem@davemloft.net,
linux-crypto@vger.kernel.org, swhiteho@redhat.com, bpm@sgi.com,
elder@kernel.org, xfs@oss.sgi.com, marcel@holtmann.org,
gustavo@padovan.org, johan.hedberg@gmail.com,
linux-bluetooth@vger.kernel.org, martin.petersen@oracle.com
Subject: Re: [PATCH 2/6] workqueue: factor out worker_pool from global_cwq
Date: Tue, 10 Jul 2012 13:48:44 +0900 [thread overview]
Message-ID: <87ehok8bmb.fsf@sejong.aot.lge.com> (raw)
In-Reply-To: <1341859315-17759-3-git-send-email-tj@kernel.org> (Tejun Heo's message of "Mon, 9 Jul 2012 11:41:51 -0700")
Hi, Tejun
Just nitpicks..
On Mon, 9 Jul 2012 11:41:51 -0700, Tejun Heo wrote:
> Move worklist and all worker management fields from global_cwq into
> the new struct worker_pool. worker_pool points back to the containing
> gcwq. worker and cpu_workqueue_struct are updated to point to
> worker_pool instead of gcwq too.
>
> This change is mechanical and doesn't introduce any functional
> difference other than rearranging of fields and an added level of
> indirection in some places. This is to prepare for multiple pools per
> gcwq.
>
> Signed-off-by: Tejun Heo <tj@kernel.org>
> ---
> include/trace/events/workqueue.h | 2 +-
> kernel/workqueue.c | 216 ++++++++++++++++++++-----------------
> 2 files changed, 118 insertions(+), 100 deletions(-)
>
> diff --git a/include/trace/events/workqueue.h b/include/trace/events/workqueue.h
> index 4018f50..f28d1b6 100644
> --- a/include/trace/events/workqueue.h
> +++ b/include/trace/events/workqueue.h
> @@ -54,7 +54,7 @@ TRACE_EVENT(workqueue_queue_work,
> __entry->function = work->func;
> __entry->workqueue = cwq->wq;
> __entry->req_cpu = req_cpu;
> - __entry->cpu = cwq->gcwq->cpu;
> + __entry->cpu = cwq->pool->gcwq->cpu;
> ),
>
> TP_printk("work struct=%p function=%pf workqueue=%p req_cpu=%u cpu=%u",
> diff --git a/kernel/workqueue.c b/kernel/workqueue.c
> index 27637c2..bc43a0c 100644
> --- a/kernel/workqueue.c
> +++ b/kernel/workqueue.c
> @@ -115,6 +115,7 @@ enum {
> */
>
> struct global_cwq;
> +struct worker_pool;
>
> /*
> * The poor guys doing the actual heavy lifting. All on-duty workers
> @@ -131,7 +132,7 @@ struct worker {
> struct cpu_workqueue_struct *current_cwq; /* L: current_work's cwq */
> struct list_head scheduled; /* L: scheduled works */
> struct task_struct *task; /* I: worker task */
> - struct global_cwq *gcwq; /* I: the associated gcwq */
> + struct worker_pool *pool; /* I: the associated pool */
> /* 64 bytes boundary on 64bit, 32 on 32bit */
> unsigned long last_active; /* L: last active timestamp */
> unsigned int flags; /* X: flags */
> @@ -139,6 +140,21 @@ struct worker {
> struct work_struct rebind_work; /* L: rebind worker to cpu */
> };
>
> +struct worker_pool {
> + struct global_cwq *gcwq; /* I: the owning gcwq */
> +
> + struct list_head worklist; /* L: list of pending works */
> + int nr_workers; /* L: total number of workers */
> + int nr_idle; /* L: currently idle ones */
> +
> + struct list_head idle_list; /* X: list of idle workers */
> + struct timer_list idle_timer; /* L: worker idle timeout */
> + struct timer_list mayday_timer; /* L: SOS timer for dworkers */
What is 'dworkers'?
> +
> + struct ida worker_ida; /* L: for worker IDs */
> + struct worker *first_idle; /* L: first idle worker */
> +};
> +
> /*
> * Global per-cpu workqueue. There's one and only one for each cpu
> * and all works are queued and processed here regardless of their
> @@ -146,27 +162,18 @@ struct worker {
> */
> struct global_cwq {
> spinlock_t lock; /* the gcwq lock */
> - struct list_head worklist; /* L: list of pending works */
> unsigned int cpu; /* I: the associated cpu */
> unsigned int flags; /* L: GCWQ_* flags */
>
> - int nr_workers; /* L: total number of workers */
> - int nr_idle; /* L: currently idle ones */
> -
> - /* workers are chained either in the idle_list or busy_hash */
> - struct list_head idle_list; /* X: list of idle workers */
> + /* workers are chained either in busy_head or pool idle_list */
s/busy_head/busy_hash/ ?
Thanks,
Namhyung
> struct hlist_head busy_hash[BUSY_WORKER_HASH_SIZE];
> /* L: hash of busy workers */
>
> - struct timer_list idle_timer; /* L: worker idle timeout */
> - struct timer_list mayday_timer; /* L: SOS timer for dworkers */
> -
> - struct ida worker_ida; /* L: for worker IDs */
> + struct worker_pool pool; /* the worker pools */
>
> struct task_struct *trustee; /* L: for gcwq shutdown */
> unsigned int trustee_state; /* L: trustee state */
> wait_queue_head_t trustee_wait; /* trustee wait */
> - struct worker *first_idle; /* L: first idle worker */
> } ____cacheline_aligned_in_smp;
>
> /*
next prev parent reply other threads:[~2012-07-10 4:53 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-09 18:41 [PATCHSET] workqueue: reimplement high priority using a separate worker pool Tejun Heo
2012-07-09 18:41 ` [PATCH 1/6] workqueue: don't use WQ_HIGHPRI for unbound workqueues Tejun Heo
2012-07-09 18:41 ` [PATCH 2/6] workqueue: factor out worker_pool from global_cwq Tejun Heo
2012-07-10 4:48 ` Namhyung Kim [this message]
2012-07-12 17:07 ` Tejun Heo
2012-07-12 21:49 ` [PATCH UPDATED " Tejun Heo
2012-07-09 18:41 ` [PATCH 3/6] workqueue: use @pool instead of @gcwq or @cpu where applicable Tejun Heo
2012-07-10 23:30 ` Tony Luck
2012-07-12 17:06 ` Tejun Heo
2012-07-09 18:41 ` [PATCH 4/6] workqueue: separate out worker_pool flags Tejun Heo
2012-07-09 18:41 ` [PATCH 5/6] workqueue: introduce NR_WORKER_POOLS and for_each_worker_pool() Tejun Heo
2012-07-14 3:55 ` Tejun Heo
2012-07-14 4:27 ` Linus Torvalds
2012-07-14 4:44 ` Tejun Heo
2012-07-14 5:00 ` Linus Torvalds
2012-07-14 5:07 ` Tejun Heo
2012-07-16 19:31 ` Peter Seebach
2012-07-14 5:21 ` [PATCH UPDATED " Tejun Heo
2012-07-09 18:41 ` [PATCH 6/6] workqueue: reimplement WQ_HIGHPRI using a separate worker_pool Tejun Heo
2012-07-12 13:06 ` Fengguang Wu
2012-07-12 17:05 ` Tejun Heo
2012-07-12 21:45 ` Tejun Heo
2012-07-12 22:16 ` Tony Luck
2012-07-12 22:32 ` Tejun Heo
2012-07-12 23:24 ` Tony Luck
2012-07-12 23:36 ` Tejun Heo
2012-07-12 23:46 ` Tony Luck
2012-07-13 17:51 ` Tony Luck
2012-07-13 2:08 ` Fengguang Wu
2012-07-14 3:41 ` Tejun Heo
2012-07-14 3:56 ` [PATCH UPDATED " Tejun Heo
2012-07-14 8:18 ` Fengguang Wu
2012-07-14 5:24 ` [PATCH UPDATED v3 " Tejun Heo
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=87ehok8bmb.fsf@sejong.aot.lge.com \
--to=namhyung@kernel.org \
--cc=axboe@kernel.dk \
--cc=bpm@sgi.com \
--cc=davem@davemloft.net \
--cc=elder@kernel.org \
--cc=gustavo@padovan.org \
--cc=herbert@gondor.hengli.com.au \
--cc=johan.hedberg@gmail.com \
--cc=joshhunt00@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marcel@holtmann.org \
--cc=martin.petersen@oracle.com \
--cc=rni@google.com \
--cc=swhiteho@redhat.com \
--cc=tj@kernel.org \
--cc=torvalds@linux-foundation.org \
--cc=vgoyal@redhat.com \
--cc=vwadekar@nvidia.com \
--cc=xfs@oss.sgi.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