[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150523092336.GA1930@opentech.at>
Date: Sat, 23 May 2015 11:23:36 +0200
From: Nicholas Mc Guire <der.herr@...r.at>
To: Oleg Nesterov <oleg@...hat.com>
Cc: Peter Zijlstra <peterz@...radead.org>,
Nicholas Mc Guire <hofrat@...dl.org>,
Ingo Molnar <mingo@...hat.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] locking: type cleanup when accessing fast_read_ctr
On Wed, 20 May 2015, Oleg Nesterov wrote:
> On 05/19, Nicholas Mc Guire wrote:
> >
> > I assumed it would not matter but did not see a simple way of getting it
> > type clean with unsigned either mainly due to the atomic_t being int and
> > val in update_fast_ctr() being passed as -1.
>
> Perhaps clear_fast_ctr() should have a comment to explain why it returns
> "int"... even if "unsigned" should work too.
>
Might not be into c99 standard far enough but from reviewing 6.5/J.2
I do not see this argument here.
The "well defined modulo 2**n" behavior for unsigned int can be
found stated in a few places - but not in the c99 standard for
arithmetic overflow.
The "well defined overflow behavior" as far as I understand c99,
*only* applies to left shift operations when overflowing - see 6.5.7 "
Bitwise shift operators" -> Semantics -> 4) - further for the counter
problem this well defined behavior is of little help as the sum would
be wrong in both cases.
I still do not see the point in the implicit/automatic type conversion
here and why that should be an advantage - could somone point me to
the right c99 clauses ?
thx!
hofrat
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists