• Lee Schermerhorn's avatar
    PCI: Mem Policy: fix mempolicy usage in pci driver · 74e27e44
    Lee Schermerhorn authored
    In an attempt to ensure memory allocation from the local node, the pci
    driver temporarily replaces the current task's memory policy with the
    system default policy.  Trying to be a good citizen, the driver then call's
    mpol_get() on the new policy.  When it's finished probing, it undoes the
    '_get by calling mpol_free() [on the system default policy] and then
    restores the current task's saved mempolicy.
    
    A couple of issues here:
    
    1) it's never necessary to set a task's mempolicy to the
       system default policy in order to get system default
       allocation behavior.  Simply set the current task's
       mempolicy to NULL and allocations will fall back to
       system default policy.
    
    2) we should never [need to] call mpol_free() on the system
       default policy.  [I plan on trapping this with a VM_BUG_ON()
       in a subsequent patch.]
    
    This patch removes the calls to mpol_get() and mpol_free()
    and uses NULL for the temporary task mempolicy to effect
    default allocation behavior.
    Signed-off-by: default avatarLee Schermerhorn <lee.schermerhorn@hp.com>
    Acked-by: default avatarChristoph Lameter <clameter@sgi.com>
    Acked-by: default avatarMel Gorman <mel@csn.ul.ie>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
    74e27e44
pci-driver.c 13.3 KB