From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2992787AbXDTNF0 (ORCPT ); Fri, 20 Apr 2007 09:05:26 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S2992792AbXDTNF0 (ORCPT ); Fri, 20 Apr 2007 09:05:26 -0400 Received: from pentafluge.infradead.org ([213.146.154.40]:44221 "EHLO pentafluge.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2992787AbXDTNFZ (ORCPT ); Fri, 20 Apr 2007 09:05:25 -0400 Date: Fri, 20 Apr 2007 14:05:01 +0100 From: Christoph Hellwig To: Cedric Le Goater Cc: "Eric W. Biederman" , ", containers@lists.osdl.org, Oleg Nesterov , Christoph Hellwig , linux-kernel@vger.kernel.org Subject: Re: [PATCH] saa7134-tvaudio: Convert to kthread API. Message-ID: <20070420130501.GA27917@infradead.org> Mail-Followup-To: Christoph Hellwig , Cedric Le Goater , "Eric W. Biederman" , ", containers@lists.osdl.org, Oleg Nesterov , linux-kernel@vger.kernel.org References: <11769658091138-git-send-email-ebiederm@xmission.com> <4628B6A3.8010800@fr.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4628B6A3.8010800@fr.ibm.com> User-Agent: Mutt/1.4.2.2i X-SRS-Rewrite: SMTP reverse-path rewritten from by pentafluge.infradead.org See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 20, 2007 at 02:48:35PM +0200, Cedric Le Goater wrote: > Eric W. Biederman wrote: > > From: Eric W. Biederman - unquoted > > > > It is my goal to replace all kernel code that handles signals > > from user space, calls kernel_thread or calls daemonize. All > > of which the kthread_api makes unncessary. Handling signals > > from user space is a maintenance problem becuase using a > > kernel thread is an implementation detail and if user space > > cares it does not allow us to change the implementation. Calling > > daemonize is a problem because it has to undo a continually changing > > set of state generated by user space, requiring the implemetation > > to change continually. kernel_thread is a problem because it > > returns a pid_t value. Numeric pids are inherently racy and > > in the presence of a pid namespace they are no longer global > > making them useless for general use in the kernel. > > > > So this patch renames the pid member of struct saa7134_thread > > started and changes it's type from pid_t to int. All it > > has ever been used for is to detect if the kernel thread > > is has been started so this works. > > > > allow_signal(SIGTERM) and the calls to signal_pending have > > been removed they are needed for the driver to operation. > > > > The startup of tvaudio_thread and tvaudio_thread_dep have > > been modified to use kthread_run instead of a combination > > of kernel_thread and daemonize. > > > > The result is code that is slightly simpler and more > > maintainable. > > Here's a refreshed attempt using kthread_should_stop(). > Unfortunately, not tested bc we don't have the hardware. I have a patch for this one flying around somewhere aswell. It's trivial to kill the waitqueue and just use wake_up_process, otherwise it looks pretty similar.