Memory allocator for a multiprocessor computer system
First Claim
1. In a multiprocessor system having shared physical memory distributed among a plurality of nodes, a method of dynamically allocating memory on a specified node of the system, the method comprising:
- receiving a request to dynamically allocate an amount of physical memory on a specified node, the request received from a process;
in response to the request, dynamically allocating the amount of physical memory on the specified node; and
indicating an address for the dynamically allocated amount of physical memory, wherein;
receiving the request includes a request to allocate the amount of physical memory from a specified memory pool;
allocating the amount of physical memory includes allocating the amount of physical memory from the specified pool, and dynamically allocating the amount of physical memory on the specified node comprises;
assigning a first variable to represent a count of memory structures in the physical memory, the count of memory structures in the physical memory represented by the first variable corresponding to a global count of memory structures in the physical memory for the multiprocessor system as a whole;
assigning multiple second variables, each second variables to represent a count of memory structures in the memory, the count of memory structures in the physical memory represented by each multiple second variable corresponding to a local count of memory structures in the physical memory for one of the plurality of nodes;
determining dynamically changeable desired levels of value of the multiple second variables as based on a distance between a total value of the multiple second variables and a predetermined limit of the multiple second variables;
maintaining a third variable, the third variable having a first part that stores the dynamically changeable desired levels of value of the multiple second variables, the third variable having a second part that stores the predetermined limit of the multiple second variables, and the third variable having a third part storing a leftover value of the multiple second variables, the leftover value being no less than one;
determining whether a selected second variable of the multiple second variables can be changed by the requested amount and stay within the dynamically changeable desired levels of value of the multiple second variables based on the total value of the multiple second variables and based on the predetermined limit of the multiple second variables as stored in the second part of the third variable;
if so, changing the selected second variable by the requested amount; and
if not, changing the first variable by the requested amount.
0 Assignments
0 Petitions
Accused Products
Abstract
Methods for dynamically allocating memory in a multiprocessor computer system such as a non-uniform memory access (NUMA) machine having distributed shared memory. The methods include allocating memory by specified node, memory class, or memory pool in response to requests by the system (kernel memory allocation) or a user (application memory allocation). Through these methods memory is allocated more efficiently in a NUMA machine. For example, allocating memory on a specified node in a NUMA machine, such as the same node on which a process requiring the memory is running, reduces memory access time. Allocating memory from a specified memory class allows device drivers with restricted DMA ranges to operate with dynamically allocated memory. Other benefits of these methods include minimizing expensive remote-memory accesses using a distributed reference count mechanism and lock-free cache access.
-
Citations
21 Claims
-
1. In a multiprocessor system having shared physical memory distributed among a plurality of nodes, a method of dynamically allocating memory on a specified node of the system, the method comprising:
-
receiving a request to dynamically allocate an amount of physical memory on a specified node, the request received from a process; in response to the request, dynamically allocating the amount of physical memory on the specified node; and indicating an address for the dynamically allocated amount of physical memory, wherein; receiving the request includes a request to allocate the amount of physical memory from a specified memory pool; allocating the amount of physical memory includes allocating the amount of physical memory from the specified pool, and dynamically allocating the amount of physical memory on the specified node comprises; assigning a first variable to represent a count of memory structures in the physical memory, the count of memory structures in the physical memory represented by the first variable corresponding to a global count of memory structures in the physical memory for the multiprocessor system as a whole; assigning multiple second variables, each second variables to represent a count of memory structures in the memory, the count of memory structures in the physical memory represented by each multiple second variable corresponding to a local count of memory structures in the physical memory for one of the plurality of nodes; determining dynamically changeable desired levels of value of the multiple second variables as based on a distance between a total value of the multiple second variables and a predetermined limit of the multiple second variables; maintaining a third variable, the third variable having a first part that stores the dynamically changeable desired levels of value of the multiple second variables, the third variable having a second part that stores the predetermined limit of the multiple second variables, and the third variable having a third part storing a leftover value of the multiple second variables, the leftover value being no less than one; determining whether a selected second variable of the multiple second variables can be changed by the requested amount and stay within the dynamically changeable desired levels of value of the multiple second variables based on the total value of the multiple second variables and based on the predetermined limit of the multiple second variables as stored in the second part of the third variable; if so, changing the selected second variable by the requested amount; and if not, changing the first variable by the requested amount. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19)
-
-
20. In a multiprocessor system with shared physical memory, the a method of dynamically allocating physical memory among the multiple processors, the method comprising:
-
providing a pool of available physical memory blocks per processor; in response to a first processor makes a physical memory allocation request for an amount of physical memory from the first processor'"'"'s pool, dynamically allocating the amount of physical memory for the first processor without acquiring a lock on the pool; and in response to a second processor makes a physical memory allocation request for an amount of physical memory from the first processor'"'"'s pool, dynamically allocating the amount of physical memory for the second processor from the first processor'"'"'s pool after acquiring a lock on the pool; wherein dynamically allocating the amount of physical memory comprises; assigning a first variable to represent a count of memory structures in the physical memory, the count of memory structures in the physical memory represented by the first variable corresponding to a global count of memory structures in the physical memory for the multiprocessor system as a whole; assigning multiple second variables, each second variables to represent a count of memory structures in the memory, the count of memory structures in the physical memory represented by each multiple second variable corresponding to a local count of memory structures in the physical memory for one of the plurality of nodes; determining dynamically changeable desired levels of value of the multiple second variables as based on a distance between a total value of the multiple second variables and a predetermined limit of the multiple second variables; maintaining a third variable, the third variable having a first part that stores the dynamically changeable desired levels of value of the multiple second variables, the third variable having a second part that stores the predetermined limit of the multiple second variables, and the third variable having a third part storing a leftover value of the multiple second variables, the leftover value being no less than one; determining whether a selected second variable of the multiple second variables can be changed by the requested amount and stay within the dynamically changeable desired levels of value of the multiple second variables based on the total value of the multiple second variables and based on the predetermined limit of the multiple second variables as stored in the second part of the third variable; if so, changing the selected second variable by the requested amount; and if not, changing the first variable by the requested amount. - View Dependent Claims (21)
-
Specification