Re: [6/25] Merge pmdisk and swsusp

From: Patrick Mochel
Date: Sun Aug 01 2004 - 22:23:47 EST




On Mon, 19 Jul 2004, Pavel Machek wrote:

> > +/**
> > + * enough_free_mem - Make sure we enough free memory to snapshot.
> > + *
> > + * Returns TRUE or FALSE after checking the number of available
> > + * free pages.
> > + */
> > +
> > +static int enough_free_mem(void)
> > +{
> > + if(nr_free_pages() < (nr_copy_pages + PAGES_FOR_IO)) {
> > + pr_debug("pmdisk: Not enough free pages: Have %d\n",
> > + nr_free_pages());
> > + return 0;
> > + }
> > + return 1;
> > +}

> Perhaps enough_free_* should return 0 / -ERROR to keep it consistent
> with rest of code, no need to explain TRUE/FALSE etc?

Well, then they wouldn't read like plain language..

Besides, they're superfluous and racy anyway - the amount of memory and
swap space free could change at any time, so we should just remove them
and make sure our error handlin is correct later down the line when
allocations fail..


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