From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id ; Tue, 24 Jul 2001 12:50:11 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id ; Tue, 24 Jul 2001 12:50:02 -0400 Received: from sncgw.nai.com ([161.69.248.229]:22452 "EHLO mcafee-labs.nai.com") by vger.kernel.org with ESMTP id ; Tue, 24 Jul 2001 12:49:47 -0400 Message-ID: X-Mailer: XFMail 1.4.7 on Linux X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit MIME-Version: 1.0 In-Reply-To: Date: Tue, 24 Jul 2001 09:52:29 -0700 (PDT) From: Davide Libenzi To: Alexander Viro Subject: Re: user-mode port 0.44-2.4.7 Cc: Jonathan Lundell , Jan Hubicka , linux-kernel@vger.kernel.org, user-mode-linux-user@lists.sourceforge.net, Jeff Dike , Andrea Arcangeli , Linus Torvalds Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Original-Recipient: rfc822;linux-kernel-outgoing On 24-Jul-2001 Alexander Viro wrote: > > > On Tue, 24 Jul 2001, Davide Libenzi wrote: > >> I would not call, to pretend the compiler to issue memory loads every time it access >> a variable, a nontrivial way. >> It sounds pretty clear to me. > > You know, one of the nice things about C is that unless you abuse > preprocessor, reading code doesn't require doing far lookups. Most > of it can be read and understood with very little context. "Do it > once when you declare a variable" goes against that and that's > not a good thing. Look, you're not going to request any kind of black magic over that variable. You're simply telling the compiler the way it has to ( not ) optimize the code. This is IMHO a declaration time issue. Looking at this code : while (jiffies < ...) { ... } the "natural" behaviour that a reader expects is that the "content" of the memory pointed by jiffied is loaded and compared. That content, not the content of a register loaded 100 asm instructions before the load. If you like this code more : for (;;) { barrier(); if (jiffies >= ...) break; ... } It's clear that a declaration like : __locked_access__ struct pio { int a, b, c; }; for (;;) { ++a; if (a > b && c < a) ... } sounds a "Bad Thing"(tm) even to me. - Davide