Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752915AbbFDIke (ORCPT ); Thu, 4 Jun 2015 04:40:34 -0400 Received: from mail-ig0-f176.google.com ([209.85.213.176]:35948 "EHLO mail-ig0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752685AbbFDIjy (ORCPT ); Thu, 4 Jun 2015 04:39:54 -0400 MIME-Version: 1.0 In-Reply-To: <20150603052013.GA20091@mtj.duckdns.org> References: <64da06e6.12ce6.14dae8b205f.Coremail.cn_wyl2003@126.com> <20150601114019.GA14841@htj.duckdns.org> <20150603052013.GA20091@mtj.duckdns.org> Date: Thu, 4 Jun 2015 16:39:53 +0800 Message-ID: Subject: Re: Fwd: [RFC] make kthread_worker_fn to be freezable From: yalin wang To: Tejun Heo Cc: Andrew Morton , laijs@cn.fujitsu.com, nacc@linux.vnet.ibm.com, penguin-kernel@i-love.sakura.ne.jp, Linux Kernel Mailing List Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 894 Lines: 24 2015-06-03 13:20 GMT+08:00 Tejun Heo : > 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(). > oh, got it, i see your meaning, Thanks a lot ! -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/