Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965927AbXEKXaA (ORCPT ); Fri, 11 May 2007 19:30:00 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1756374AbXEKX3x (ORCPT ); Fri, 11 May 2007 19:29:53 -0400 Received: from smtp1.linux-foundation.org ([65.172.181.25]:40044 "EHLO smtp1.linux-foundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756123AbXEKX3w (ORCPT ); Fri, 11 May 2007 19:29:52 -0400 Date: Fri, 11 May 2007 16:29:03 -0700 (PDT) From: Linus Torvalds To: "Rafael J. Wysocki" cc: Andrew Morton , Gautham R Shenoy , LKML , Oleg Nesterov , Pavel Machek , "Eric W. Biederman" Subject: Re: [PATCH 1/7] Freezer: Read PF_BORROWED_MM in a nonracy way In-Reply-To: <200705120122.07177.rjw@sisk.pl> Message-ID: References: <200705110035.32229.rjw@sisk.pl> <200705112240.54304.rjw@sisk.pl> <200705120122.07177.rjw@sisk.pl> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=us-ascii Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1203 Lines: 28 On Sat, 12 May 2007, Rafael J. Wysocki wrote: > > We use this function (ie. kernel/power/process.c:is_user_space()) to > distinguish kernel threads from user space processes. Therefore we make it > always return true for user space processes and always return false for kernel > threads. In the latter case we need to use the task_lock() to ensure that the > result is as desired (ie. false), because otherwise it might be racing with > either fs/aio.c:use_mm() or fs/aio.c:unuse_mm(). But there is no race protection in the *caller*, so if it can ever return one or the other, what protects it from changing once the caller returns? And if the value can change (because some thread uses "use_mm()"), then the caller cannot rely on the value that got returned. So you migt as well not return any value at all, since the returned value is apparently meaningless once the lock has been released. In other words: "The lock, it does nothing". Linus - 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/