lkml.org 
[lkml]   [2004]   [Aug]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [6/25] Merge pmdisk and swsusp


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@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 14:04    [W:1.234 / U:0.036 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site