Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752538AbbFCFU1 (ORCPT ); Wed, 3 Jun 2015 01:20:27 -0400 Received: from mail-pd0-f179.google.com ([209.85.192.179]:35557 "EHLO mail-pd0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751023AbbFCFUS (ORCPT ); Wed, 3 Jun 2015 01:20:18 -0400 Date: Wed, 3 Jun 2015 14:20:13 +0900 From: Tejun Heo To: yalin wang Cc: Andrew Morton , laijs@cn.fujitsu.com, nacc@linux.vnet.ibm.com, penguin-kernel@i-love.sakura.ne.jp, Linux Kernel Mailing List Subject: Re: Fwd: [RFC] make kthread_worker_fn to be freezable Message-ID: <20150603052013.GA20091@mtj.duckdns.org> References: <64da06e6.12ce6.14dae8b205f.Coremail.cn_wyl2003@126.com> <20150601114019.GA14841@htj.duckdns.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 792 Lines: 25 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 -- 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/