Figure 317 Batch sizes dependent on the amount of memory present lefthand side on the zone for various page sizes The graph on the righthand side shows the dependency against the number of pages present in a zone

As the lower limit used for hot pages is 0 and the upper limit is 6*batch, the average number of pages in the cache will be around 4*batch because the kernel tries to not let the caches drain too much. batch*4, however, corresponds to a thousandth of the total number of zone pages (this is also the reason why zone_batchsize tried to optimize the batch size for 25 percent of one-thousandth of the total pages). The size of the L2 cache on IA-32 processors is in the range between 0.25 and 2 MiB, so it makes no sense to keep much more memory in a hot-n-cold cache than would fit into this space. As a rule of thumb, the cache size is one-thousandth of the main memory size; consider that current systems are equipped with between 1 and 2 GiB of RAM per CPU, so the rule is reasonable. The computed batch size will thus likely allow that the pages on the hot-n-cold cache fit into the CPU's L2 cache.

The watermarks of the cold list are slightly lower because cold pages not held in the cache are used only for actions that are not performance-critical (such actions are, of course, in the minority in the kernel,). Only double of the batch value is used as the upper limit.

The pcp->batch size determines how many pages are used at once when the list needs to be refilled. For performance reasons, a whole chunk of pages rather than single pages is added to the list.

The number of pages in each zone is output at the end of zone_pcp_init together with the calculated batch sizes as shown in the boot logs (for a system with 4 GiB of RAM in the example below).

[email protected] # dmesg / grep LIFO DMA zone: 2530 pages, LIFO batch:0 DMA32 zone: 833464 pages, LIFO batch:31 Normal zone: 193920 pages, LIFO batch:31

Continue reading here: Registering Active Memory Regions

Was this article helpful?

0 0