Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756425Ab0GAOvX (ORCPT ); Thu, 1 Jul 2010 10:51:23 -0400 Received: from mx1.redhat.com ([209.132.183.28]:11819 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751246Ab0GAOvW (ORCPT ); Thu, 1 Jul 2010 10:51:22 -0400 Date: Thu, 1 Jul 2010 16:46:24 +0200 From: Oleg Nesterov To: Tejun Heo Cc: "Michael S. Tsirkin" , Peter Zijlstra , Ingo Molnar , Sridhar Samudrala , netdev , lkml , "kvm@vger.kernel.org" , Andrew Morton , Dmitri Vorobiev , Jiri Kosina , Thomas Gleixner , Andi Kleen Subject: Re: [PATCH repost] sched: export sched_set/getaffinity to modules Message-ID: <20100701144624.GA11171@redhat.com> References: <1277983179.1917.10.camel@laptop> <1277984603.1917.15.camel@laptop> <20100701115507.GA31333@redhat.com> <20100701122340.GB31333@redhat.com> <1277987657.1917.32.camel@laptop> <1277988395.1917.47.camel@laptop> <20100701130816.GB32223@redhat.com> <1277991024.1917.108.camel@laptop> <20100701133956.GD32223@redhat.com> <4C2CA5C5.4040402@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4C2CA5C5.4040402@kernel.org> User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1099 Lines: 37 On 07/01, Tejun Heo wrote: > > All that's necessary is shortcutting indirection through kthreadd. > ie. An exported function which looks like the following, > > struct kthread_clone_or_whatever(int (*threadfn).....) > { > struct kthread_create_info create; > int pid; > > INIT create; > > pid = kernel_thread(kthread, &create, CLONE_FS...); > if (pid < 0) > return ERROR; > wait_for_completion(&create.done); > > if (!IS_ERR(create.result)) > SET NAME; > return create.result; > } > > It might be a good idea to make the function take extra clone flags > but anyways once created cloned task can be treated the same way as > other kthreads, so nothing else needs to be changed. This makes kthread_stop() work. Otherwise the new thread is just the CLONE_VM child of the caller, and the caller is the user-mode task doing ioctl() ? Oleg. -- 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/