Re: [PATCH] [35/48] Suspend2 2.1.9.8 for 2.6.12: 611-io.patch

From: Nigel Cunningham
Date: Tue Jul 12 2005 - 03:44:41 EST


Hi.

On Mon, 2005-07-11 at 04:12, Pavel Machek wrote:
> Hi!
>
> > + //p->pageset_size = pageset_size;
>
> Please don't leave commented code in.

Fixed.

> > +unsigned long suspend2_get_nonconflicting_pages(const int order)
> > +{
> > + struct page * page;
> > + unsigned long new_page;
> > + int more = 0;
> > + unsigned long pgcount;
> > +
> > + do {
> > + new_page = __get_free_pages(GFP_ATOMIC | __GFP_NOWARN, order);
> > + if (!new_page)
> > + return 0;
> > + more = 0;
> > + for (pgcount = 0; pgcount < (1UL << order); pgcount++) {
> > + page = virt_to_page(new_page + PAGE_SIZE * pgcount);
> > + if (PagePageset1(page)) {
> > + more = 1;
> > + break;
> > + }
> > + }
> > + if (more) {
> > + page = virt_to_page(new_page);
> > + list_add(&page->lru, &conflicting_pages);
> > +
> > + /* since this page is technically free, we can abuse it to
> > + * store the order. When we resume it'll just be overwritten,
> > + * but we need this value when freeing it in
> > + * suspend2_release_conflicting_pages. */
> > + *((int*)new_page) = order;
> > + }
> > + }
> > + while (more);
> > +
> > + memset((void*)new_page, 0, PAGE_SIZE * (1<<order));
> > + return new_page;
> > +}
> > +
> > +/* suspend2_get_nonconflicting_page
> > + *
> > + * Description: Gets a page that will not be overwritten as we copy the
> > + * original kernel page.
> > + */
> > +
> > +unsigned long suspend2_get_nonconflicting_page(void)
> > +{
> > + return suspend2_get_nonconflicting_pages(0);
> > +}
>
> Can you just replace it in callers?

Done.

> > +#define pageset1_size (pagedir1.pageset_size)
> > +#define pageset2_size (pagedir2.pageset_size)
>
> This only makes reading code harder...

Removed.

Regards,

Nigel
--
Evolution.
Enumerate the requirements.
Consider the interdependencies.
Calculate the probabilities.
Be amazed that people believe it happened.

-
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/