SysadminNews

Page Alloc Hogger: free bytes do not prove a block fits

On this page
  1. An RFC for controlled pressure
  2. The allocation size has a unit
  3. What to record when reproducing a problem

Targeted memory pressure can help reproduce allocator problems. To interpret the result, distinguish how many pages are free from whether the requested contiguous block exists.

Two invented layouts of sixteen 4 KiB pages each have eight free pages, totaling 32 KiB. Only the upper layout immediately offers an aligned block of eight free pages. Reclaim or compaction could change the lower layout.
Two invented layouts of sixteen 4 KiB pages each have eight free pages, totaling 32 KiB. Only the upper layout immediately offers an aligned block of eight free pages. Reclaim or compaction could change the lower layout. Chart : PeopleAreGeek. Data source.
View full-size image

An RFC for controlled pressure

Juan Yescas posted RFC v2 on August 6 UTC. It proposes allocating and releasing pages through debugfs, selecting node, zone, allocation order and migration type. That version excludes ZONE_DEVICE and does not yet support MIGRATE_CMA.

The review discussion matters as much as the initial feature list: maintainers favor separating the mechanism from core memory management, with testing tooling discussed as a suitable home. It should not be presented as a promised end-user feature of a named kernel release.

The allocation size has a unit

An allocation of order n contains 2 to the power n base pages. With 4 KiB base pages, order 9 means 512 pages, or 2 MiB. The old text omitted the base-page assumption; an order is not an architecture-independent byte quantity.

The cover uses an even smaller invented example: sixteen 4 KiB pages, eight free in each row. Both rows have 32 KiB available. In the first row, the first eight pages form an aligned free block, so that local layout can satisfy an order-3 request. In the second row, alternating occupied pages break up every such block.

This deliberately isolates the layout at one instant. A real allocator may reclaim, compact or fall back according to its flags and policy. The drawing does not assert permanent allocation failure, reproduce a benchmark or describe an actual machine.

What to record when reproducing a problem

A useful experiment needs the base-page size, kernel revision, request flags, target node and zone, and the before/after free-block distribution. Pair that with latency or failure observations from the workload being studied. “The machine had free RAM” leaves out precisely the distinctions the proposed tool exposes.

Userspace can already influence NUMA placement; the previous statement that it chooses none of these parameters was too broad. The proposed module’s value is a specific allocator-facing control surface and retained kernel allocations, not the invention of all targeted memory testing.

We have not loaded this module or applied memory pressure to a server. The example is an arithmetic and layout explanation. Running an allocator stress tool belongs on a disposable test system with an explicit way to release its allocations and recover the machine.

September 8: identify RFC v2 and maintainer preference for testing tools, correct allocation-order units, and illustrate fragmentation without running a pressure generator.