diff options
author | Lee Schermerhorn <Lee.Schermerhorn@hp.com> | 2007-11-21 18:07:05 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2008-02-01 18:04:20 -0500 |
commit | 74e27e44b0407fb1f6e8d1f7b7818f108463c4b8 (patch) | |
tree | 7f3b5c147176051987231e2f6e1521f66083e047 /drivers/pci | |
parent | 53a9bf4267b8b1f958dbeb7c8c1ef21c82229b71 (diff) |
PCI: Mem Policy: fix mempolicy usage in pci driver
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: Lee Schermerhorn <lee.schermerhorn@hp.com>
Acked-by: Christoph Lameter <clameter@sgi.com>
Acked-by: Mel Gorman <mel@csn.ul.ie>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/pci')
-rw-r--r-- | drivers/pci/pci-driver.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c index c4fa35d1dd77..e571c72e6753 100644 --- a/drivers/pci/pci-driver.c +++ b/drivers/pci/pci-driver.c | |||
@@ -186,13 +186,11 @@ static int pci_call_probe(struct pci_driver *drv, struct pci_dev *dev, | |||
186 | set_cpus_allowed(current, node_to_cpumask(node)); | 186 | set_cpus_allowed(current, node_to_cpumask(node)); |
187 | /* And set default memory allocation policy */ | 187 | /* And set default memory allocation policy */ |
188 | oldpol = current->mempolicy; | 188 | oldpol = current->mempolicy; |
189 | current->mempolicy = &default_policy; | 189 | current->mempolicy = NULL; /* fall back to system default policy */ |
190 | mpol_get(current->mempolicy); | ||
191 | #endif | 190 | #endif |
192 | error = drv->probe(dev, id); | 191 | error = drv->probe(dev, id); |
193 | #ifdef CONFIG_NUMA | 192 | #ifdef CONFIG_NUMA |
194 | set_cpus_allowed(current, oldmask); | 193 | set_cpus_allowed(current, oldmask); |
195 | mpol_free(current->mempolicy); | ||
196 | current->mempolicy = oldpol; | 194 | current->mempolicy = oldpol; |
197 | #endif | 195 | #endif |
198 | return error; | 196 | return error; |