lkml.org 
[lkml]   [2000]   [Aug]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Updated Linux 2.4 issues page
On Mon Aug 21, 2000 at 04:22:00PM +0200, Kai Henningsen wrote:
> >
> > + if ( !(mem_total < val.totalram || mem_total < val.totalswap ||
> > + mem_total < val.totalhigh) )
>
> This check doesn't work.
>
> Example: assume val.totalram = val.totalswap = val.totalhigh = 2.5 GB
>
> Then mem_total = 7.5 GB mod 4 GB = 3.5 GB
>
> and 3.5 GB > 2.5 GB.
>
> qed.
>
> (More detail: for a sum of n terms, it breaks (for example) for equal
> terms between max/(n-1) as lower and 2*max/n as upper bound. For n=2, this
> is empty; for n=3, it's between 1/2*max and 2/3*max, for n=4 it'd be
> between 1/3*max and 1/2*max, and so on.)

Sigh. And it seemed like such a good heuristic at the time. I even spent 5
whole minutes trying to find cases that broke it. Missed that one. Oh well.
Guess I'll have to check for overflow the hard way... Patch soon follows,

-Erik

--
Erik B. Andersen email: andersee@debian.org
--This message was written using 73% post-consumer electrons--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 12:37    [W:0.043 / U:0.372 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site