Patent ID: 8015367

Claim:
A method for managing host memory in a computer system hosting a plurality of contexts, each context having an address space divided into separately allocable portions that are mappable to corresponding portions of the host memory, wherein the host memory comprises physical random access memory of the computer system and more than one of the separately allocable portions may be mapped to a single host memory portion, the method comprising: selecting one context of the plurality of contexts; selecting a subset of the separately allocable portions of the address space of the selected context; for each of the separately allocable portions of the subset of the separately allocable portions of the address space of the selected context, identifying the corresponding portion of the host memory that is mapped to the separately allocable portion, and determining a count representing a number of separately allocable portions of any of the contexts that are mapped to the corresponding portion of the host memory; for each context, computing a respective metric that is a function of the counts for all the separately allocable portions of the subset of the address space for the context; and allocating the host memory among the plurality of contexts, the allocating being based at least in part on the computed respective metrics.