Re: [RFC][PATCH] swsusp: do not use higher order allocations on resume [update 2]

From: Rafael J. Wysocki
Date: Tue Feb 08 2005 - 17:28:37 EST


On Tuesday, 8 of February 2005 20:10, Pavel Machek wrote:
> Hi!
>
> > > so it is okay, but...
> >
> > ... I could have done it more elegantly. You're right, I've now introduced
> > a function eat_page() that adds a page to the list of unusable pages and
> > used it instead of the free_page() here.
>
> Thanks.
>
> > > > + p = pbe;
> > > > + pbe += PB_PAGE_SKIP;
> > > > + do
> > > > + p->next = p + 1;
> > > > + while (p++ < pbe);
> > >
> > > I've already seen this code somewhere around in different
> > > variant... Perhaps you want to make it inline function?
> >
> > I tried to avoid modifying the suspend part, but if it's not a problem,
> > why don't we go farther and reuse alloc_pagedir() in the resume code?
> >
> > It has the advantage that read_pagedir() is then much simpler, and it
> > returns an integer. However, for this purpose, it's better to split
> > alloc_pagedir() into two functions, one of which allocates memory pages,
> > and the second puts the list structure on them.
>
> I guess that modifying suspend part is okay. We do not want to have
> two copies of similar code...
>
> > > > + if(!(pagedir_nosave = swsusp_pagedir_relocate(p)))
> > > > + return -ENOMEM;
> > >
> > > Same here.
> >
> > The value is used in error reporting and the only reason why this function
> > may fail is the lack of memory (the same applies to alloc_pagedir()).
> >
> > The revised (not as thoroughly tested as the previous one, but hopefully
> > nicer) patch follows.
>
> I guess I'll wait for "reuse alloc_pagedir" version.

It's this one. :-)

Greets,
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 majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/