All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lai Jiangshan <laijs@cn.fujitsu.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: Oleg Nesterov <oleg@tv-sign.ru>,
	Andrew Morton <akpm@linux-foundation.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] workqueue: don't alloc_percpu for single workqueue
Date: Thu, 22 Jan 2009 09:05:24 +0800	[thread overview]
Message-ID: <4977C654.7010906@cn.fujitsu.com> (raw)
In-Reply-To: <20090121104811.GB25531@elte.hu>

Ingo Molnar wrote:
> * Lai Jiangshan <laijs@cn.fujitsu.com> wrote:
> 
>> allocating memory for every cpu for single workqueue is waste.
> 
> good idea.
> 
> One detail:
> 
>> @@ -906,6 +907,13 @@ void destroy_workqueue(struct workqueue_struct *wq)
>>  	const struct cpumask *cpu_map = wq_cpu_map(wq);
>>  	int cpu;
>>  
>> +	if (is_wq_single_threaded(wq)) {
>> +		cleanup_workqueue_thread(wq->cpu_wq);
>> +		kfree(wq->cpu_wq);
>> +		kfree(wq);
>> +		return;
>> +	}
>> +
>>  	cpu_maps_update_begin();
>>  	spin_lock(&workqueue_lock);
>>  	list_del(&wq->list);
> 
> Arent we forgetting to remove the workqueue from the &workqueues list in 
> the new single-thread case?

Single-thread workqueue is not inserted into &workqueues list.

See also the single thread case in __create_workqueue_key():
.....
	if (singlethread) {
		cwq = wq->cpu_wq;
		init_cpu_workqueue(wq, cwq);
		err = create_workqueue_thread(cwq, singlethread_cpu);
		start_workqueue_thread(cwq, -1);
	}
.....

> 
> Also, see the checkpatch output from kernel/workqueue.c - the warnings 
> below are correct and should be cleaned up.
> 
> 	Ingo
> 
> WARNING: printk() should include KERN_ facility level
> #268: FILE: workqueue.c:268:
> +		printk("%s: recursion depth exceeded: %d\n",
> 
> ERROR: code indent should use tabs where possible
> #304: FILE: workqueue.c:304:
> +^I^I^I^I       ^Itask_pid_nr(current));$
> 
> ERROR: "foo* bar" should be "foo *bar"
> #555: FILE: workqueue.c:555:
> +				struct timer_list* timer)
> 
> ERROR: code indent should use tabs where possible
> #916: FILE: workqueue.c:916:
> + ^Icpu_maps_update_done();$
> 
> kernel/workqueue.c has style problems, please review.  If any of these errors
> are false positives report them to the maintainer, see
> CHECKPATCH in MAINTAINERS.
> 
> 
> 



  reply	other threads:[~2009-01-22  1:06 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-21  9:42 [PATCH] workqueue: don't alloc_percpu for single workqueue Lai Jiangshan
2009-01-21 10:29 ` Frédéric Weisbecker
2009-01-21 10:48 ` Ingo Molnar
2009-01-22  1:05   ` Lai Jiangshan [this message]
2009-01-21 12:17 ` Oleg Nesterov
2009-01-22  3:42   ` Lai Jiangshan
2009-01-22 16:11     ` Oleg Nesterov
2009-02-16  2:39       ` Lai Jiangshan
2009-01-21 13:01 ` Eric Dumazet

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=4977C654.7010906@cn.fujitsu.com \
    --to=laijs@cn.fujitsu.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=oleg@tv-sign.ru \
    /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.