2.6 kernel zone structure a member variable lowmem_reserve
- struct {Zone
- / * Fields commonly accessed by the page allocator * /
- / * Zone watermarks, access with * _wmark_pages (zone) macros * /
- unsigned Long Watermark [NR_WMARK];
- / *
- * We don't know if the memory that we're going to allocate will be freeable
- * Or / and it will be released eventually, so to avoid totally wasting several
- * GB of ram we must reserve some of the lower zone memory (otherwise we risk
- * To run OOM on the lower zones despite there's tons of freeable ram
- * On the higher zones). This array is recalculated at runtime if the
- * Sysctl_lowmem_reserve_ratio sysctl changes.
- * /
- unsigned Long lowmem_reserve [MAX_NR_ZONES];
kernel when allocating memory, it may involve multiple zone, will try to allocate the first zone from zonelist allocation, if that fails it will try the next lower priority zone. We can imagine the application process and add lock memmap allocation, if this Highmem zone can not satisfy the allocation, an attempt is carried out from the Normal distribution. That there is a problem, a request from Highmem Normal zone may run out of memory, and it may well not be recovered, the end result is Normal zone no memory available to the kernel of the normal distribution, and by having a lot of recyclable Highmem memory can not be used effectively.
Therefore, for this case, so Normal zone in the face of the allocation request from Highmem, you can lowmem_reserve Disclaimer: Can I use my memory, but must be reserved lowmem_reserve [HIGHMEM] give me their own use.
Similarly, when from Normal fails, it will try to apply from the DMA allocation zonelist by lowmem_zone [DMA], restrictions and Normal from HIGHMEM allocation request.
- /*
- * results with 256, 32 in the lowmem_reserve sysctl:
- * 1G machine -> (16M dma, 800M-16M normal, 1G-800M high)
- * 1G machine -> (16M dma, 784M normal, 224M high)
- * NORMAL allocation will leave 784M/256 of ram reserved in the ZONE_DMA
- * HIGHMEM allocation will leave 224M/32 of ram reserved in ZONE_NORMAL
- * HIGHMEM allocation will (224M+784M)/256 of ram reserved in ZONE_DMA
- *
- * TBD: should special case ZONE_DMA32 machines here - in those we normally
- * don't need any ZONE_NORMAL reservation
- */
- #ifdef CONFIG_ZONE_DMA
- 256,
- #endif
- #ifdef CONFIG_ZONE_DMA32
- 256,
- #endif
- #ifdef CONFIG_HIGHMEM
- 32,
- #endif
- 32,
Note: From this zone assignment, without lowmem_reserve restrictions.
No comments:
Post a Comment