|
@@ -4701,6 +4701,7 @@ long si_mem_available(void)
|
|
|
unsigned long pagecache;
|
|
|
unsigned long wmark_low = 0;
|
|
|
unsigned long pages[NR_LRU_LISTS];
|
|
|
+ unsigned long reclaimable;
|
|
|
struct zone *zone;
|
|
|
int lru;
|
|
|
|
|
@@ -4726,19 +4727,13 @@ long si_mem_available(void)
|
|
|
available += pagecache;
|
|
|
|
|
|
/*
|
|
|
- * Part of the reclaimable slab consists of items that are in use,
|
|
|
- * and cannot be freed. Cap this estimate at the low watermark.
|
|
|
+ * 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.
|
|
|
*/
|
|
|
- available += global_node_page_state(NR_SLAB_RECLAIMABLE) -
|
|
|
- min(global_node_page_state(NR_SLAB_RECLAIMABLE) / 2,
|
|
|
- wmark_low);
|
|
|
-
|
|
|
- /*
|
|
|
- * Part of the kernel memory, which can be released under memory
|
|
|
- * pressure.
|
|
|
- */
|
|
|
- available += global_node_page_state(NR_INDIRECTLY_RECLAIMABLE_BYTES) >>
|
|
|
- PAGE_SHIFT;
|
|
|
+ reclaimable = global_node_page_state(NR_SLAB_RECLAIMABLE) +
|
|
|
+ global_node_page_state(NR_KERNEL_MISC_RECLAIMABLE);
|
|
|
+ available += reclaimable - min(reclaimable / 2, wmark_low);
|
|
|
|
|
|
if (available < 0)
|
|
|
available = 0;
|