mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@suse.cz>
To: Patrick Mochel <mochel@digitalimplant.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [6/25] Merge pmdisk and swsusp
Date: Fri, 6 Aug 2004 21:36:27 +0200	[thread overview]
Message-ID: <20040806193627.GJ3048@elf.ucw.cz> (raw)
In-Reply-To: <Pine.LNX.4.50.0408012020200.30101-100000@monsoon.he.net>

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!

      reply	other threads:[~2004-08-06 19:39 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-17 22:34 Patrick Mochel
2004-07-18 22:09 ` Pavel Machek
2004-08-02  3:19   ` Patrick Mochel
2004-08-02  5:04     ` Mika Penttilä
2004-08-02  5:10       ` Patrick Mochel
2004-08-02  6:03         ` Mika Penttilä
2004-08-06 19:26     ` Pavel Machek
2004-07-18 22:13 ` Pavel Machek
2004-08-02  3:22   ` Patrick Mochel
2004-08-06 19:36     ` Pavel Machek [this message]

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=20040806193627.GJ3048@elf.ucw.cz \
    --to=pavel@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mochel@digitalimplant.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®