[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20120813170303.GF9180@google.com>
Date: Mon, 13 Aug 2012 10:03:03 -0700
From: Tejun Heo <tj@...nel.org>
To: JoonSoo Kim <js1304@...il.com>
Cc: linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/5] workqueue: change value of lcpu in
queue_delayed_work_on()
Hello,
On Tue, Aug 14, 2012 at 01:54:22AM +0900, JoonSoo Kim wrote:
> wq = WQ_NON_REENTRANT.
> queue_delayed_work_on(CPU B) is invoked in CPU A, so lcpu = CPU A, cpu = CPU B.
>
> In this case, we call add_time_on(CPU B), then delayed_work_timer_fn()
> is invoked on CPU B.
> delayed_work_timer_fn() calls __queue_work(), then following
> comparisons return true!
>
> gcwq = get_gcwq(cpu);
> if (wq->flags & WQ_NON_REENTRANT &&
> (last_gcwq = get_work_gcwq(work)) && last_gcwq != gcwq) {
>
> I thinks that if we assign cpu to lcpu, above comparisons return
> false, so save some overheads.
> Is there any missing part?
Nope, that sound correct to me.
> And, do u mean @cpu is WORK_CPU_UNBOUND?
@cpu could be WORK_CPU_UNBOUND at that point. The timer will be added
to local CPU but @work->data would be pointing to WORK_CPU_UNBOUND,
again triggering the condition. Given that @cpu being
WORK_CPU_UNBOUND is far more common than an actual CPU number, the
patch would actually increase spurious nrt lookups. The right thing
to do is probably setting cpu to raw_smp_processor_id() beforehand.
Thanks.
--
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