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]
Message-ID: <20080211105115.GC162@tv-sign.ru>
Date:	Mon, 11 Feb 2008 13:51:15 +0300
From:	Oleg Nesterov <oleg@...sign.ru>
To:	Andrew Morton <akpm@...ux-foundation.org>
Cc:	Jens Axboe <jens.axboe@...cle.com>, linux-kernel@...r.kernel.org,
	Alan.Brunelle@...com, arjan@...ux.intel.com, dgc@....com,
	npiggin@...e.de
Subject: Re: [PATCH 2/8] Add interface for queuing work on a specific CPU

Sorry for delay,

On 02/07, Andrew Morton wrote:
>
> On Thu,  7 Feb 2008 10:18:59 +0100 Jens Axboe <jens.axboe@...cle.com> wrote:
> 
> > --- a/kernel/workqueue.c
> > +++ b/kernel/workqueue.c
> > @@ -175,6 +175,21 @@ int fastcall queue_work(struct workqueue_struct *wq, struct work_struct *work)
> >  }
> >  EXPORT_SYMBOL_GPL(queue_work);
> >  
> > +int fastcall queue_work_on_cpu(struct workqueue_struct *wq,
> > +			       struct work_struct *work, int cpu)
> > +{
> > +	int ret = 0;
> > +
> > +	if (!test_and_set_bit(WORK_STRUCT_PENDING, work_data_bits(work))) {
> > +		BUG_ON(!list_empty(&work->entry));
> > +		__queue_work(per_cpu_ptr(wq->cpu_wq, cpu), work);
> > +		ret = 1;
> > +	}
> > +
> > +	return ret;
> > +}
> > +EXPORT_SYMBOL_GPL(queue_work_on_cpu);
> 
> Might as well change queue_work() to call this?

This is possible, but in that case queue_work_on_cpu() should use wq_per_cpu(),
not per_cpu_ptr(). (otherwise queue_work(single_threaded_wq) won't work).


A bit off-topic, the comment near queue_work() says

	* We queue the work to the CPU it was submitted, but there is no
	* guarantee that it will be processed by that CPU.

This is wrong. Unless cpu_down() happens, we do guarantee it will be processed
by that CPU. Perhaps it makes sense to fix the comment as well?

Oleg.

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