Re: user-mode port 0.44-2.4.7

Davide Libenzi (davidel@xmailserver.org)
Tue, 24 Jul 2001 09:52:29 -0700 (PDT)


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

-
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/