mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@osdl.org>
To: David Howells <dhowells@redhat.com>
Cc: akpm@osdl.org, linux-kernel@vger.kernel.org
Subject: Re: fork pagesize patch
Date: Tue, 16 Nov 2004 08:40:53 -0800 (PST)	[thread overview]
Message-ID: <Pine.LNX.4.58.0411160834220.2222@ppc970.osdl.org> (raw)
In-Reply-To: <23880.1100621506@redhat.com>



On Tue, 16 Nov 2004, David Howells wrote:
> 
> > > Please don't do that. What you've done causes a divide-by-zero error to be
> > > emitted by the compiler if PAGE_SIZE > THREAD_SIZE. That's why I used the
> > > preprocessor in the first place.
> > 
> > What kind of broken compiler are _you_ using? Fix your compiler.
> 
> 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;

and the compiler complaining that "a" can be zero. The above is perfectly
reasonable code and may well have a constant zero as part of inlining or
macro expansion. A compiler that does that is being silly. It's being
_especially_ silly since it evaluates to

	if (0)
		..

at compile time in this case. Yeah, yeah, sparse gets it wrong too, but 
only if the left-hand side is zero as well.

But yes, at least the compiler isn't totally buggy if it's just a warning. 
After all, you can warn about anything you like ;)

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? If the thread size is _that_ small that we 
still divide by zero, color me impressed.

		Linus

  reply	other threads:[~2004-11-16 16:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-16 15:38 David Howells
2004-11-16 16:02 ` Linus Torvalds
2004-11-16 16:11 ` David Howells
2004-11-16 16:40   ` Linus Torvalds [this message]
2004-11-16 16:58   ` David Howells
2004-11-16 17:11     ` Linus Torvalds

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.58.0411160834220.2222@ppc970.osdl.org \
    --to=torvalds@osdl.org \
    --cc=akpm@osdl.org \
    --cc=dhowells@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®