Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1765820AbXF1TXQ (ORCPT ); Thu, 28 Jun 2007 15:23:16 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1763995AbXF1TXA (ORCPT ); Thu, 28 Jun 2007 15:23:00 -0400 Received: from ik-out-1112.google.com ([66.249.90.180]:10161 "EHLO ik-out-1112.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1764767AbXF1TW7 (ORCPT ); Thu, 28 Jun 2007 15:22:59 -0400 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=nVeyzjt3AMqz5pDh8kbvqWbDAPzVIBqJ0PGYL7VF0873HmvGp3NVRPzNngKAoLWiKLO4v54lgIYGhUaE2odVLDEBE559Q9znbHJetRbjwPBtIMUoBgpjJFWTdH7PPPP53xcjoD7IYPey+24t6lq6q3VMnqWaLAejYwvSV50d1OE= Message-ID: Date: Fri, 29 Jun 2007 00:52:56 +0530 From: "Satyam Sharma" To: "Oleg Nesterov" Subject: Re: [PATCH] RFC: have tcp_recvmsg() check kthread_should_stop() and treat it as if it were signalled Cc: "Jeff Layton" , "Herbert Xu" , linux-kernel@vger.kernel.org, "Eric W. Biederman" In-Reply-To: <20070628170825.GA549@tv-sign.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <20070608123527.9b4cdafe.jlayton@redhat.com> <20070609070826.7bd3480c.jlayton@redhat.com> <20070626115449.GA92@tv-sign.ru> <20070627122437.GA158@tv-sign.ru> <20070628141246.GA95@tv-sign.ru> <20070628170825.GA549@tv-sign.ru> Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1628 Lines: 42 Hi Oleg, On 6/28/07, Oleg Nesterov wrote: > On 06/28, Satyam Sharma wrote: > > > > Second, we *must* break that tcp_recvmsg() inside the kthread's > > main loop, of course! We want it stopped, after all, and if we don't > > make it "break" out of that function, the kthread _will_never_exit_. > > In that case this kthread is buggy. We have sock->sk_rcvtimeo. > > > Please note that this > > whole thing is about functions that will _simply_*never*_exit_ever_ > > _unless_ given a signal. > > ditto. kthread should not do this. Well, I definitely wouldn't call it "buggy" ... skb_recv_datagram() (if with sock->sk_rcvtimeo != MAX_SCHEDULE_TIMEOUT) would then needlessly have to be put into it's own little while(1) (or put a "continue;" after it back to main kthread loop). A question arises, what timeout value to use? (too little => needless wastage of CPU; too high => see below) More importantly, the other thread that does a kthread_stop() on our kthread (probably a umount(2) or rmmod) would then unfortunately hang (on wait_for_completion i.e. TASK_UNINTERRUPTIBLE) for the duration of the time it takes for our kthread to finish it's timeout, which plays havoc with userspace scripts. > OK, I suggest to stop this thread. I don't claim you are wrong, just > we think differently ;) That's fine, we can still "agree to disagree" here :-) Cheers, Satyam - 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/