Re: fork pagesize patch

From: David Howells
Date: Tue Nov 16 2004 - 12:00:40 EST



> > Sorry... I meant warning not error. It doesn't actually stop it building a
> > working kernel, but gcc _does_ complain, and not unreasonably, I think.
>
> I think it _is_ unreasonable. It's like doing
>
> if (a)
> x /= a;

Doing it with variables is not exactly the same. The compiler has been told to
optimise arithmetic on constants, and as such it has to represent a div-by-0
result, which obviously it can't.

Now, I agree that given the if-condition automatically precludes the div-by-0,
but maybe that's asking too much. Perhaps I should go and raise hell over it
with the gcc posse.

> Anyway, to make it not warn, why not change it to
>
> max_threads = mempages / (8*THREAD_SIZE/PAGE_SIZE);
>
> instead, and be done with it?

And drop the conditional entirely? I can go along with that.

> If the thread size is _that_ small that we still divide by zero, color me
> impressed.

Not unless you spell colour correctly:-)

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