All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@ucw.cz>
To: Michal Schmidt <xschmi00@stud.feec.vutbr.cz>
Cc: linux-pm@lists.osdl.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] swsusp: simpler calculation of number of pages in PBE list
Date: Sat, 30 Jul 2005 15:20:15 +0200	[thread overview]
Message-ID: <20050730132015.GF1830@elf.ucw.cz> (raw)
In-Reply-To: <42EA87A0.908@stud.feec.vutbr.cz>

On Pá 29-07-05 21:46:40, Michal Schmidt wrote:
> The function calc_nr uses an iterative algorithm to calculate the number 
> of pages needed for the image and the pagedir. Exactly the same result 
> can be obtained with a one-line expression.
> 
> Signed-off-by: Michal Schmidt <xschmi00@stud.feec.vutbr.cz>

Thanks, applied.

> diff -Nurp -X dontdiff.new linux-mm/kernel/power/swsusp.c linux-mm.mich/kernel/power/swsusp.c
> --- linux-mm/kernel/power/swsusp.c	2005-07-28 13:57:53.000000000 +0200
> +++ linux-mm.mich/kernel/power/swsusp.c	2005-07-29 21:01:46.000000000 +0200
> @@ -737,18 +737,7 @@ static void copy_data_pages(void)
>  
>  static int calc_nr(int nr_copy)
>  {
> -	int extra = 0;
> -	int mod = !!(nr_copy % PBES_PER_PAGE);
> -	int diff = (nr_copy / PBES_PER_PAGE) + mod;
> -
> -	do {
> -		extra += diff;
> -		nr_copy += diff;
> -		mod = !!(nr_copy % PBES_PER_PAGE);
> -		diff = (nr_copy / PBES_PER_PAGE) + mod - extra;
> -	} while (diff > 0);
> -
> -	return nr_copy;
> +	return nr_copy + (nr_copy+PBES_PER_PAGE-2)/(PBES_PER_PAGE-1);
>  }
>  
>  /**


-- 
teflon -- maybe it is a trademark, but it should not be.

WARNING: multiple messages have this Message-ID (diff)
From: Pavel Machek <pavel@ucw.cz>
To: Michal Schmidt <xschmi00@stud.feec.vutbr.cz>
Cc: linux-kernel@vger.kernel.org, linux-pm@lists.osdl.org
Subject: Re: [PATCH] swsusp: simpler calculation of number of pages in PBE list
Date: Sat, 30 Jul 2005 15:20:15 +0200	[thread overview]
Message-ID: <20050730132015.GF1830@elf.ucw.cz> (raw)
In-Reply-To: <42EA87A0.908@stud.feec.vutbr.cz>

On Pá 29-07-05 21:46:40, Michal Schmidt wrote:
> The function calc_nr uses an iterative algorithm to calculate the number 
> of pages needed for the image and the pagedir. Exactly the same result 
> can be obtained with a one-line expression.
> 
> Signed-off-by: Michal Schmidt <xschmi00@stud.feec.vutbr.cz>

Thanks, applied.

> diff -Nurp -X dontdiff.new linux-mm/kernel/power/swsusp.c linux-mm.mich/kernel/power/swsusp.c
> --- linux-mm/kernel/power/swsusp.c	2005-07-28 13:57:53.000000000 +0200
> +++ linux-mm.mich/kernel/power/swsusp.c	2005-07-29 21:01:46.000000000 +0200
> @@ -737,18 +737,7 @@ static void copy_data_pages(void)
>  
>  static int calc_nr(int nr_copy)
>  {
> -	int extra = 0;
> -	int mod = !!(nr_copy % PBES_PER_PAGE);
> -	int diff = (nr_copy / PBES_PER_PAGE) + mod;
> -
> -	do {
> -		extra += diff;
> -		nr_copy += diff;
> -		mod = !!(nr_copy % PBES_PER_PAGE);
> -		diff = (nr_copy / PBES_PER_PAGE) + mod - extra;
> -	} while (diff > 0);
> -
> -	return nr_copy;
> +	return nr_copy + (nr_copy+PBES_PER_PAGE-2)/(PBES_PER_PAGE-1);
>  }
>  
>  /**


-- 
teflon -- maybe it is a trademark, but it should not be.

  parent reply	other threads:[~2005-07-30 13:20 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-29 19:46 [PATCH] swsusp: simpler calculation of number of pages in PBE list Michal Schmidt
2005-07-29 19:46 ` Michal Schmidt
2005-07-29 20:43 ` Rafael J. Wysocki
2005-07-29 20:43   ` [linux-pm] " Rafael J. Wysocki
2005-07-29 21:14   ` Michal Schmidt
2005-07-29 21:14     ` [linux-pm] " Michal Schmidt
2005-07-29 21:53     ` Rafael J. Wysocki
2005-07-29 21:53       ` [linux-pm] " Rafael J. Wysocki
2005-07-30  1:35     ` Alan Stern
2005-07-30  1:35       ` [linux-pm] " Alan Stern
2005-07-30 13:16       ` Rafael J. Wysocki
2005-07-30 13:16         ` [linux-pm] " Rafael J. Wysocki
2005-07-30 13:13         ` Pavel Machek
2005-07-30 13:13           ` [linux-pm] " Pavel Machek
2005-07-30 13:32           ` Rafael J. Wysocki
2005-07-30 13:32             ` [linux-pm] " Rafael J. Wysocki
2005-07-30 14:37             ` Alan Stern
2005-07-30 14:37               ` [linux-pm] " Alan Stern
2005-07-30 13:20 ` Pavel Machek [this message]
2005-07-30 13:20   ` Pavel Machek
  -- strict thread matches above, loose matches on Subject: below --
2005-07-30 13:33 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=20050730132015.GF1830@elf.ucw.cz \
    --to=pavel@ucw.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@lists.osdl.org \
    --cc=xschmi00@stud.feec.vutbr.cz \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.