/* * Estimate the amount of memory available for userspace allocations, * without causing swapping or OOM.
*/
available = global_zone_page_state(NR_FREE_PAGES) - totalreserve_pages;
/* * Not all the page cache can be freed, otherwise the system will * start swapping or thrashing. Assume at least half of the page * cache, or the low watermark worth of cache, needs to stay.
*/
pagecache = global_node_page_state(NR_ACTIVE_FILE) +
global_node_page_state(NR_INACTIVE_FILE);
pagecache -= min(pagecache / 2, wmark_low);
available += pagecache;
/* * Part of the reclaimable slab and other kernel memory consists of * items that are in use, and cannot be freed. Cap this estimate at the * low watermark.
*/
reclaimable = global_node_page_state_pages(NR_SLAB_RECLAIMABLE_B) +
global_node_page_state(NR_KERNEL_MISC_RECLAIMABLE);
reclaimable -= min(reclaimable / 2, wmark_low);
available += reclaimable;
if (available < 0)
available = 0; return available;
}
EXPORT_SYMBOL_GPL(si_mem_available);
/* * Determine whether the node should be displayed or not, depending on whether * SHOW_MEM_FILTER_NODES was passed to show_free_areas().
*/ staticbool show_mem_node_skip(unsignedint flags, int nid, nodemask_t *nodemask)
{ if (!(flags & SHOW_MEM_FILTER_NODES)) returnfalse;
/* * no node mask - aka implicit memory numa policy. Do not bother with * the synchronization - read_mems_allowed_begin - because we do not * have to be precise here.
*/ if (!nodemask)
nodemask = &cpuset_current_mems_allowed;
for (i = 0; i < MIGRATE_TYPES; i++) { if (type & (1 << i))
*p++ = types[i];
}
*p = '\0';
printk(KERN_CONT "(%s) ", tmp);
}
staticbool node_has_managed_zones(pg_data_t *pgdat, int max_zone_idx)
{ int zone_idx; for (zone_idx = 0; zone_idx <= max_zone_idx; zone_idx++) if (zone_managed_pages(pgdat->node_zones + zone_idx)) returntrue; returnfalse;
}
/* * Show free area list (used inside shift_scroll-lock stuff) * We also calculate the percentage fragmentation. We do this by counting the * memory on each free list with the exception of the first item on the list. * * Bits in @filter: * SHOW_MEM_FILTER_NODES: suppress nodes that are not allowed by current's * cpuset.
*/ staticvoid show_free_areas(unsignedint filter, nodemask_t *nodemask, int max_zone_idx)
{ unsignedlong free_pcp = 0; int cpu, nid; struct zone *zone;
pg_data_t *pgdat;
for_each_populated_zone(zone) { if (zone_idx(zone) > max_zone_idx) continue; if (show_mem_node_skip(filter, zone_to_nid(zone), nodemask)) continue;
/* Same as alloc_tag_to_text() but w/o intermediate buffer */ if (ct->modname)
pr_notice("%12s %8llu %s:%u [%s] func:%s\n",
bytes, counter.calls, ct->filename,
ct->lineno, ct->modname, ct->function); else
pr_notice("%12s %8llu %s:%u func:%s\n",
bytes, counter.calls, ct->filename,
ct->lineno, ct->function);
}
}
} #endif
}
Messung V0.5 in Prozent
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.12Bemerkung:
(vorverarbeitet am 2026-06-05)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.