diff options
Diffstat (limited to 'fs/proc/meminfo.c')
-rw-r--r-- | fs/proc/meminfo.c | 31 |
1 files changed, 1 insertions, 30 deletions
diff --git a/fs/proc/meminfo.c b/fs/proc/meminfo.c index df4661abadc4..83720460c5bc 100644 --- a/fs/proc/meminfo.c +++ b/fs/proc/meminfo.c | |||
@@ -29,10 +29,7 @@ static int meminfo_proc_show(struct seq_file *m, void *v) | |||
29 | unsigned long committed; | 29 | unsigned long committed; |
30 | long cached; | 30 | long cached; |
31 | long available; | 31 | long available; |
32 | unsigned long pagecache; | ||
33 | unsigned long wmark_low = 0; | ||
34 | unsigned long pages[NR_LRU_LISTS]; | 32 | unsigned long pages[NR_LRU_LISTS]; |
35 | struct zone *zone; | ||
36 | int lru; | 33 | int lru; |
37 | 34 | ||
38 | /* | 35 | /* |
@@ -51,33 +48,7 @@ static int meminfo_proc_show(struct seq_file *m, void *v) | |||
51 | for (lru = LRU_BASE; lru < NR_LRU_LISTS; lru++) | 48 | for (lru = LRU_BASE; lru < NR_LRU_LISTS; lru++) |
52 | pages[lru] = global_page_state(NR_LRU_BASE + lru); | 49 | pages[lru] = global_page_state(NR_LRU_BASE + lru); |
53 | 50 | ||
54 | for_each_zone(zone) | 51 | available = si_mem_available(); |
55 | wmark_low += zone->watermark[WMARK_LOW]; | ||
56 | |||
57 | /* | ||
58 | * Estimate the amount of memory available for userspace allocations, | ||
59 | * without causing swapping. | ||
60 | */ | ||
61 | available = i.freeram - totalreserve_pages; | ||
62 | |||
63 | /* | ||
64 | * Not all the page cache can be freed, otherwise the system will | ||
65 | * start swapping. Assume at least half of the page cache, or the | ||
66 | * low watermark worth of cache, needs to stay. | ||
67 | */ | ||
68 | pagecache = pages[LRU_ACTIVE_FILE] + pages[LRU_INACTIVE_FILE]; | ||
69 | pagecache -= min(pagecache / 2, wmark_low); | ||
70 | available += pagecache; | ||
71 | |||
72 | /* | ||
73 | * Part of the reclaimable slab consists of items that are in use, | ||
74 | * and cannot be freed. Cap this estimate at the low watermark. | ||
75 | */ | ||
76 | available += global_page_state(NR_SLAB_RECLAIMABLE) - | ||
77 | min(global_page_state(NR_SLAB_RECLAIMABLE) / 2, wmark_low); | ||
78 | |||
79 | if (available < 0) | ||
80 | available = 0; | ||
81 | 52 | ||
82 | /* | 53 | /* |
83 | * Tagged format, for easy grepping and expansion. | 54 | * Tagged format, for easy grepping and expansion. |