]> git.hungrycats.org Git - linux/commitdiff
[PATCH] swapinfo accounting
authorHugh Dickins <hugh@veritas.com>
Tue, 16 Apr 2002 06:41:59 +0000 (23:41 -0700)
committerLinus Torvalds <torvalds@penguin.transmeta.com>
Tue, 16 Apr 2002 06:41:59 +0000 (23:41 -0700)
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.

mm/swapfile.c

index 586f48b8e6f88a346b0e8a9450d0444be3ea3c01..f93135a3f2d2704580f954171cf59df6b6efb090 100644 (file)
@@ -1095,7 +1095,8 @@ void si_swapinfo(struct sysinfo *val)
        swap_list_lock();
        for (i = 0; i < nr_swapfiles; i++) {
                unsigned int j;
-               if (!(swap_info[i].flags & SWP_USED))
+               if (!(swap_info[i].flags & SWP_USED) ||
+                    (swap_info[i].flags & SWP_WRITEOK))
                        continue;
                for (j = 0; j < swap_info[i].max; ++j) {
                        switch (swap_info[i].swap_map[j]) {