Re: [swsusp] Rework image freeing

From: Dave Hansen (haveblue_at_us.ibm.com)
Date: 09/21/05

  • Next message: Pavel Machek: "Re: [swsusp] Rework image freeing"
    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/


  • Next message: Pavel Machek: "Re: [swsusp] Rework image freeing"

    Relevant Pages

    • Re: [patch 12/12] mm: rmap opt
      ... > we know there will be no concurrent modifications. ... to confess to that in the change comments, if it's not a separate patch. ... common case it will avoid the atomic -1. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: [PATCH] BUG() in exec_mmap()
      ... Ill fix it up by hand. ... > exec_mmapor indirectly from mmput() still needs to depend on the ... > the patch would need to be reworked to avoid the double decrement, ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: [PATCH] 2.6 workaround for Athlon/Opteron prefetch errata
      ... To avoid really ugly source code it would probably be desirable to just ... just like to avoid having the test or the fix at all on my Intel systems. ... And if I read correctly, that errata will be fixed in future Athlon CPUs, ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: [rfc] lockless pagecache
      ... >> in it to avoid the race condition traversing the trees. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: [PATCH] Remove module reference counting.
      ... > surely if nothing is registered and all CPUs do a voluntary schedule() ... > then there can be no chance of calling back in to the module. ... So unregistering will avoid new handlers to jump into the code, ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)