Commit c6df0ff4 authored by Hugh Dickins's avatar Hugh Dickins Committed by Linus Torvalds

[PATCH] swapinfo accounting

Randy observed that 2.5 /proc/meminfo SwapFree holds steady
while SwapTotal goes up and down: wrong way round!

Andrew pointed to wrong conditional in si_swapinfo(): 2.5.4
updated it incorrectly when new flags bit was briefly added.
And pointed out that it also makes si_swapinfo much too slow.
parent d1ff5024
...@@ -1095,7 +1095,8 @@ void si_swapinfo(struct sysinfo *val) ...@@ -1095,7 +1095,8 @@ void si_swapinfo(struct sysinfo *val)
swap_list_lock(); swap_list_lock();
for (i = 0; i < nr_swapfiles; i++) { for (i = 0; i < nr_swapfiles; i++) {
unsigned int j; unsigned int j;
if (!(swap_info[i].flags & SWP_USED)) if (!(swap_info[i].flags & SWP_USED) ||
(swap_info[i].flags & SWP_WRITEOK))
continue; continue;
for (j = 0; j < swap_info[i].max; ++j) { for (j = 0; j < swap_info[i].max; ++j) {
switch (swap_info[i].swap_map[j]) { switch (swap_info[i].swap_map[j]) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment