Re: [PATCH] Re: Linux 2.2.14pre16

tenthumbs@cybernex.net
Fri, 24 Dec 1999 13:59:40 GMT


On Wed, 22 Dec 1999 14:46:29 +0100 (CET), you wrote:

> Just remove this check, because it is uncessary, or try this one
> instead
>
> if (freed < mm->rss)
> mm->rss-=freed
> else
> mm->rss=0;
>
> Which would be the correct (saturation) behavior for this
> substraction.
>

I just chose the simplest change. Your version is more logical. If it doesn't
affect performance it makes little difference.

>
> Unnecessary. The below line would be sufficient, because there is
> no underflow in unsigned values, that is below 0 but is often
> above the maximum value set (size in this case).
>
> + if (offset > size) {
>
> That's why I prefer to use unsigned values whereever I can BTW,
> because I can omit one bound check ;)
>
> > printk("%sOffset weird %d - %s\n", func_nm, (int) offset, name);
> > offset = 0;
> > }
>
> Regards
>
> Ingo Oeser

The test here is just asking if there has been any wraparound in the
calculations. It's similar to what is happening in the first patch _but_ here
offset is a parameter not a calculated value so it is much harder to for the
function to know what to do. Either you have to check all this function's
callers to see if offset is properly calculated or you make this test work and
see if anything happens. I think the second way is much easier. :-)

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/