From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1957159AbdDZIlD (ORCPT ); Wed, 26 Apr 2017 04:41:03 -0400 Received: from mx2.suse.de ([195.135.220.15]:55992 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1036629AbdDZIky (ORCPT ); Wed, 26 Apr 2017 04:40:54 -0400 Date: Wed, 26 Apr 2017 10:40:48 +0200 From: Petr Mladek To: Doug Ledford Cc: Sean Hefty , Hal Rosenstock , linux-rdma@vger.kernel.org, Tejun Heo , linux-kernel@vger.kernel.org Subject: Re: [PATCH] IB/fmr_pool: Convert the cleanup thread into kthread worker API Message-ID: <20170426084048.GS3452@pathway.suse.cz> References: <1476718772-9760-1-git-send-email-pmladek@suse.com> <1493144988.3041.86.camel@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1493144988.3041.86.camel@redhat.com> 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 On Tue 2017-04-25 14:29:48, Doug Ledford wrote: > On Mon, 2016-10-17 at 17:39 +0200, Petr Mladek wrote: > > Kthreads are currently implemented as an infinite loop. Each > > has its own variant of checks for terminating, freezing, > > awakening. In many cases it is unclear to say in which state > > it is and sometimes it is done a wrong way. > > > > The plan is to convert kthreads into kthread_worker or workqueues > > API. It allows to split the functionality into separate operations. > > It helps to make a better structure. Also it defines a clean state > > where no locks are taken, IRQs blocked, the kthread might sleep > > or even be safely migrated. > > > > The kthread worker API is useful when we want to have a dedicated > > single thread for the work. It helps to make sure that it is > > available when needed. Also it allows a better control, e.g. > > define a scheduling priority. > > > > This patch converts the frm_pool kthread into the kthread worker > > API because I am not sure how busy the thread is. It is well > > possible that it does not need a dedicated kthread and workqueues > > would be perfectly fine. Well, the conversion between kthread > > worker API and workqueues is pretty trivial. > > > > The patch moves one iteration from the kthread into the work > > function. > > It is queued only when there is a pending work. Therefore we do not > > need to compare flush_ser and req_ser at the beginning. On the > > contrary, > > the same work could be queued only once at a time. Therefore it has > > to > > re-queue itself if some requests are pending. > > > > Otherwise, wake_up_process() is replaced by queuing the work. > > > > Important: The change is only compile tested. I did not find an easy > > way how to check it in a real life. > > > > Signed-off-by: Petr Mladek > > TO: Doug Ledford > > CC: Sean Hefty > > CC: Hal Rosenstock > > CC: linux-rdma@vger.kernel.org > > Hi Petr, > > This patch has sat around for a long time.  I've decided to take it in > this release, even though it isn't really tested, on the basis that we > will perform some testing internally using the mthca driver (if you > combine the mthca driver with certain upper level protocols, you can > create a situation where FMR memory will be the preferred memory in use > IIRC) and revert if it doesn't work properly. Thanks a lot for taking it. I hope that it will be fine. Best Regards, Petr