Linux内核中kzalloc_node中的内存节点是什么
What is the memory node in kzalloc_node in the Linux kernel
我不明白kzalloc_node函数中的内存节点是什么。描述说,"allocate zeroed memory from a particular memory node." 但什么是内存节点?我专门查看截止日期 I/O 调度程序的一部分(如下所示)。
static int deadline_init_queue(struct request_queue *q, struct elevator_type *e)
{
struct deadline_data *dd;
...
dd = kzalloc_node(sizeof(*dd), GFP_KERNEL, q->node);
...
}
这里有一个很好的描述:
https://www.kernel.org/doc/gorman/html/understand/understand009.html
...the function alloc_pages() calls numa_node_id() to return the
logical ID of the node associated with the current running CPU. This
NID is passed to _alloc_pages() which calls NODE_DATA() with the NID
as a parameter.
On UMA architectures, this will unconditionally result
in contig_page_data being returned but NUMA architectures instead set
up an array which NODE_DATA() uses NID as an offset into. In other
words, architectures are responsible for setting up a CPU ID to NUMA
memory node mapping.
This is effectively still a node-local allocation
policy as is used in 2.4 but it is a lot more clearly defined.
另请参阅:https://en.wikipedia.org/wiki/Non-uniform_memory_access
我不明白kzalloc_node函数中的内存节点是什么。描述说,"allocate zeroed memory from a particular memory node." 但什么是内存节点?我专门查看截止日期 I/O 调度程序的一部分(如下所示)。
static int deadline_init_queue(struct request_queue *q, struct elevator_type *e)
{
struct deadline_data *dd;
...
dd = kzalloc_node(sizeof(*dd), GFP_KERNEL, q->node);
...
}
这里有一个很好的描述:
https://www.kernel.org/doc/gorman/html/understand/understand009.html
...the function alloc_pages() calls numa_node_id() to return the logical ID of the node associated with the current running CPU. This NID is passed to _alloc_pages() which calls NODE_DATA() with the NID as a parameter.
On UMA architectures, this will unconditionally result in contig_page_data being returned but NUMA architectures instead set up an array which NODE_DATA() uses NID as an offset into. In other words, architectures are responsible for setting up a CPU ID to NUMA memory node mapping.
This is effectively still a node-local allocation policy as is used in 2.4 but it is a lot more clearly defined.
另请参阅:https://en.wikipedia.org/wiki/Non-uniform_memory_access