From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932437AbdCWHiR (ORCPT ); Thu, 23 Mar 2017 03:38:17 -0400 Received: from LGEAMRELO12.lge.com ([156.147.23.52]:56284 "EHLO lgeamrelo12.lge.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932384AbdCWHiP (ORCPT ); Thu, 23 Mar 2017 03:38:15 -0400 X-Original-SENDERIP: 156.147.1.121 X-Original-MAILFROM: minchan@kernel.org X-Original-SENDERIP: 165.244.249.23 X-Original-MAILFROM: minchan@kernel.org X-Original-SENDERIP: 10.177.223.161 X-Original-MAILFROM: minchan@kernel.org Date: Thu, 23 Mar 2017 14:53:09 +0900 From: Minchan Kim To: Aaron Lu CC: , , 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: <20170323055309.GA6117@bbox> 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> <20170322134304.GG2360@aaronlu.sh.intel.com> MIME-Version: 1.0 In-Reply-To: <20170322134304.GG2360@aaronlu.sh.intel.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-MIMETrack: Itemize by SMTP Server on LGEKRMHUB05/LGE/LG Group(Release 8.5.3FP6|November 21, 2013) at 2017/03/23 14:53:09, Serialize by Router on LGEKRMHUB05/LGE/LG Group(Release 8.5.3FP6|November 21, 2013) at 2017/03/23 14:53:09, Serialize complete at 2017/03/23 14:53:09 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 22, 2017 at 09:43:04PM +0800, Aaron Lu wrote: > 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. Aha, it solves my wonder. Thanks a lot! From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg0-f71.google.com (mail-pg0-f71.google.com [74.125.83.71]) by kanga.kvack.org (Postfix) with ESMTP id 206956B0038 for ; Thu, 23 Mar 2017 01:53:14 -0400 (EDT) Received: by mail-pg0-f71.google.com with SMTP id q126so420509375pga.0 for ; Wed, 22 Mar 2017 22:53:14 -0700 (PDT) Received: from lgeamrelo12.lge.com (LGEAMRELO12.lge.com. [156.147.23.52]) by mx.google.com with ESMTP id m5si4317989pln.98.2017.03.22.22.53.12 for ; Wed, 22 Mar 2017 22:53:13 -0700 (PDT) Date: Thu, 23 Mar 2017 14:53:09 +0900 From: Minchan Kim Subject: Re: [PATCH v2 3/5] mm: use a dedicated workqueue for the free workers Message-ID: <20170323055309.GA6117@bbox> 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> <20170322134304.GG2360@aaronlu.sh.intel.com> MIME-Version: 1.0 In-Reply-To: <20170322134304.GG2360@aaronlu.sh.intel.com> Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline Sender: owner-linux-mm@kvack.org List-ID: To: Aaron Lu Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Dave Hansen , Tim Chen , Andrew Morton , Ying Huang On Wed, Mar 22, 2017 at 09:43:04PM +0800, Aaron Lu wrote: > 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. Aha, it solves my wonder. Thanks a lot! -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org