- Last 7 days
-
elixir.bootlin.com elixir.bootlin.com
-
if (!(force_purge || vb->free < VMAP_PURGE_THRESHOLD)) return false;
This line prevent purging blocks with considerable amount of "usable memory" unless requested with force_purge. The threshold VMAP_PURGE_THRESHOLD could be a tunable variable.
-
1
This sets the timeout between retries if vmap_pages_range() fails. This could be tunable variable.
-
resched_threshold = lazy_max_pages() << 1;
This threshold and lines 1776~1777 determine under which number of lazily-freed pages it should yield CPU temporarily to higher-priority tasks.
The "<<1" part could be a tunable variable.
-
32UL * 1024 * 1024
The function lazy_max_pages always returns multiples of 32 MB worth of pages, which seems like a tunable variable rather than a fixed magic number.
-
log = fls(num_online_cpus());
This heuristic scales lazy_max_pages logarithmically. Alternatively, machine learning could determine the optimal scaling function—whether linear, logarithmic, square-root, or another approach.
-
100U
This is a configuration policy that determines 100 pages are the upper limit for the bulk-allocator. However, when I looked into
alloc_pages_bulk_array_mempolicy
, there is no explicit limit in the implementation. So I believe it is a configuration policy. -
if (!order) {
It determines that only use the bulk allocator for order-0 pages (non-super pages). Maybe we should try applying it to super pages since I haven't seen the reason why it cannot be applied.
-