DaemonForums  

Go Back   DaemonForums > OpenBSD > OpenBSD General

OpenBSD General Other questions regarding OpenBSD which do not fit in any of the categories below.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 14th September 2009
knasbas knasbas is offline
Port Guard
 
Join Date: May 2008
Posts: 25
Default No ram left?

I recently saw that im very short on ram and not really sure why?
Besides top(shown below), is there any possibility to see what process has been using/leaking or whatever has happened?
I have heard that rtorrent has some kind of leak but it hasnt been any problem so far so why would it be that if i havent changed it.

I added 512mb of ram about 2 weeks ago when i noticed that i was low on ram but it didnt really change anything.
top output:
Code:
load averages:  0.09,  0.11,  0.08                                                                          10:47:24
33 processes:  32 idle, 1 on processor
CPU states:  0.0% user,  0.0% nice,  0.0% system,  0.0% interrupt,  100% idle
Memory: Real: 22M/1262M act/tot  Free: 243M  Swap: 16M/5120M used/tot

  PID USERNAME PRI NICE  SIZE   RES STATE    WAIT      TIME    CPU COMMAND
 8605 www        2    0 2876K 4172K sleep    netio     0:13  1.27% httpd
30822 root       2    0  964K 1112K sleep    select    0:29  0.00% sendmail
 6643 www        2    0 2928K 4180K sleep    netio     0:25  0.00% httpd
20984 www        2    0 2948K 1160K sleep    netio     0:24  0.00% httpd
 1896 root       2    0 2704K  380K sleep    select    0:30  0.00% httpd
16326 www        2    0 2860K 1164K sleep    netio     0:21  0.00% httpd
18154 www        2    0 2916K 4176K sleep    netcon    0:17  0.00% httpd
26836 www        2    0 2872K 4176K sleep    netcon    0:16  0.00% httpd
25336 www        2    0 3044K 4176K sleep    netio     0:15  0.00% httpd
13111 www        2    0 2908K 4172K sleep    netcon    0:13  0.00% httpd
31382 www        2    0 2868K 4176K sleep    netio     0:12  0.00% httpd
18432 root       2    0 1032K  892K sleep    select    0:12  0.00% nmbd
 8432 _syslogd   2    0  476K  632K sleep    poll      0:07  0.00% syslogd
12957 root       2    0  528K    4K idle     select    0:05  0.00% sshd
23574 root       2    0 3176K 1192K idle     select    0:05  0.00% smbd
 5300 www        2    0 2872K 1152K sleep    netcon    0:05  0.00% httpd
 9182 root       2    0  456K    4K idle     select    0:03  0.00% inetd
 8915 root       2    0  468K  512K idle     select    0:01  0.00% cron
    1 root      10    0  320K   96K idle     wait      0:00  0.00% init
12533 root       2    0 2776K    4K idle     select    0:00  0.00% smbd
17143 _dhcp      2    0  344K    4K idle     poll      0:00  0.00% dhclient
 5756 root       2    0 3536K 2500K sleep    select    0:00  0.00% sshd
12244 root      28    0  552K 1344K onproc   -         0:00  0.00% top
 5089 root       2    0  296K    4K idle     poll      0:00  0.00% dhclient
27067 root       2    0  440K    4K idle     netio     0:00  0.00% syslogd
30210 root      10    0  936K 1576K idle     wait      0:00  0.00% bash
  580 root       3    0  240K    4K idle     ttyin     0:00  0.00% getty
 7592 root       3    0  232K    4K idle     ttyin     0:00  0.00% getty
31051 root       3    0  312K    4K idle     ttyin     0:00  0.00% getty
23669 root       3    0  240K    4K idle     ttyin     0:00  0.00% getty
 5672 root       3    0  300K    4K idle     ttyin     0:00  0.00% getty
17163 www        2    0 2704K 1772K sleep    netcon    0:00  0.00% httpd
 8239 root      18    0 2776K    4K idle     pause     0:00  0.00% smbd
dmesg output:
Code:
OpenBSD 4.5-stable (GENERIC) #0: Wed Jul 22 16:12:03 CEST 2009
    root@:/usr/src/sys/arch/i386/compile/GENERIC
cpu0: AMD Athlon(tm) XP 2600+ ("AuthenticAMD" 686-class, 512KB L2 cache) 1.92 GHz
cpu0: FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,MMX,FXSR,SSE
real mem  = 1610104832 (1535MB)
avail mem = 1547571200 (1475MB)
mainbus0 at root
bios0 at mainbus0: AT/286+ BIOS, date 11/22/04, BIOS32 rev. 0 @ 0xfb3f0, SMBIOS rev. 2.2 @ 0xf0800 (37 entries)
bios0: vendor Phoenix Technologies, LTD version "6.00 PG" date 11/22/2004
bios0: http://www.abit.com.tw/ NF7-S/NF7,NF7-V (nVidia-nForce2)
apm0 at bios0: Power Management spec V1.2 (slowidle)
apm0: AC on, battery charge unknown
acpi at bios0 function 0x0 not configured
pcibios0 at bios0: rev 2.1 @ 0xf0000/0xdf84
pcibios0: PCI IRQ Routing Table rev 1.0 @ 0xfdeb0/208 (11 entries)
pcibios0: PCI Exclusive IRQs: 10 11 12 14 15
pcibios0: no compatible PCI ICU found
pcibios0: Warning, unable to fix up PCI interrupt routing
pcibios0: PCI bus #2 is the last bus
bios0: ROM list: 0xc0000/0x9800 0xcc000/0x5000 0xd1000/0x1000
cpu0 at mainbus0: (uniprocessor)
pci0 at mainbus0 bus 0: configuration mode 1 (bios)
pchb0 at pci0 dev 0 function 0 "NVIDIA nForce2 PCI" rev 0xc1
agp at pchb0 not configured
"NVIDIA nForce2" rev 0xc1 at pci0 dev 0 function 1 not configured
"NVIDIA nForce2" rev 0xc1 at pci0 dev 0 function 2 not configured
"NVIDIA nForce2" rev 0xc1 at pci0 dev 0 function 3 not configured
"NVIDIA nForce2" rev 0xc1 at pci0 dev 0 function 4 not configured
"NVIDIA nForce2" rev 0xc1 at pci0 dev 0 function 5 not configured
pcib0 at pci0 dev 1 function 0 "NVIDIA nForce2 ISA" rev 0xa4
nviic0 at pci0 dev 1 function 1 "NVIDIA nForce2 SMBus" rev 0xa2
iic0 at nviic0
iic0: addr 0x4e 01=08 02=01 03=01 04=01 05=80 06=0b 07=00 08=00 09=00 0a=eb 0b=00 0c=00 0d=00 0e=00 0f=00 3e=08 48=08 4a=08 4e=08 f0=00 f1=00 f2=00 f3=00 f4=00 f5=00 f6=00 f7=00 f8=00 f9=00 fa=00 fb=00 fc=00 fd=00 fe=08 ff=00 words 00=28ff 01=08ff 02=01ff 03=01ff 04=01ff 05=80ff 06=0bff 07=00ff
spdmem0 at iic0 addr 0x50: 512MB DDR SDRAM non-parity PC3200CL3.0
spdmem1 at iic0 addr 0x51: 512MB DDR SDRAM non-parity PC2700CL2.5
spdmem2 at iic0 addr 0x52: 512MB DDR SDRAM non-parity PC3200CL2.5
iic1 at nviic0
ppb0 at pci0 dev 8 function 0 "NVIDIA nForce2 PCI-PCI" rev 0xa3
pci1 at ppb0 bus 1
pciide0 at pci1 dev 8 function 0 "Promise PDC40718" rev 0x02: DMA
wd0 at pciide0 channel 0 drive 0: <SAMSUNG HD753LJ>
wd0: 16-sector PIO, LBA48, 715404MB, 1465149168 sectors
wd0(pciide0:0:0): using BIOS timings, Ultra-DMA mode 7
wd1 at pciide0 channel 1 drive 0: <ST31500341AS>
wd1: 16-sector PIO, LBA48, 1430799MB, 2930277168 sectors
wd1(pciide0:1:0): using BIOS timings, Ultra-DMA mode 6
wd2 at pciide0 channel 2 drive 0: <SAMSUNG HD753LJ>
wd2: 16-sector PIO, LBA48, 715404MB, 1465149168 sectors
wd2(pciide0:2:0): using BIOS timings, Ultra-DMA mode 7
wd3 at pciide0 channel 3 drive 0: <SAMSUNG HD401LJ>
wd3: 16-sector PIO, LBA48, 381554MB, 781422768 sectors
wd3(pciide0:3:0): using BIOS timings, Ultra-DMA mode 7
pciide0: using irq 11 for native-PCI interrupt
em0 at pci1 dev 9 function 0 "Intel PRO/1000GT (82541GI)" rev 0x05: irq 10, address 00:1b:21:14:87:60
pciide1 at pci1 dev 11 function 0 "CMD Technology SiI3112 SATA" rev 0x02: DMA
pciide1: using irq 15 for native-PCI interrupt
pciide1: port 0: device present, speed: 1.5Gb/s
wd4 at pciide1 channel 0 drive 0: <SAMSUNG HD753LJ>
wd4: 16-sector PIO, LBA48, 715404MB, 1465149168 sectors
wd4(pciide1:0:0): using BIOS timings, Ultra-DMA mode 7
pciide1: port 1: device present, speed: 1.5Gb/s
wd5 at pciide1 channel 1 drive 0: <SAMSUNG HD401LJ>
wd5: 16-sector PIO, LBA48, 381554MB, 781422768 sectors
wd5(pciide1:1:0): using BIOS timings, Ultra-DMA mode 7
pciide2 at pci0 dev 9 function 0 "NVIDIA nForce2 IDE" rev 0xa2: DMA, channel 0 configured to compatibility, channel 1 configured to compatibility
pciide2: channel 0 ignored (disabled)
pciide2: channel 1 ignored (disabled)
ppb1 at pci0 dev 30 function 0 "NVIDIA nForce2 AGP" rev 0xc1
pci2 at ppb1 bus 2
vga1 at pci2 dev 0 function 0 "NVIDIA GeForce256 DDR" rev 0x10
wsdisplay0 at vga1 mux 1: console (80x25, vt100 emulation)
wsdisplay0: screen 1-5 added (80x25, vt100 emulation)
isa0 at pcib0
isadma0 at isa0
pckbc0 at isa0 port 0x60/5
pckbd0 at pckbc0 (kbd slot)
pckbc0: using irq 1 for kbd slot
wskbd0 at pckbd0: console keyboard, using wsdisplay0
pcppi0 at isa0 port 0x61
midi0 at pcppi0: <PC speaker>
spkr0 at pcppi0
wbsio0 at isa0 port 0x2e/2: W83627HF rev 0x17
lm1 at wbsio0 port 0x290/8: W83627HF
npx0 at isa0 port 0xf0/16: reported by CPUID; using exception 16
biomask fbfd netmask fffd ttymask ffff
mtrr: Pentium Pro MTRR support
softraid0 at root
root on wd3a swap on wd3b dump on wd3b

Last edited by vermaden; 14th September 2009 at 09:12 AM. Reason: Use [ code ] tag instead of [ quote ] for listings.
Reply With Quote
  #2   (View Single Post)  
Old 14th September 2009
vermaden's Avatar
vermaden vermaden is offline
Administrator
 
Join Date: Apr 2008
Location: pl_PL.lodz
Posts: 1,056
Default

If you want to make top(1) to be usefull for showing memory hog applications, use it like that: top -b -o res
__________________
religions, worst damnation of mankind
"If 386BSD had been available when I started on Linux, Linux would probably never had happened." Linus Torvalds

Linux is not UNIX! Face it! It is not an insult. It is fact: GNU is a recursive acronym for “GNU's Not UNIX”.
vermaden's: links resources deviantart spreadbsd
Reply With Quote
  #3   (View Single Post)  
Old 14th September 2009
knasbas knasbas is offline
Port Guard
 
Join Date: May 2008
Posts: 25
Default

Code:
[11:40:39][root@~$ top -b -o res
load averages:  0.18,  0.11,  0.09    11:40:42
32 processes:  31 idle, 1 on processor
CPU states:  0.5% user,  0.0% nice,  1.0% system,  0.6% interrupt, 97.9% idle
Memory: Real: 21M/1261M act/tot  Free: 243M  Swap: 16M/5120M used/tot

  PID USERNAME PRI NICE  SIZE   RES STATE    WAIT      TIME    CPU COMMAND
 6643 www        2    0 2928K 4180K idle     netcon    0:25  0.00% httpd
25336 www        2    0 3044K 4176K idle     netcon    0:15  0.00% httpd
18154 www        2    0 2916K 4176K idle     netcon    0:17  0.00% httpd
26836 www        2    0 2872K 4176K idle     netcon    0:16  0.00% httpd
31382 www        2    0 2868K 4176K idle     netcon    0:12  0.00% httpd
13111 www        2    0 2908K 4172K idle     netcon    0:13  0.00% httpd
 8605 www        2    0 2876K 4172K idle     netcon    0:13  0.00% httpd
 5756 root       2    0 3536K 2528K sleep    select    0:00  0.00% sshd
30210 root      10    0  936K 1576K sleep    wait      0:00  0.00% bash
23574 root       2    0 3176K 1192K idle     select    0:05  0.00% smbd
16326 www        2    0 2860K 1164K idle     netcon    0:21  0.00% httpd
20984 www        2    0 2948K 1160K idle     netcon    0:24  0.00% httpd
 5300 www        2    0 2872K 1152K idle     netcon    0:05  0.00% httpd
30822 root       2    0  964K 1112K sleep    select    0:29  0.00% sendmail
18432 root       2    0 1032K  892K sleep    select    0:12  0.00% nmbd
 4613 root      29    0  344K  872K onproc   -         0:00  0.00% top
 8432 _syslogd   2    0  476K  632K idle     poll      0:07  0.00% syslogd
 8915 root       2    0  468K  512K idle     select    0:01  0.00% cron

Last edited by vermaden; 14th September 2009 at 09:38 AM. Reason: Remember to use [ code ] tags for output ...
Reply With Quote
  #4   (View Single Post)  
Old 14th September 2009
J65nko J65nko is offline
Administrator
 
Join Date: May 2008
Location: Budel - the Netherlands
Posts: 4,128
Default

There is no problem, you still have 243 MB free memory.

Unused memory, is wasted so OpenBSD will use as much memory as it can for disk buffering.
If an application needs more RAM the disk buffer pool will be diminished.
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump
Reply With Quote
  #5   (View Single Post)  
Old 14th September 2009
Carpetsmoker's Avatar
Carpetsmoker Carpetsmoker is offline
Real Name: Martin
Tcpdump Spy
 
Join Date: Apr 2008
Location: Netherlands
Posts: 2,243
Default

Indeed, it is better to pay attention to swap space used:
Quote:
Swap: 16M/5120M used/tot
Only 16M is being used, the performance hit for this is very small.

See: swapctl(8)
__________________
UNIX was not designed to stop you from doing stupid things, because that would also stop you from doing clever things.
Reply With Quote
  #6   (View Single Post)  
Old 14th September 2009
knasbas knasbas is offline
Port Guard
 
Join Date: May 2008
Posts: 25
Default

But what is using the ram? If you check my second post it just doesnt add up? 1.5gb installed ram but those applications uses around 40mb but its still only 250mb free.
Reply With Quote
  #7   (View Single Post)  
Old 14th September 2009
BSDfan666 BSDfan666 is offline
Real Name: N/A, this is the interweb.
Banned
 
Join Date: Apr 2008
Location: Ontario, Canada
Posts: 2,223
Default

This is a common complaint from users, unfortunately it can be difficult explaining that memory is handled quite differently.. rest assured that if you have memory detected by OpenBSD, it won't be wasted.

Multiple "lists" exist in the kernel that track memory usage (..both physical and virtual), one of these is a list of "free" pages.. a page being 4096 bytes memory on most architectures.. memory that is immediately available to processes (..243 megabytes worth on your system).

As previously said, there are multiple lists.. it's more complicated then just "used memory" and "free memory", but the kernel is constantly updating all of these lists while using sophisticated heuristics to make sure the wheels keep turning.

The vmstat(1)/top(1) commands are useful at monitoring system resources, and the man pages do show you how to interpret the results.
Reply With Quote
  #8   (View Single Post)  
Old 14th September 2009
BSDfan666 BSDfan666 is offline
Real Name: N/A, this is the interweb.
Banned
 
Join Date: Apr 2008
Location: Ontario, Canada
Posts: 2,223
Default

While OpenBSD has drifted away from NetBSD and FreeBSD, resources available for those operating systems may be useful.

http://www.netbsd.org/docs/kernel/uvm.html
Reply With Quote
  #9   (View Single Post)  
Old 14th September 2009
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 7,977
Default

You may find the vmstat(1) utility helpful. See the -m option.
Reply With Quote
Old 14th September 2009
J65nko J65nko is offline
Administrator
 
Join Date: May 2008
Location: Budel - the Netherlands
Posts: 4,128
Default

Quote:
Originally Posted by knasbas View Post
But what is using the ram? If you check my second post it just doesnt add up? 1.5gb installed ram but those applications uses around 40mb but its still only 250mb free.
The kernel also uses memory, for example by the ffs filesystem
Code:
$ sysctl vfs | grep dirhash

vfs.ffs.dirhash_dirsize=2560
vfs.ffs.dirhash_maxmem=2097152
vfs.ffs.dirhash_mem=165590
Or receive/send buffer for TCP/UDP connections. From the output of sysctl net.inet
Code:
net.inet.tcp.recvspace=65536
net.inet.tcp.sendspace=16384
net.inet.udp.recvspace=41600
net.inet.udp.sendspace=9216
The actual usage can be queried
Code:
$ netstat -m
88 mbufs in use:
        65 mbufs allocated to data
        23 mbufs allocated to socket names and addresses
64/126/6144 mbuf 2048 byte clusters in use (current/peak/max)
0/8/6144 mbuf 4096 byte clusters in use (current/peak/max)
0/8/6144 mbuf 8192 byte clusters in use (current/peak/max)
0/8/6144 mbuf 9216 byte clusters in use (current/peak/max)
0/8/6144 mbuf 12288 byte clusters in use (current/peak/max)
0/8/6144 mbuf 16384 byte clusters in use (current/peak/max)
0/8/6144 mbuf 65536 byte clusters in use (current/peak/max)
488 Kbytes allocated to network (30% in use)
0 requests for memory denied
0 requests for memory delayed
0 calls to protocol drain routine
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump
Reply With Quote
Old 15th September 2009
BSDfan666 BSDfan666 is offline
Real Name: N/A, this is the interweb.
Banned
 
Join Date: Apr 2008
Location: Ontario, Canada
Posts: 2,223
Default

So after doing some more reading, I found a post on a NetBSD mailing list where Chuck Silvers explains how he renamed a few VM related sysctl's (..the old versions are still used by OpenBSD, max values are hard-coded defines.. no knobs).

http://mail-index.netbsd.org/tech-ke...2/08/0006.html

I also found an early optimization guide written for NetBSD, some of the principles.. except for UBC (..not yet in OpenBSD, but has been commits lately) may still apply.

http://www.selonen.org/arto/netbsd/

If I understand all of this sufficiently, the kernel behaves differently depending on how the system is being used.. adapting as it goes along.. the services that knasbas utilizes aren't demanding large amounts of memory, so the majority of available memory is being reserved for other things.

I don't pretend to understand it all, because it's complicated.. using the above optimization guide on OpenBSD is NOT recommended though, the defaults will most likely be quite adequate for your needs.

Good luck.
Reply With Quote
Old 26th September 2009
knasbas knasbas is offline
Port Guard
 
Join Date: May 2008
Posts: 25
Default

Thanks for answers!
Didnt figure out what was so consuming, it seemed like it was rtorrent, but now im back to "normal" usage and rtorrent is running...
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
no space left on drive while installing? knasbas OpenBSD Installation and Upgrading 2 20th July 2009 09:50 PM
left handed mouse techmarks FreeBSD General 2 2nd October 2008 10:17 PM


All times are GMT. The time now is 10:28 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick