All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rusty Russell <rusty@rustcorp.com.au>
To: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: jens.axboe@oracle.com, mingo@elte.hu, akpm@linux-foundation.org,
	schwidefsky@de.ibm.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH/RFC v2 2/6] workqueue: introduce create_rt_workqueue
Date: Wed, 22 Oct 2008 09:15:27 +1100	[thread overview]
Message-ID: <200810220915.28083.rusty@rustcorp.com.au> (raw)
In-Reply-To: <20081013215130.891702049@de.ibm.com>

On Tuesday 14 October 2008 08:50:09 Heiko Carstens wrote:
> From: Heiko Carstens <heiko.carstens@de.ibm.com>
>
> create_rt_workqueue will create a real time prioritized workqueue.
> This is needed for the conversion of stop_machine to a workqueue based
> implementation.
> This patch adds yet another parameter to __create_workqueue_key to tell
> it that we want an rt workqueue.
> However it looks like we rather should have something like "int type"
> instead of singlethread, freezable and rt.

Ingo didn't ack this, but he didn't nack it either and it's a straightforward 
transformation.  If we want to enum the type we can always do it later.

I'll push this now as part of my stop_machine and module series.

Thanks!
Rusty.


>
> Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
> ---
>  include/linux/workqueue.h |   18 ++++++++++--------
>  kernel/workqueue.c        |    7 ++++++-
>  2 files changed, 16 insertions(+), 9 deletions(-)
>
> Index: linux-2.6/include/linux/workqueue.h
> ===================================================================
> --- linux-2.6.orig/include/linux/workqueue.h
> +++ linux-2.6/include/linux/workqueue.h
> @@ -149,11 +149,11 @@ struct execute_work {
>
>  extern struct workqueue_struct *
>  __create_workqueue_key(const char *name, int singlethread,
> -		       int freezeable, struct lock_class_key *key,
> +		       int freezeable, int rt, struct lock_class_key *key,
>  		       const char *lock_name);
>
>  #ifdef CONFIG_LOCKDEP
> -#define __create_workqueue(name, singlethread, freezeable)	\
> +#define __create_workqueue(name, singlethread, freezeable, rt)	\
>  ({								\
>  	static struct lock_class_key __key;			\
>  	const char *__lock_name;				\
> @@ -164,17 +164,19 @@ __create_workqueue_key(const char *name,
>  		__lock_name = #name;				\
>  								\
>  	__create_workqueue_key((name), (singlethread),		\
> -			       (freezeable), &__key,		\
> +			       (freezeable), (rt), &__key,	\
>  			       __lock_name);			\
>  })
>  #else
> -#define __create_workqueue(name, singlethread, freezeable)	\
> -	__create_workqueue_key((name), (singlethread), (freezeable), NULL, NULL)
> +#define __create_workqueue(name, singlethread, freezeable, rt)	\
> +	__create_workqueue_key((name), (singlethread), (freezeable), (rt), \
> +			       NULL, NULL)
>  #endif
>
> -#define create_workqueue(name) __create_workqueue((name), 0, 0)
> -#define create_freezeable_workqueue(name) __create_workqueue((name), 1, 1)
> -#define create_singlethread_workqueue(name) __create_workqueue((name), 1,
> 0) +#define create_workqueue(name) __create_workqueue((name), 0, 0, 0)
> +#define create_rt_workqueue(name) __create_workqueue((name), 0, 0, 1)
> +#define create_freezeable_workqueue(name) __create_workqueue((name), 1, 1,
> 0) +#define create_singlethread_workqueue(name) __create_workqueue((name),
> 1, 0, 0)
>
>  extern void destroy_workqueue(struct workqueue_struct *wq);
>
> Index: linux-2.6/kernel/workqueue.c
> ===================================================================
> --- linux-2.6.orig/kernel/workqueue.c
> +++ linux-2.6/kernel/workqueue.c
> @@ -62,6 +62,7 @@ struct workqueue_struct {
>  	const char *name;
>  	int singlethread;
>  	int freezeable;		/* Freeze threads during suspend */
> +	int rt;
>  #ifdef CONFIG_LOCKDEP
>  	struct lockdep_map lockdep_map;
>  #endif
> @@ -766,6 +767,7 @@ init_cpu_workqueue(struct workqueue_stru
>
>  static int create_workqueue_thread(struct cpu_workqueue_struct *cwq, int
> cpu) {
> +	struct sched_param param = { .sched_priority = MAX_RT_PRIO-1 };
>  	struct workqueue_struct *wq = cwq->wq;
>  	const char *fmt = is_single_threaded(wq) ? "%s" : "%s/%d";
>  	struct task_struct *p;
> @@ -781,7 +783,8 @@ static int create_workqueue_thread(struc
>  	 */
>  	if (IS_ERR(p))
>  		return PTR_ERR(p);
> -
> +	if (cwq->wq->rt)
> +		sched_setscheduler_nocheck(p, SCHED_FIFO, &param);
>  	cwq->thread = p;
>
>  	return 0;
> @@ -801,6 +804,7 @@ static void start_workqueue_thread(struc
>  struct workqueue_struct *__create_workqueue_key(const char *name,
>  						int singlethread,
>  						int freezeable,
> +						int rt,
>  						struct lock_class_key *key,
>  						const char *lock_name)
>  {
> @@ -822,6 +826,7 @@ struct workqueue_struct *__create_workqu
>  	lockdep_init_map(&wq->lockdep_map, lock_name, key, 0);
>  	wq->singlethread = singlethread;
>  	wq->freezeable = freezeable;
> +	wq->rt = rt;
>  	INIT_LIST_HEAD(&wq->list);
>
>  	if (singlethread) {



  reply	other threads:[~2008-10-21 22:15 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-13 21:50 [PATCH/RFC v2 0/6] Convert stop_machine to use a workqueue Heiko Carstens
2008-10-13 21:50 ` [PATCH/RFC v2 1/6] Call init_workqueues before pre smp initcalls Heiko Carstens
2008-10-13 21:50 ` [PATCH/RFC v2 2/6] workqueue: introduce create_rt_workqueue Heiko Carstens
2008-10-21 22:15   ` Rusty Russell [this message]
2008-10-13 21:50 ` [PATCH/RFC v2 3/6] stop_machine: use workqueues instead of kernel threads Heiko Carstens
2008-10-13 21:50 ` [PATCH/RFC v2 4/6] stop_machine: special case for one cpu Heiko Carstens
2008-10-13 21:50 ` [PATCH/RFC v2 5/6] s390: convert etr/stp to stop_machine interface Heiko Carstens
2008-10-13 21:50 ` [PATCH/RFC v2 6/6] s390: convert to generic IPI infrstructure Heiko Carstens
2008-10-16 10:38 ` [PATCH/RFC v2 0/6] Convert stop_machine to use a workqueue Rusty Russell

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=200810220915.28083.rusty@rustcorp.com.au \
    --to=rusty@rustcorp.com.au \
    --cc=akpm@linux-foundation.org \
    --cc=heiko.carstens@de.ibm.com \
    --cc=jens.axboe@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=schwidefsky@de.ibm.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 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.