Messages in this thread Patch in this message | | | Date | Wed, 29 Mar 2000 16:07:34 -0500 | From | Larry Woodman <> | Subject | Re: Memory usage |
| |
David Raufeisen wrote:
> cold:~% free > total used free shared buffers cached > Mem: 255224 244016 11208 0 2804 187508 > -/+ buffers/cache: 53704 201520 > Swap: 126752 56712 70040 > > does that swap usage seem odd to anyone else considering the 'ps aux' output > below? > > btw this is kernel 2.3.99pre3 > > cold:~% ps aux > USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND > root 1 0.0 0.0 1020 124 ? S 17:26 0:09 init [2] > root 2 0.0 0.0 0 0 ? SW 17:26 0:00 [khubd] > root 3 0.0 0.0 0 0 ? SW 17:26 0:04 [kswapd] > root 4 0.0 0.0 0 0 ? SW 17:26 0:00 [kflushd] > root 5 0.0 0.0 0 0 ? SW 17:26 0:00 [kupdate] > root 119 0.0 0.0 1352 168 ? S 17:26 0:00 /sbin/syslogd > root 121 0.0 0.0 1528 4 ? S 17:26 0:00 /sbin/klogd > daemon 125 0.0 0.0 1124 4 ? S 17:26 0:00 /sbin/portmap > root 137 0.0 0.0 1300 4 ? S 17:26 0:00 /usr/sbin/inetd > root 143 0.0 0.0 1352 4 ? S 17:26 0:00 /usr/sbin/lpd > rwhod 156 0.0 0.0 1444 224 ? S 17:26 0:00 /usr/sbin/rwhod > root 165 0.0 0.0 2240 4 ? S 17:26 0:00 /usr/sbin/sshd > root 174 0.0 0.0 2200 88 ? S 17:26 0:00 proftpd > (accepting > root 186 0.0 0.0 1004 4 tty3 S 17:26 0:00 /sbin/getty 38400 > tty3 > root 187 0.0 0.0 1004 4 tty4 S 17:26 0:00 /sbin/getty 38400 > tty4 > root 188 0.0 0.0 1004 4 tty5 S 17:26 0:00 /sbin/getty 38400 > tty5 > root 189 0.0 0.0 1004 4 tty6 S 17:26 0:00 /sbin/getty 38400 > tty6 > david 237 0.0 0.2 2032 608 ? S 17:27 0:05 SCREEN > david 238 0.0 0.0 2132 4 pts/2 S 17:27 0:00 /bin/bash > david 267 8.3 8.9 25048 22928 pts/2 S 17:27 30:57 opennap > david 289 0.0 0.0 2128 4 pts/3 S 17:28 0:00 /bin/bash > david 293 0.0 0.3 2644 788 pts/3 S 17:28 0:05 BWap > david 294 0.0 0.3 2644 788 pts/3 S 17:28 0:00 BWap > david 295 0.0 0.3 2644 788 pts/3 S 17:28 0:00 BWap > david 3501 0.0 0.0 1888 4 ? S 22:41 0:00 /bin/sh > /usr/bin/X11/startx > david 3509 0.0 0.0 2172 4 ? S 22:41 0:00 xinit > /home/david/.xinitrc -- -auth /home/david/.Xauth > root 3510 2.1 3.1 66964 8068 ? S 22:41 1:15 X :0 -auth > /home/david/.Xauthority > david 3514 0.2 0.4 3824 1184 ? S 22:41 0:08 > /usr/bin/X11/WindowMaker > david 3540 0.0 1.0 13836 2624 ? S 22:47 0:01 xmms > david 3541 0.0 1.0 13836 2624 ? S 22:47 0:00 xmms > david 3542 0.0 1.0 13836 2624 ? S 22:47 0:00 xmms > david 3543 0.0 1.0 13836 2624 ? S 22:47 0:00 xmms > david 3673 0.0 1.0 13836 2624 ? S 23:32 0:00 xmms > david 3674 0.4 1.0 13836 2624 ? S 23:32 0:01 xmms > david 3748 0.0 0.4 2004 1268 ? S 23:37 0:00 rxvt -name irc -e > ssh fortyoz.org -t screen -r > david 3749 0.1 0.4 2684 1276 pts/0 S 23:37 0:00 ssh fortyoz.org > -t screen -r > david 3757 0.1 0.4 2000 1268 ? S 23:38 0:00 rxvt > david 3758 0.0 0.5 2128 1300 pts/1 S 23:38 0:00 bash > david 3762 0.0 0.3 1888 796 pts/1 S 23:38 0:00 screen -r > root 3773 0.1 0.1 1004 444 tty2 S 23:39 0:00 /sbin/getty 38400 > tty2 > david 3774 1.0 0.5 2076 1340 ? S 23:39 0:00 rxvt > david 3775 0.6 0.5 2128 1304 pts/4 S 23:39 0:00 bash > david 3779 0.0 0.5 3012 1312 pts/4 R 23:39 0:00 ps aux > > -- > > David Raufeisen (davidr@linux.com) > Project Development Manager -- Linux.com > > - > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in > the body of a message to majordomo@vger.rutgers.edu > Please read the FAQ at http://www.tux.org/lkml/
I ran into the same problem, its caused by pages staying in the swap cache after a process exits. Since the swap cache pages are still allocated the swap space remains in use until the system runs out of memory and shrink_mmap() frees everything up. Here is a patch for 2.3.99-pre3 to fix this.
Larry Woodman http://www.missioncriticallinux.com
diff -u --recursive ../mnt/linux/include/linux/swap.h ./include/linux/swap.h --- ../mnt/linux/include/linux/swap.h Thu Mar 23 18:36:08 2000 +++ ./include/linux/swap.h Sun Mar 29 13:16:07 2020 @@ -153,8 +153,9 @@ if (PageReserved(page)) return 1; count = page_count(page); - if (PageSwapCache(page)) - count += swap_count(page) - 2; + if (PageSwapCache(page)) { + count += swap_count(page) - 2 - !!page->buffers; + } return count > 1; } diff -u --recursive ../mnt/linux/mm/memory.c ./mm/memory.c --- ../mnt/linux/mm/memory.c Thu Mar 23 14:35:32 2000 +++ ./mm/memory.c Sun Mar 29 12:08:26 2020 @@ -271,9 +271,14 @@ */ free_page_and_swap_cache(mem_map+nr); return 1; + } else { + struct page *pg = lookup_swap_cache(pte_to_swp_entry(page)); + + swap_free(pte_to_swp_entry(page)); + if (pg) + free_page_and_swap_cache(pg); + return 0; } - swap_free(pte_to_swp_entry(page)); - return 0; } static inline void forget_pte(pte_t page) | |