Re: [PATCH] sched/fair: Use 'unsigned long' for group_shares,group_runnable

2019-04-15 Thread chengjian (D)
On 2019/4/15 23:25, Peter Zijlstra wrote: On Mon, Apr 15, 2019 at 11:20:31PM +0800, chengjian (D) wrote: Hi, Peter On 2019/4/15 20:46, Peter Zijlstra wrote: I write a demo about this, which I described it as overflow. I'm not saying there's no overflow, I'm saying there's nothing UB about

Re: [PATCH] sched/fair: Use 'unsigned long' for group_shares,group_runnable

2019-04-15 Thread Peter Zijlstra
On Mon, Apr 15, 2019 at 11:20:31PM +0800, chengjian (D) wrote: > Hi, Peter > > > On 2019/4/15 20:46, Peter Zijlstra wrote: > > I write a demo about this, which I described it as overflow. I'm not saying there's no overflow, I'm saying there's nothing UB about it.

Re: [PATCH] sched/fair: Use 'unsigned long' for group_shares,group_runnable

2019-04-15 Thread chengjian (D)
Hi, Peter On 2019/4/15 20:46, Peter Zijlstra wrote: I write a demo about this, which I described it as overflow. #cat test.c //test.c #include #include #include #include int main(void) {     long a = 1048576 * 9144968455305; /* shares = tg_shares * load */     unsigned long b = a;     //

Re: [PATCH] sched/fair: Use 'unsigned long' for group_shares,group_runnable

2019-04-15 Thread Peter Zijlstra
On Sat, Apr 13, 2019 at 03:32:34AM +, Cheng Jian wrote: > group_share and group_runnable are tracked as 'unsigned long', > however some functions using them as 'long' which is ultimately > assigned back to 'unsigned long' variables in reweight_entity. > > Since there is not scope on using a di

[PATCH] sched/fair: Use 'unsigned long' for group_shares,group_runnable

2019-04-12 Thread Cheng Jian
group_share and group_runnable are tracked as 'unsigned long', however some functions using them as 'long' which is ultimately assigned back to 'unsigned long' variables in reweight_entity. Since there is not scope on using a different and signed type, this change improves code consistency and avo