From: Matt Mackall <mpm@selenic.com>
To: Andrew Morton <akpm@osdl.org>
Cc: Rusty Russell <rusty@rustcorp.com.au>,
pavel@ucw.cz, linux-kernel@vger.kernel.org
Subject: Re: More cleanups for swsusp
Date: Wed, 21 Jan 2004 12:39:38 -0600 [thread overview]
Message-ID: <20040121183938.GE14797@waste.org> (raw)
In-Reply-To: <20040120213037.66c9d5a0.akpm@osdl.org>
On Tue, Jan 20, 2004 at 09:30:37PM -0800, Andrew Morton wrote:
> Rusty Russell <rusty@rustcorp.com.au> wrote:
> >
> > In message <20040120225219.GA19190@elf.ucw.cz> you write:
> > > - if (fill_suspend_header(&cur->sh))
> > > - panic("\nOut of memory while writing header");
> > > + BUG_ON (fill_suspend_header(&cur->sh));
> >
> > ...
> > 3) BUG_ON(complex condition expression) is much less clear than:
> >
> > if (complex condition expression)
> > BUG();
Disagree. All BUG_ON() stuff should read like:
/* check that impossible stuff didn't happen, move along, nothing to see */
BUG_ON(...);
Which is fine and good until the condition is actually doing more than
just sanity checking.
> Worse. If some smarty goes and makes BUG_ON a no-op (for space reasons),
> it will break software suspend. We should ensure that the expression which
> is supplied to BUG_ON() never has side-effects for this reason.
While I generally agree that "assertions" shouldn't have side-effects,
a slightly smarter smarty would make sure that BUG_ON evaluated its
condition. I have this in -tiny:
+#ifndef CONFIG_BUG
+#define BUG()
+#define WARN_ON(condition) do { if (condition) ; } while(0)
+#define BUG_ON(condition) do { if (condition) ; } while(0)
+#define PAGE_BUG(page)
+#else
--
Matt Mackall : http://www.selenic.com : Linux development and consulting
next prev parent reply other threads:[~2004-01-21 18:40 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-01-20 22:52 More cleanups for swsusp Pavel Machek
2004-01-20 23:13 ` Andrew Morton
2004-01-20 23:25 ` Pavel Machek
2004-01-21 5:10 ` Rusty Russell
2004-01-22 0:17 ` Pavel Machek
2004-01-21 5:14 ` Rusty Russell
2004-01-21 5:30 ` Andrew Morton
2004-01-21 18:39 ` Matt Mackall [this message]
2004-01-22 2:03 ` Rusty Russell
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=20040121183938.GE14797@waste.org \
--to=mpm@selenic.com \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pavel@ucw.cz \
--cc=rusty@rustcorp.com.au \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.