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:	Wed, 18 Nov 2009 01:25:37 +0900
From:	Tejun Heo <tj@...nel.org>
To:	linux-kernel@...r.kernel.org, jeff@...zik.org, mingo@...e.hu,
	akpm@...ux-foundation.org, jens.axboe@...cle.com,
	rusty@...tcorp.com.au, cl@...ux-foundation.org,
	dhowells@...hat.com, arjan@...ux.intel.com,
	torvalds@...ux-foundation.org, avi@...hat.com,
	peterz@...radead.org, andi@...stfloor.org, fweisbec@...il.com
Subject: Re: [PATCH 19/21] workqueue: introduce worker

Hello,

11/17/2009 08:51 PM, Louis Rilling wrote:
>>> +static struct worker *create_worker(struct cpu_workqueue_struct *cwq, bool bind)
>>> +{
>>> +	int id = -1;
>>> +	struct worker *worker = NULL;
>>> +
>>> +	spin_lock(&workqueue_lock);
>>> +	while (ida_get_new(&per_cpu(worker_ida, cwq->cpu), &id)) {
>>> +		spin_unlock_irq(&workqueue_lock);
>>> +		if (!ida_pre_get(&per_cpu(worker_ida, cwq->cpu), GFP_KERNEL))
>>> +			goto fail;
>>> +		spin_lock(&workqueue_lock);
>>> +	}
>>> +	spin_unlock_irq(&workqueue_lock);
>>> +
>>> +	worker = alloc_worker();
>>> +	if (!worker)
>>> +		goto fail;
>>> +
>>> +	worker->cwq = cwq;
>>> +	worker->id = id;
>>> +
>>> +	worker->task = kthread_create(worker_thread, worker, "kworker/%u:%d",
>>> +				      cwq->cpu, id);
>>> +	if (IS_ERR(worker->task))
>>> +		goto fail;
>>> +
>>> +	if (bind)
>>> +		kthread_bind(worker->task, cwq->cpu);
>>> +
>>> +	return worker;
>>> +fail:
>>> +	if (id >= 0) {
>>> +		spin_lock(&workqueue_lock);
>>> +		ida_remove(&per_cpu(worker_ida, cwq->cpu), id);
>>> +		spin_unlock_irq(&workqueue_lock);
>>> +	}
>>> +	kfree(worker);
>>> +	return NULL;
>>> +}
>>
>> AFAIU create_worker() should call spin_lock_irq() instead of spin_lock().
> 
> spin_unlock() instead of spin_unlock_irq() looks better in fact ;).

Oooh... right, thanks for spotting that.  I'll fix it up.

-- 
tejun
--
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