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: <20090820172027.cdc41d1e.akpm@linux-foundation.org>
Date:	Thu, 20 Aug 2009 17:20:27 -0700
From:	Andrew Morton <akpm@...ux-foundation.org>
To:	Jens Axboe <jens.axboe@...cle.com>
Cc:	linux-kernel@...r.kernel.org, jeff@...zik.org,
	benh@...nel.crashing.org, htejun@...il.com, bzolnier@...il.com,
	alan@...rguk.ukuu.org.uk, jens.axboe@...cle.com
Subject: Re: [PATCH 2/6] workqueue: add support for lazy workqueues

On Thu, 20 Aug 2009 12:17:39 +0200
Jens Axboe <jens.axboe@...cle.com> wrote:

> Lazy workqueues are like normal workqueues, except they don't
> start a thread per CPU by default. Instead threads are started
> when they are needed, and exit when they have been idle for
> some time.
> 
>
> ...
>
> @@ -280,7 +309,34 @@ static void run_workqueue(struct cpu_workqueue_struct *cwq)
>  		trace_workqueue_execution(cwq->thread, work);
>  		cwq->current_work = work;
>  		list_del_init(cwq->worklist.next);
> +		cpu = smp_processor_id();
>  		spin_unlock_irq(&cwq->lock);
> +		did_work = 1;
> +
> +		/*
> +		 * If work->cpu isn't us, then we need to create the target
> +		 * workqueue thread (if someone didn't already do that) and
> +		 * move the work over there.
> +		 */
> +		if ((cwq->wq->flags & WQ_F_LAZY) && work->cpu != cpu) {
> +			struct cpu_workqueue_struct *__cwq;
> +			struct task_struct *p;
> +			int err;
> +
> +			__cwq = wq_per_cpu(cwq->wq, work->cpu);
> +			p = __cwq->thread;
> +			if (!p)
> +				err = create_workqueue_thread(__cwq, work->cpu);
> +			p = __cwq->thread;
> +			if (p) {
> +				if (work->cpu >= 0)

It's an unsigned int.  This test is always true.

> +					kthread_bind(p, work->cpu);

I wonder what happens if work->cpu isn't online any more.

> +				insert_work(__cwq, work, &__cwq->worklist);
> +				wake_up_process(p);
> +				goto out;
> +			}
> +		}
> +
>  
>  		BUG_ON(get_wq_data(work) != cwq);
>  		work_clear_pending(work);
>
> ...
>
--
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