[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Tue, 7 Jul 2015 09:18:36 +0000
From: "Gaohaifeng (A)" <gaohaifeng.gao@...wei.com>
To: Peter Zijlstra <peterz@...radead.org>
CC: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"stephan.baerwolf@...ilmenau.de" <stephan.baerwolf@...ilmenau.de>,
"Huangjian (J)" <huangjian.huangjian@...wei.com>
Subject: RE: sched: about vruntime overflow
Much Thanks!
On Tue, Jul 07, 2015 at 08:05:50AM +0000, Gaohaifeng (A) wrote:
> int main()
> {
> unsigned char a,b;
> a=251;
> b=254;
> b +=5; // b will overflow
> printf("a=%u \n",a);
> printf("b=%u \n",b);
> printf("(a-b<0)=%d\n",(a-b)<0);
If you look at entity_before() you'll notice that the correct statement would be:
printf("(a-b<0)=%d\n",(signed char)(a-b)<0);
> printf("(a-b<0)=%d\n",((unsigned char)(a-250)-(unsigned char)(b-250)<0));
> return 0;
> }
--
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