Skip to contentSkip to conversation

/proc/meminfo swap counter wraparound in 2.2

DISCUSSION Sean Hunter 2 participants 4 messages Sep 12, 2001

lore
Share & tools
lore
#0 lore raw

Hi there

Having put 8Gb of swap on one of our production database servers[1], I found that "top", "free" et al report the amount of available swap space incorrectly.

This is because they all parse /proc/meminfo, and its counters seem to wrap when they encounter very high numbers. The relevant bit is the totalswap member of "struct sysinfo"

sean@lisa:~$ cat /proc/swaps
Filename                        Type            Size    Used    Priority
/dev/rd/c0d2p1                  partition       530104  41436   10
/usr/SWAPFILE1                  file            1048568 56      2
/usr/local/SWAPFILE1            file            1048568 52      2
/usr/SWAPFILE2                  file            1572856 0       3
/usr/local/SWAPFILE2            file            1572856 0       3
/var/SWAPFILE2                  file            1572856 0       3
/home/SWAPFILE2                 file            1572856 0       -6
sean@lisa:~$ cat /proc/meminfo 
        total:    used:    free:  shared: buffers:  cached:
Mem:  4125683712 2820616192 1305067520        0 82919424 232722432
Swap: 542777344 42541056 500236288
MemTotal:   4028988 kB
MemFree:    1274480 kB
MemShared:        0 kB
Buffers:      80976 kB
Cached:      227268 kB
BigTotal:   3111908 kB
BigFree:    1266988 kB
SwapTotal:   530056 kB
SwapFree:    488512 kB
sean@lisa:~$ uname -a
Linux lisa.sportingbet.com 2.2.19-6.2.7enterprise #1 SMP Thu Jun 14 07:34:12 EDT 2001 i686 unknown

As you can see, we are running redhat's "enterprise" 2.2.19 kernel.

I would be amazed if this bug were not also in the main 2.2.x tree. Is a fix likely or even possible in 2.2 ?

Sean

[1]One of several changes to avoid random oracle 600 errors under heavy load.

#1 lore raw
Quoted 2 lines

I would be amazed if this bug were not also in the main 2.2.x tree. Is a fix likely or even possible in 2.2 ?

No fix is planned for 2.2

#2 lore raw
In reply to Sean Hunter
Quoted 5 lines · Alan Cox
Quoted 2 lines

I would be amazed if this bug were not also in the main 2.2.x tree. Is a fix likely or even possible in 2.2 ?

No fix is planned for 2.2

OK, thanks. I'm a little reluctant to move this box to 2.4 yet (before Monday we had almost a year's uptime out of it- frequent reboots are frowned upon), but looking at the 2.4 source, the relevant bits of fs/proc/array.c and include/linux/kernel.h look exactly the same, so the problem could be there as well.

Am I being dumb?

Sean

#3 lore raw
In reply to Sean Hunter
Quoted 7 lines · Sean Hunter
Quoted 5 lines · Alan Cox
Quoted 2 lines

I would be amazed if this bug were not also in the main 2.2.x tree. Is a fix likely or even possible in 2.2 ?

No fix is planned for 2.2

Quoted 7 lines

OK, thanks. I'm a little reluctant to move this box to 2.4 yet (before Monday we had almost a year's uptime out of it- frequent reboots are frowned upon), but looking at the 2.4 source, the relevant bits of fs/proc/array.c and include/linux/kernel.h look exactly the same, so the problem could be there as well.

Am I being dumb?

Yes, of course I am. Having now Actually Tried It Instead Of Just Talking Bollocks[tm], I can confirm that large amounts of swap space seem to work just fine in 2.4.

Sorry for wasting people's time.

Sean