Re: fork pagesize patch

From: Linus Torvalds
Date: Tue Nov 16 2004 - 12:13:24 EST




On Tue, 16 Nov 2004, David Howells wrote:
> >
> > 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.

But you snipped the part where the above source code _does_ end up being
done on constants - in macro expansion and in inline functions. So the
compiler really _can_ have a constant zero in the divide, and it really
_can_ come from perfectly normal code.

In fact, maybe code like the kernel had.

> > 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.

Right. It looks like the obvious thing to do, and is really what the code
_tried_ to do in the first place.

Linus
-
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/