Re: [PATCH] micro-opt DEBUG_ADD_PAGE

2001-02-08 Thread Richard B. Johnson
On Thu, 8 Feb 2001, Stephen Wille Padnos wrote: > "Richard B. Johnson" wrote: > > > > On Thu, 8 Feb 2001, Stephen Wille Padnos wrote: > > > > > "Richard B. Johnson" wrote: > > > [snip] > > > > Another problem with 'volatile' has to do with pointers. When > > > > it's possible for some object

Re: [PATCH] micro-opt DEBUG_ADD_PAGE

2001-02-08 Thread Stephen Wille Padnos
"Richard B. Johnson" wrote: > > On Thu, 8 Feb 2001, Stephen Wille Padnos wrote: > > > "Richard B. Johnson" wrote: > > [snip] > > > Another problem with 'volatile' has to do with pointers. When > > > it's possible for some object to be modified by some external > > > influence, we see: > > > > >

Re: [PATCH] micro-opt DEBUG_ADD_PAGE

2001-02-08 Thread Richard B. Johnson
On Thu, 8 Feb 2001, Stephen Wille Padnos wrote: > "Richard B. Johnson" wrote: > [snip] > > Another problem with 'volatile' has to do with pointers. When > > it's possible for some object to be modified by some external > > influence, we see: > > > > volatile struct whatever *ptr; > > >

Re: [PATCH] micro-opt DEBUG_ADD_PAGE

2001-02-08 Thread Stephen Wille Padnos
"Richard B. Johnson" wrote: [snip] > Another problem with 'volatile' has to do with pointers. When > it's possible for some object to be modified by some external > influence, we see: > > volatile struct whatever *ptr; > > Now, it's unclear if gcc knows that we don't give a damn about >

Re: [PATCH] micro-opt DEBUG_ADD_PAGE

2001-02-08 Thread Richard B. Johnson
On Thu, 8 Feb 2001, Hugh Dickins wrote: > On Wed, 7 Feb 2001, Linus Torvalds wrote: > > On Wed, 7 Feb 2001, Hugh Dickins wrote: > > > > > > None of those optimizes this: I believe the semantics of "||" (don't > > > try next test if first succeeds) forbid the optimization "|" gives? > > > > No.

Re: [PATCH] micro-opt DEBUG_ADD_PAGE

2001-02-08 Thread Rik van Riel
On Thu, 8 Feb 2001, Hugh Dickins wrote: > On Thu, 8 Feb 2001, David Weinehall wrote: > > > > Well, after all, it's debugging code, and the code now is easy to read. > > Your code, while more efficient, isn't. I think that clarity takes > > priority over efficiency in non-critical code such as

Re: [PATCH] micro-opt DEBUG_ADD_PAGE

2001-02-08 Thread Hugh Dickins
On Thu, 8 Feb 2001, David Weinehall wrote: > > Well, after all, it's debugging code, and the code now is easy to read. > Your code, while more efficient, isn't. I think that clarity takes > priority over efficiency in non-critical code such as debugging > code. Of course, this is my personal

Re: [PATCH] micro-opt DEBUG_ADD_PAGE

2001-02-08 Thread David Weinehall
On Thu, Feb 08, 2001 at 04:24:23PM +, Hugh Dickins wrote: > On Wed, 7 Feb 2001, Linus Torvalds wrote: > > On Wed, 7 Feb 2001, Hugh Dickins wrote: > > > > > > None of those optimizes this: I believe the semantics of "||" (don't > > > try next test if first succeeds) forbid the optimization

Re: [PATCH] micro-opt DEBUG_ADD_PAGE

2001-02-08 Thread Hugh Dickins
On Wed, 7 Feb 2001, Linus Torvalds wrote: > On Wed, 7 Feb 2001, Hugh Dickins wrote: > > > > None of those optimizes this: I believe the semantics of "||" (don't > > try next test if first succeeds) forbid the optimization "|" gives? > > No. The optimization is entirely legal - but the fact that

Re: [PATCH] micro-opt DEBUG_ADD_PAGE

2001-02-08 Thread Hugh Dickins
On Wed, 7 Feb 2001, Linus Torvalds wrote: On Wed, 7 Feb 2001, Hugh Dickins wrote: None of those optimizes this: I believe the semantics of "||" (don't try next test if first succeeds) forbid the optimization "|" gives? No. The optimization is entirely legal - but the fact that

Re: [PATCH] micro-opt DEBUG_ADD_PAGE

2001-02-08 Thread David Weinehall
On Thu, Feb 08, 2001 at 04:24:23PM +, Hugh Dickins wrote: On Wed, 7 Feb 2001, Linus Torvalds wrote: On Wed, 7 Feb 2001, Hugh Dickins wrote: None of those optimizes this: I believe the semantics of "||" (don't try next test if first succeeds) forbid the optimization "|" gives?

Re: [PATCH] micro-opt DEBUG_ADD_PAGE

2001-02-08 Thread Hugh Dickins
On Thu, 8 Feb 2001, David Weinehall wrote: Well, after all, it's debugging code, and the code now is easy to read. Your code, while more efficient, isn't. I think that clarity takes priority over efficiency in non-critical code such as debugging code. Of course, this is my personal

Re: [PATCH] micro-opt DEBUG_ADD_PAGE

2001-02-08 Thread Rik van Riel
On Thu, 8 Feb 2001, Hugh Dickins wrote: On Thu, 8 Feb 2001, David Weinehall wrote: Well, after all, it's debugging code, and the code now is easy to read. Your code, while more efficient, isn't. I think that clarity takes priority over efficiency in non-critical code such as debugging

Re: [PATCH] micro-opt DEBUG_ADD_PAGE

2001-02-08 Thread Richard B. Johnson
On Thu, 8 Feb 2001, Hugh Dickins wrote: On Wed, 7 Feb 2001, Linus Torvalds wrote: On Wed, 7 Feb 2001, Hugh Dickins wrote: None of those optimizes this: I believe the semantics of "||" (don't try next test if first succeeds) forbid the optimization "|" gives? No. The

Re: [PATCH] micro-opt DEBUG_ADD_PAGE

2001-02-08 Thread Stephen Wille Padnos
"Richard B. Johnson" wrote: [snip] Another problem with 'volatile' has to do with pointers. When it's possible for some object to be modified by some external influence, we see: volatile struct whatever *ptr; Now, it's unclear if gcc knows that we don't give a damn about the

Re: [PATCH] micro-opt DEBUG_ADD_PAGE

2001-02-08 Thread Richard B. Johnson
On Thu, 8 Feb 2001, Stephen Wille Padnos wrote: "Richard B. Johnson" wrote: [snip] Another problem with 'volatile' has to do with pointers. When it's possible for some object to be modified by some external influence, we see: volatile struct whatever *ptr; Now, it's

Re: [PATCH] micro-opt DEBUG_ADD_PAGE

2001-02-08 Thread Stephen Wille Padnos
"Richard B. Johnson" wrote: On Thu, 8 Feb 2001, Stephen Wille Padnos wrote: "Richard B. Johnson" wrote: [snip] Another problem with 'volatile' has to do with pointers. When it's possible for some object to be modified by some external influence, we see: volatile

Re: [PATCH] micro-opt DEBUG_ADD_PAGE

2001-02-08 Thread Richard B. Johnson
On Thu, 8 Feb 2001, Stephen Wille Padnos wrote: "Richard B. Johnson" wrote: On Thu, 8 Feb 2001, Stephen Wille Padnos wrote: "Richard B. Johnson" wrote: [snip] Another problem with 'volatile' has to do with pointers. When it's possible for some object to be modified by some

Re: [PATCH] micro-opt DEBUG_ADD_PAGE

2001-02-07 Thread Kai Germaschewski
On Wed, 7 Feb 2001, Linus Torvalds wrote: > No. The optimization is entirely legal - but the fact that > "constant_test_bit()" uses a "volatile unsigned int *" is the reason why > gcc thinks it can't optimize it. This thing did attract me somewhat and I decided to learn a little about

Re: [PATCH] micro-opt DEBUG_ADD_PAGE

2001-02-07 Thread Linus Torvalds
On Wed, 7 Feb 2001, Hugh Dickins wrote: > > The "(1< activate_page_nolock() compiled -O2 -march=i686 with egcs-2.91.66 (RH7.0 > kgcc), gcc-2.96-69 (RH7.0 gcc+fixes), gcc-2.97 (gcc-snapshot-20010207-1). > > None of those optimizes this: I believe the semantics of "||" (don't > try next test if

Re: [PATCH] micro-opt DEBUG_ADD_PAGE

2001-02-07 Thread Hugh Dickins
On Wed, 7 Feb 2001, Linus Torvalds wrote: > > I'd rather not do these kinds of things that the compiler should be able > to trivially do for us. > > (gcc sometimes _does_ do these things. I've seen it. Why doesn't it do it > here? Did you check the code? Have you asked the gcc lists?) The "(1<

Re: [PATCH] micro-opt DEBUG_ADD_PAGE

2001-02-07 Thread Linus Torvalds
On Wed, 7 Feb 2001, Hugh Dickins wrote: > > Micro-optimization season? I'd rather not do these kinds of things that the compiler should be able to trivially do for us. (gcc sometimes _does_ do these things. I've seen it. Why doesn't it do it here? Did you check the code? Have you asked the

[PATCH] micro-opt DEBUG_ADD_PAGE

2001-02-07 Thread Hugh Dickins
On Tue, 6 Feb 2001, Linus Torvalds wrote: > > - if (bh->b_size % correct_size) { > > + if (bh->b_size != correct_size) { > > Actually, I'd rather leave it in, but speed it up with the saner and > fasterif (bh->b_size & (correct_size-1)) { Micro-optimization season?

[PATCH] micro-opt DEBUG_ADD_PAGE

2001-02-07 Thread Hugh Dickins
On Tue, 6 Feb 2001, Linus Torvalds wrote: - if (bh-b_size % correct_size) { + if (bh-b_size != correct_size) { Actually, I'd rather leave it in, but speed it up with the saner and fasterif (bh-b_size (correct_size-1)) { Micro-optimization season? ---

Re: [PATCH] micro-opt DEBUG_ADD_PAGE

2001-02-07 Thread Linus Torvalds
On Wed, 7 Feb 2001, Hugh Dickins wrote: Micro-optimization season? I'd rather not do these kinds of things that the compiler should be able to trivially do for us. (gcc sometimes _does_ do these things. I've seen it. Why doesn't it do it here? Did you check the code? Have you asked the gcc

Re: [PATCH] micro-opt DEBUG_ADD_PAGE

2001-02-07 Thread Hugh Dickins
On Wed, 7 Feb 2001, Linus Torvalds wrote: I'd rather not do these kinds of things that the compiler should be able to trivially do for us. (gcc sometimes _does_ do these things. I've seen it. Why doesn't it do it here? Did you check the code? Have you asked the gcc lists?) The

Re: [PATCH] micro-opt DEBUG_ADD_PAGE

2001-02-07 Thread Linus Torvalds
On Wed, 7 Feb 2001, Hugh Dickins wrote: The "(1PG_bitshift)" part of it is done, sure; but I've rechecked activate_page_nolock() compiled -O2 -march=i686 with egcs-2.91.66 (RH7.0 kgcc), gcc-2.96-69 (RH7.0 gcc+fixes), gcc-2.97 (gcc-snapshot-20010207-1). None of those optimizes this: I