Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759713AbdCVNnA (ORCPT ); Wed, 22 Mar 2017 09:43:00 -0400 Received: from mga03.intel.com ([134.134.136.65]:23394 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751333AbdCVNmx (ORCPT ); Wed, 22 Mar 2017 09:42:53 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,205,1486454400"; d="scan'208";a="1125776765" Date: Wed, 22 Mar 2017 21:43:04 +0800 From: Aaron Lu To: Minchan Kim Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Dave Hansen , Tim Chen , Andrew Morton , Ying Huang Subject: Re: [PATCH v2 3/5] mm: use a dedicated workqueue for the free workers Message-ID: <20170322134304.GG2360@aaronlu.sh.intel.com> References: <1489568404-7817-1-git-send-email-aaron.lu@intel.com> <1489568404-7817-4-git-send-email-aaron.lu@intel.com> <20170322063335.GF30149@bbox> <20170322084103.GC2360@aaronlu.sh.intel.com> <20170322085512.GA32359@bbox> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170322085512.GA32359@bbox> User-Agent: Mutt/1.8.0 (2017-02-23) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1130 Lines: 28 On Wed, Mar 22, 2017 at 05:55:12PM +0900, Minchan Kim wrote: > On Wed, Mar 22, 2017 at 04:41:04PM +0800, Aaron Lu wrote: > > My understanding of the unbound workqueue is that it will create a > > thread pool for each node, versus each CPU as in the bound workqueue > > case, and use threads from the thread pool(create threads if not enough) > > to do the work. > > Yes, that was my understand so I read code and found that > > insert_work: > .. > if (__need_more_worker(pool)) > wake_up_worker(pool); > > so I thought if there is a running thread in that node, workqueue > will not wake any other threads so parallelism should be max 2. > AFAIK, if the work goes sleep, scheduler will spawn new worker > thread so the active worker could be a lot but I cannot see any > significant sleepable point in that work(ie, batch_free_work). Looks like worker_thread() will spawn new worker through manage_worker(). Note that pool->nr_running will always be zero for an unbound workqueue and thus need_more_worker() will return true as long as there are queued work items in the pool. Thanks, Aaron