linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: yalin wang <yalin.wang2010@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	laijs@cn.fujitsu.com, nacc@linux.vnet.ibm.com,
	penguin-kernel@i-love.sakura.ne.jp,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: Fwd: [RFC] make kthread_worker_fn to be freezable
Date: Wed, 3 Jun 2015 14:20:13 +0900	[thread overview]
Message-ID: <20150603052013.GA20091@mtj.duckdns.org> (raw)
In-Reply-To: <CAFP4FLp1zkS0LT64V=sLKCKEED+76016M3bX05n3RJF=KFS-zA@mail.gmail.com>

On Tue, Jun 02, 2015 at 11:13:44AM +0800, yalin wang wrote:
> this means i need create kthread like this :
> 
> struct task_struct *kworker_task = kthread_run(kthread_worker_fn,
> &worker, "nvme%d", dev->instance);
> kworker_task->flags &= ~PF_NOFREEZE;
> is it safe to do like this ?

It's not.

> i don't see an API to set other thread to be freezable .
> only set_freezable() , which set the current thread to be freezable .

But you can create a wrapper kthread function which sets freezable and
calls kthread_worker_fn().

Thanks.

-- 
tejun

  reply	other threads:[~2015-06-03  5:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <64da06e6.12ce6.14dae8b205f.Coremail.cn_wyl2003@126.com>
2015-06-01 10:05 ` Fwd: [RFC] make kthread_worker_fn to be freezable yalin wang
2015-06-01 11:40   ` Tejun Heo
2015-06-02  3:13     ` yalin wang
2015-06-03  5:20       ` Tejun Heo [this message]
2015-06-04  8:39         ` yalin wang

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=20150603052013.GA20091@mtj.duckdns.org \
    --to=tj@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=laijs@cn.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nacc@linux.vnet.ibm.com \
    --cc=penguin-kernel@i-love.sakura.ne.jp \
    --cc=yalin.wang2010@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).