Re: [swsusp] Rework image freeing
From: Dave Hansen (haveblue_at_us.ibm.com)
Date: 09/21/05
- Previous message: Al Viro: "Re: dentry_cache using up all my zone normal memory -- also seen on 2.6.14-rc2"
- In reply to: Pavel Machek: "[swsusp] Rework image freeing"
- Next in thread: Pavel Machek: "Re: [swsusp] Rework image freeing"
- Reply: Pavel Machek: "Re: [swsusp] Rework image freeing"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
To: Pavel Machek <pavel@ucw.cz> Date: Wed, 21 Sep 2005 14:18:02 -0700
On Wed, 2005-09-21 at 22:51 +0200, Pavel Machek wrote:
> +static long alloc_image_page(void)
> +{
> + long res = get_zeroed_page(GFP_ATOMIC | __GFP_COLD);
> + if (res) {
> + SetPageNosave(virt_to_page(res));
> + SetPageNosaveFree(virt_to_page(res));
> + }
> + return res;
> +}
Please avoid using longs here. "res" really is a virtual address, and
it would be polite to keep it in a pointer of some kind. Returning
void* would also avoid the two casts in alloc_pagedir(). The same
probably goes for pbe->address and pbe->orig_address.
BTW, I think get_zeroed_page() returns a long to keep people from
confusing it with the allocator routines that return actual 'struct page
*', and not the page's virtual address. So, you really should be
casting them to real pointers as soon as it comes back from
get_zeroed_page() and cousins.
-- Dave
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
- Previous message: Al Viro: "Re: dentry_cache using up all my zone normal memory -- also seen on 2.6.14-rc2"
- In reply to: Pavel Machek: "[swsusp] Rework image freeing"
- Next in thread: Pavel Machek: "Re: [swsusp] Rework image freeing"
- Reply: Pavel Machek: "Re: [swsusp] Rework image freeing"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|