mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@ucw.cz>
To: Patrick Mochel <mochel@digitalimplant.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [6/25] Merge pmdisk and swsusp
Date: Mon, 19 Jul 2004 00:13:02 +0200	[thread overview]
Message-ID: <20040718221302.GC31958@atrey.karlin.mff.cuni.cz> (raw)
In-Reply-To: <Pine.LNX.4.50.0407171528280.22290-100000@monsoon.he.net>

Hi!

> - Move helpers calc_order(), alloc_pagedir(), alloc_image_pages(),
>   enough_free_mem(), and enough_swap() into swsusp.


> +/**
> + *	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;
> +}

> +	if (!enough_free_mem())
> +		return -ENOMEM;
> +
> +	if (!enough_swap())
> +		return -ENOSPC;
> +
> +	if ((error = alloc_pagedir())) {
> +		pr_debug("suspend: Allocating pagedir failed.\n");
> +		return error;
> +	}

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

-- 
Horseback riding is like software...
...vgf orggre jura vgf serr.

  parent reply	other threads:[~2004-07-18 22:13 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 [this message]
2004-08-02  3:22   ` Patrick Mochel
2004-08-06 19:36     ` Pavel Machek

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=20040718221302.GC31958@atrey.karlin.mff.cuni.cz \
    --to=pavel@ucw.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®