The idle sweep hands glibc's free heap back, not only a large making
glibc keeps what the process's threads free as free heap, its pages resident, until malloc_trim hands it back, and only a large pipeline making's return called it. The memory log of one Iris Xe cold boot at pin 66 (reims's 24852) shows the cost: 1.4 GiB of glibc's 4.0 GiB of arenas free at its end, after 3 trims in all, all from large makings. Now each device's idle sweep thread also looks at glibc's heap every 5 s (HEAP_EVERY), whether or not a sweep is due, and trims once the heap holds more than the floor (FREE_FLOOR, 256 MiB) free above the least free a look read since the last trim, at two looks in a row (idle_sweep::HeapLook). The least-free rule, not the bytes free alone, because glibc still counts a trimmed chunk free: a plain fordblks rule would trim again at every look. A trim counts in WorkCounts::heap_trims, as a large making's does. compile_memory gains heap_bytes() and trim(), which return_free_heap now uses. Only on Linux with glibc; elsewhere the thread makes no look and waits as before. Docs: idle_sweep.rs and compile_memory.rs module docs, WorkCounts::heap_trims, the memory log's paragraph in docs/API.md. Tests: tests::idle_heap_look (the look's rule: trimmed at the second look, not again for what a trim left, again for what was freed after it); tests::idle_heap_trim (device test, m2v_gpu or m2v_cpu_icd, Linux gnu): 768 MiB of written 64 KiB chunks, all but one in 16 and the last freed, then idle; the device's thread trims and the resident set falls by 512 MiB or more. The lavapipe run and its negative control (no heap look: the test must fail) follow this commit.
This commit is contained in:
1 parent
f0ceab6a30
commit
3b3739ce45
7 files changed
+272
-47
No files matched your search
+3
-2
@@ -1886,8 +1886,9 @@ bytes, block and memory type; and each copy of a no-copy object's host pages (`c
|
||||
as it is made and as it goes: the caller's pointer and length and the copy's host address, the
|
||||
two ranges the runtime's comparisons write on the CPU. On Linux with glibc's allocator each line
|
||||
ends with glibc's heap then, every arena's (`mallinfo2`: bytes in use, bytes free, what its arenas
|
||||
hold, what it mapped apart) and the `malloc_trim` calls the process's large pipeline makings made,
|
||||
so a resident set that grows and stays reads as free heap, heap in use, or neither.
|
||||
hold, what it mapped apart) and the `malloc_trim` calls the process made (after its large pipeline
|
||||
makings, and at its devices' idle sweeps once more than 256 MiB of free heap came since the last
|
||||
trim), so a resident set that grows and stays reads as free heap, heap in use, or neither.
|
||||
With `METAL2VULKAN_LOG_SHADOWS` set, a device logs one line per shadow it makes of a texture (id
|
||||
name `metal2vulkan-shadows`, `Info` severity): the call (an IOSurface plane's among them, or the
|
||||
binding's or pass's call for a shadow made at its first use), the texture's format, size, levels
|
||||
|
||||
Reference in new issue
Block a user