Re: [PATCH] swsusp: simpler calculation of number of pages in PBE list

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <[email protected]>

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.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]
  Powered by Linux