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

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

 



Hi!

> +	//p->pageset_size = pageset_size;

Please don't leave commented code in.

> +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?

> +#define pageset1_size (pagedir1.pageset_size)
> +#define pageset2_size (pagedir2.pageset_size)

This only makes reading code harder...

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