Re: [6/25] Merge pmdisk and swsusp

From: Pavel Machek
Date: Fri Aug 06 2004 - 14:58:17 EST


Hi!

> > > +/**
> > > + * 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..

Hmm, it would probably need to be called check_free_mem...

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

I do not think this is doable. ... ... ..

Yes, it probably is doable. We should mark ourselves as some kind of
"memory cleaning thread" so we get errors instead of deadlock when we
run out of memory while writing pages, and then we just need to handle
that errors, carefully. Ok.
Pavel
--
People were complaining that M$ turns users into beta-testers...
...jr ghea gurz vagb qrirybcref, naq gurl frrz gb yvxr vg gung jnl!
-
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/