public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Doug Ledford <dledford@redhat.com>
To: Petr Mladek <pmladek@suse.com>
Cc: Sean Hefty <sean.hefty@intel.com>,
	Hal Rosenstock <hal.rosenstock@gmail.com>,
	linux-rdma@vger.kernel.org, Tejun Heo <tj@kernel.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] IB/fmr_pool: Convert the cleanup thread into kthread worker API
Date: Tue, 25 Apr 2017 14:29:48 -0400	[thread overview]
Message-ID: <1493144988.3041.86.camel@redhat.com> (raw)
In-Reply-To: <1476718772-9760-1-git-send-email-pmladek@suse.com>

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 <pmladek@suse.com>
> TO: Doug Ledford <dledford@redhat.com>
> CC: Sean Hefty <sean.hefty@intel.com>
> CC: Hal Rosenstock <hal.rosenstock@gmail.com>
> 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.

-- 
Doug Ledford <dledford@redhat.com>
    GPG KeyID: B826A3330E572FDD
   
Key fingerprint = AE6B 1BDA 122B 23B4 265B  1274 B826 A333 0E57 2FDD

  reply	other threads:[~2017-04-25 18:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-17 15:39 [PATCH] IB/fmr_pool: Convert the cleanup thread into kthread worker API Petr Mladek
2017-04-25 18:29 ` Doug Ledford [this message]
2017-04-26  8:40   ` Petr Mladek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1493144988.3041.86.camel@redhat.com \
    --to=dledford@redhat.com \
    --cc=hal.rosenstock@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=pmladek@suse.com \
    --cc=sean.hefty@intel.com \
    --cc=tj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox