Re: [PATCH] writeback: prevent bandwidth calculation overflow

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Nov 19, 2010 at 12:06:52AM +0800, Wu Fengguang wrote:
> On Fri, Nov 19, 2010 at 12:02:01AM +0800, Peter Zijlstra wrote:
> > On Thu, 2010-11-18 at 23:44 +0800, Wu Fengguang wrote:
> > > +               pause = HZ * pages_dirtied / (bw + 1);
> > 
> > Shouldn't that be using something like div64_u64 ?
> 
> OK, but a dumb question: gcc cannot handle this implicitly?

Hmm, I'm tempting to do

        pause = HZ * pages_dirtied / ((unsigned long)bw + 1);

because here "bw" is guaranteed to be smaller than ULONG_MAX.

Thanks,
Fengguang

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxxx  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]