On Wed, 2010-04-07 at 08:48 -0700, Rick Sherm wrote:
Rick:
If you want/need to use __get_free_page(), you will need to set the
current task's memory policy. If you're loading the driver from user
space, then you can set the mempolicy of the task [shell, modprobe, ...]
using numactl as you suggest above. From within the kernel, you'd need
to temporarily change current's mempolicy to what you need and then put
it back. We don't have a formal interface to do this, I think, but such
could be added.
Another option, if you just want memory on a specific node, would be to
use kmalloc(). But for a multiple page allocation, this might not be
the best method.
As to how to find the node where the adapter is attached, from user
space you can look at /sys/devices/pci<pci-bus>/<pci-dev>/numa_node.
You can also find the 'local_cpus' [hex mask] and 'local_cpulist' in the
same directory. From within the driver, you can examine dev->numa_node.
Look at 'local_cpu{s|list}_show()' to see how to find the local cpus for
a device.
Note that if your device is attached to a memoryless node on x86, this
info won't be accurate. x86 arch code removes memoryless nodes and
reassigns cpus to other nodes that do have memory. I'm not sure what it
does with the dev->numa_node info. Maybe not a problem for you.
Regards,
Lee
--