Re: [swsusp] Rework image freeing

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

 



Hi,

On Thursday, 22 of September 2005 00:53, Rafael J. Wysocki wrote:
> Hi,
> 
> On Wednesday, 21 of September 2005 22:51, Pavel Machek wrote:
> > Do not store pagedirs in swap twice. This needed rewrite of image
> > freeing, but it enabled me nice cleanups in the end.
> > 
> > Signed-off-by: Pavel Machek <[email protected]>
> > 
> > ---
> > commit 67434821951d6f10d55e29465a24e7f5015038f1
> > tree ee0f4a209e8b680ffdfa6e7837a3a248b524f421
> > parent 7bdc8fc378f053bd4eb4210beb1d494485318512
> > author <pavel@amd.(none)> Tue, 20 Sep 2005 15:34:55 +0200
> > committer <pavel@amd.(none)> Tue, 20 Sep 2005 15:34:55 +0200
> > 
> >  kernel/power/swsusp.c |  103 ++++++++++++++++++++++---------------------------
> >  1 files changed, 46 insertions(+), 57 deletions(-)
> > 
> > diff --git a/kernel/power/swsusp.c b/kernel/power/swsusp.c
> > --- a/kernel/power/swsusp.c
> > +++ b/kernel/power/swsusp.c
> > @@ -729,16 +729,6 @@ static void copy_data_pages(void)
> >  	BUG_ON(pbe);
> >  }
> >  
> > -
> > -/**
> > - *	calc_nr - Determine the number of pages needed for a pbe list.
> > - */
> > -
> > -static int calc_nr(int nr_copy)
> > -{
> > -	return nr_copy + (nr_copy+PBES_PER_PAGE-2)/(PBES_PER_PAGE-1);
> > -}
> 
> I can't see why you are going to drop this function.  Isn't it necessary any more?

OK, swsusp fails anyway when it cannot allocate a page, so in fact it is not.
However, the information printed in swsusp_alloc():

>  /**
>   *	enough_free_mem - Make sure we enough free memory to snapshot.
> @@ -914,19 +895,23 @@ static int enough_swap(void)
>  
>  static int swsusp_alloc(void)
>  {
> -	int error;
> +	struct pbe *p;
>  
>  	pagedir_nosave = NULL;
> -	nr_copy_pages = calc_nr(nr_copy_pages);
>  
>  	pr_debug("suspend: (pages needed: %d + %d free: %d)\n",
>  		 nr_copy_pages, PAGES_FOR_IO, nr_free_pages());

now seems to be inaccurate, because we likely need more pages than
 nr_copy_pages + PAGES_FOR_IO.

Greetings,
Rafael


-- 
- Would you tell me, please, which way I ought to go from here?
- That depends a good deal on where you want to get to.
		-- Lewis Carroll "Alice's Adventures in Wonderland"
-
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