Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 7901
b: refs/heads/master
c: d42c699
h: refs/heads/master
i:
  7899: 1a390db
v: v3
  • Loading branch information
Andi Kleen authored and Greg Kroah-Hartman committed Sep 8, 2005
1 parent 0219bbf commit b6639de
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 56d8456b06ad1316bff3c75caed5e06e786f20d8
refs/heads/master: d42c69972b853fd33a26c8c7405624be41a22136
31 changes: 30 additions & 1 deletion trunk/drivers/pci/pci-driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <linux/module.h>
#include <linux/init.h>
#include <linux/device.h>
#include <linux/mempolicy.h>
#include "pci.h"

/*
Expand Down Expand Up @@ -163,6 +164,34 @@ const struct pci_device_id *pci_match_device(struct pci_driver *drv,
return NULL;
}

static int pci_call_probe(struct pci_driver *drv, struct pci_dev *dev,
const struct pci_device_id *id)
{
int error;
#ifdef CONFIG_NUMA
/* Execute driver initialization on node where the
device's bus is attached to. This way the driver likely
allocates its local memory on the right node without
any need to change it. */
struct mempolicy *oldpol;
cpumask_t oldmask = current->cpus_allowed;
int node = pcibus_to_node(dev->bus);
if (node >= 0 && node_online(node))
set_cpus_allowed(current, node_to_cpumask(node));
/* And set default memory allocation policy */
oldpol = current->mempolicy;
current->mempolicy = &default_policy;
mpol_get(current->mempolicy);
#endif
error = drv->probe(dev, id);
#ifdef CONFIG_NUMA
set_cpus_allowed(current, oldmask);
mpol_free(current->mempolicy);
current->mempolicy = oldpol;
#endif
return error;
}

/**
* __pci_device_probe()
*
Expand All @@ -180,7 +209,7 @@ __pci_device_probe(struct pci_driver *drv, struct pci_dev *pci_dev)

id = pci_match_device(drv, pci_dev);
if (id)
error = drv->probe(pci_dev, id);
error = pci_call_probe(drv, pci_dev, id);
if (error >= 0) {
pci_dev->driver = drv;
error = 0;
Expand Down
1 change: 1 addition & 0 deletions trunk/include/linux/mempolicy.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ struct mempolicy *get_vma_policy(struct task_struct *task,

extern void numa_default_policy(void);
extern void numa_policy_init(void);
extern struct mempolicy default_policy;

#else

Expand Down
2 changes: 1 addition & 1 deletion trunk/mm/mempolicy.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ static kmem_cache_t *sn_cache;
policied. */
static int policy_zone;

static struct mempolicy default_policy = {
struct mempolicy default_policy = {
.refcnt = ATOMIC_INIT(1), /* never free it */
.policy = MPOL_DEFAULT,
};
Expand Down

0 comments on commit b6639de

Please sign in to comment.