From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751389AbeAPRfk (ORCPT + 1 other); Tue, 16 Jan 2018 12:35:40 -0500 Received: from mail-qk0-f181.google.com ([209.85.220.181]:35003 "EHLO mail-qk0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750876AbeAPRfi (ORCPT ); Tue, 16 Jan 2018 12:35:38 -0500 X-Google-Smtp-Source: ACJfBotAppfek5hNgaBb0/EWC+b53n3iCIF03dpY/4wCOTbQ0oA9nc4aC5WyucCbmHghTC6HGTdk1w== Date: Tue, 16 Jan 2018 09:35:34 -0800 From: Tejun Heo To: Neeraj Upadhyay Cc: jiangshanlai@gmail.com, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, prsood@codeaurora.org, sramana@codeaurora.org Subject: Re: [PATCH] workqueue: Handle race between wake up and rebind Message-ID: <20180116173534.GR3460072@devbig577.frc2.facebook.com> References: <1516005492-4994-1-git-send-email-neeraju@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1516005492-4994-1-git-send-email-neeraju@codeaurora.org> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: Hello, Neeraj. On Mon, Jan 15, 2018 at 02:08:12PM +0530, Neeraj Upadhyay wrote: > - kworker/0:0 gets chance to run on cpu1; while processing > a work, it goes to sleep. However, it does not decrement > pool->nr_running. This is because WORKER_REBOUND (NOT_ > RUNNING) flag was cleared, when worker entered worker_ Do you mean that because REBOUND was set? > thread(). > > Worker 0 runs on cpu1 > worker_thread() > process_one_work() > wq_worker_sleeping() > if (worker->flags & WORKER_NOT_RUNNING) > return NULL; > if (WARN_ON_ONCE(pool->cpu != raw_smp_processor_id())) > > > - After this, when kworker/0:0 wakes up, this time on its > bounded cpu cpu0, it increments pool->nr_running again. > So, pool->nr_running becomes 2. Why is it suddenly 2? Who made it one on the account of the kworker? Do you see this happening? Or better, is there a (semi) reliable repro for this issue? Thanks. -- tejun