lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 22 Jan 2009 09:05:24 +0800
From:	Lai Jiangshan <laijs@...fujitsu.com>
To:	Ingo Molnar <mingo@...e.hu>
CC:	Oleg Nesterov <oleg@...sign.ru>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] workqueue: don't alloc_percpu for single workqueue

Ingo Molnar wrote:
> * Lai Jiangshan <laijs@...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.
> 
> 
> 


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ