Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id ; Fri, 8 Feb 2002 11:52:19 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id ; Fri, 8 Feb 2002 11:52:09 -0500 Received: from nrg.org ([216.101.165.106]:59716 "EHLO nrg.org") by vger.kernel.org with ESMTP id ; Fri, 8 Feb 2002 11:51:53 -0500 Date: Fri, 8 Feb 2002 08:51:36 -0800 (PST) From: Nigel Gamble Reply-To: nigel@nrg.org To: Christoph Hellwig cc: Ingo Molnar , yodaiken , Martin Wirth , linux-kernel , akpm , torvalds , rml Subject: Re: [RFC] New locking primitive for 2.5 In-Reply-To: <200202081231.g18CV7e31341@ns.caldera.de> Message-ID: 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 On Fri, 8 Feb 2002, Christoph Hellwig wrote: > In article you wrote: > > i think one example *could* be to turn inode->i_sem into a combi-lock. Eg. > > generic_file_llseek() could use the spin variant. > > No. i_sem should be split into a spinlock for short-time accessed > fields that get written to even if the file content is only read (i.e. > atime) and a read-write semaphore. Read-write semaphores should never be used. As others have pointed out, they cause really intractable priority inversion problems (because a high priority writer will often have to wait for an unbounded number of lower priority readers, some of which may have called a blocking function while holding the read lock). Note that I'm not talking about read-write spinlocks, which are (or should be) held for a short, bounded time and can't be held over a blocking call, so they are not quite so problematic. Nigel Gamble nigel@nrg.org Mountain View, CA, USA. http://www.nrg.org/ - 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/