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] [day] [month] [year] [list]
Date:	Tue, 14 Aug 2012 12:00:20 -0700
From:	Tejun Heo <tj@...nel.org>
To:	Joonsoo Kim <js1304@...il.com>
Cc:	linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 3/6] workqueue: change value of lcpu in
 __queue_delayed_work_on()

On Wed, Aug 15, 2012 at 03:10:13AM +0900, Joonsoo Kim wrote:
> We assign cpu id into work struct's data field in __queue_delayed_work_on().
> In current implementation, when work is come in first time,
> current running cpu id is assigned.
> If we do __queue_delayed_work_on() with CPU A on CPU B,
> __queue_work() invoked in delayed_work_timer_fn() go into
> the following sub-optimal path in case of WQ_NON_REENTRANT.
> 
> 	gcwq = get_gcwq(cpu);
> 	if (wq->flags & WQ_NON_REENTRANT &&
> 		(last_gcwq = get_work_gcwq(work)) && last_gcwq != gcwq) {
> 
> Change lcpu to @cpu and rechange lcpu to local cpu if lcpu is WORK_CPU_UNBOUND.
> It is sufficient to prevent to go into sub-optimal path.
> 
> Signed-off-by: Joonsoo Kim <js1304@...il.com>
> 
> diff --git a/kernel/workqueue.c b/kernel/workqueue.c
> index 6a17ab0..f55ac26 100644
> --- a/kernel/workqueue.c
> +++ b/kernel/workqueue.c
> @@ -1358,9 +1358,10 @@ static void __queue_delayed_work(int cpu, struct workqueue_struct *wq,
>  	if (!(wq->flags & WQ_UNBOUND)) {
>  		struct global_cwq *gcwq = get_work_gcwq(work);
>  
> -		if (gcwq && gcwq->cpu != WORK_CPU_UNBOUND)
> +		lcpu = cpu;
> +		if (gcwq)
>  			lcpu = gcwq->cpu;
> -		else
> +		if (lcpu == WORK_CPU_UNBOUND)
>  			lcpu = raw_smp_processor_id();

Can you please add a comment explanining what's going on?

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