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 15th April 2012
raindog308 raindog308 is offline
Port Guard
 
Join Date: Sep 2011
Posts: 28
Thanked 0 Times in 0 Posts
Default How much memory can I save by configging a kernel?

I'm running OpenBSD 5.0 in a KVM VPS. The VPS has 128MB of memory.

I'd like to squeeze as much RAM out of the kernel as possible to free memory. I've already turned off services I don't use.

I'm wondering if I'm wasting my time or if I would be able to actually recover a usable amount. If I'm likely to free 50K, I won't bother. If it might free 5MB, I'll give it a shot.

The VPS is only using one NIC, for example, has no audio, etc.


Code:
OpenBSD 5.0 (GENERIC) #43: Wed Aug 17 10:10:52 MDT 2011
    deraadt@i386.openbsd.org:/usr/src/sys/arch/i386/compile/GENERIC
cpu0: QEMU Virtual CPU version (cpu64-rhel6) ("GenuineIntel" 686-class) 3.40 GHz
cpu0: FPU,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,MTRR,PGE,MCA,CMOV,PSE36,CFLUSH,MMX,FXSR,SSE,SSE2,SSE3,CX16
real mem  = 133742592 (127MB)
avail mem = 121569280 (115MB)
Reply With Quote
  #2   (View Single Post)  
Old 15th April 2012
ocicat ocicat is offline
Administrator
 
Join Date: Apr 2008
Posts: 2,873
Thanked 190 Times in 160 Posts
Default

Quote:
Originally Posted by raindog308 View Post
I'm wondering if I'm wasting my time or if I would be able to actually recover a usable amount. If I'm likely to free 50K, I won't bother. If it might free 5MB, I'll give it a shot.
I don't believe you would save gigabytes of space, possibly not even one. Traffic in the misc@ archives will say the same.

Culturally, the project severely frowns upon kernel squeezing & customization (covered in Section 5.6 of the FAQ...) to the point that the developers will not even talk to anyone filing problem reports using custom kernels.

Unless you are intimately knowledgeable about kernel internals is this worth the effort. Personally, I wouldn't bother. It goes too far against the project's recommendations, & I have found that the project's dictates are well grounded.
Reply With Quote
  #3   (View Single Post)  
Old 15th April 2012
raindog308 raindog308 is offline
Port Guard
 
Join Date: Sep 2011
Posts: 28
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by ocicat View Post
I don't believe you would save gigabytes of space, possibly not even one.
Definitely true, since the VPS only has 128MB of memory :-)

I wasn't talking about building a custom kernel, just using config to change GENERIC.

Quote:
Originally Posted by ocicat View Post
Unless you are intimately knowledgeable about kernel internals is this worth the effort. Personally, I wouldn't bother. It goes too far against the project's recommendations, & I have found that the project's dictates are well grounded.
No, I'm not an expert. Your advice is well spoken. It looks to me like the kernel takes 12MB:

Code:
real mem  = 133742592 (127MB)
avail mem = 121569280 (115MB)
Not sure how much it could actually shrink by, so it may not be worth the effort.
Reply With Quote
  #4   (View Single Post)  
Old 15th April 2012
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 3,608
Thanked 214 Times in 189 Posts
Default

That's not kernel space consumption, that's video memory. The 5.0-release, uniprocessor i386 kernel consumes just under 9MB.

Using config(8) to disable drivers will save no RAM whatsoever; they are statically linked within the monolithic kernel.

Last edited by jggimi; 15th April 2012 at 10:12 PM. Reason: typo
Reply With Quote
  #5   (View Single Post)  
Old 15th April 2012
raindog308 raindog308 is offline
Port Guard
 
Join Date: Sep 2011
Posts: 28
Thanked 0 Times in 0 Posts
Default

I'm not sure I understand you about video memory.

That message about memory happens very early in boot:

Code:
rebooting...
OpenBSD 5.0 (GENERIC) #43: Wed Aug 17 10:10:52 MDT 2011
    deraadt@i386.openbsd.org:/usr/src/sys/arch/i386/compile/GENERIC
cpu0: QEMU Virtual CPU version (cpu64-rhel6) ("GenuineIntel" 686-class) 3.70 GHz
cpu0: FPU,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,MTRR,PGE,MCA,CMOV,PSE36,CFLUSH,MMX,FXSR,SSE,SSE2,SSE3,CX16
real mem  = 133742592 (127MB)
avail mem = 121569280 (115MB)
mainbus0 at root
The video is mentioned later:

Code:
vga1 at pci0 dev 2 function 0 "Cirrus Logic CL-GD5446" rev 0x00
wsdisplay0 at vga1 mux 1: console (80x25, vt100 emulation)
wsdisplay0: screen 1-5 added (80x25, vt100 emulation)
The 5.0 release uniprocessor kernel is just under 9MB as you suggest:

Code:
-rw-r--r--   1 root  wheel  8948527 Apr 14 22:58 bsd
But doesn't the kernel also take some space for its data structures, etc.?

Is there a command to see how much memory the running kernel uses? More for curiosity than anything else.
Reply With Quote
  #6   (View Single Post)  
Old 16th April 2012
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 3,608
Thanked 214 Times in 189 Posts
Default

The shared memory window used by your video card is the 12mb that have been reserved by the BIOS.

As for dynamic buffers consumed by the kernel, check systat(8), it tracks kernel malloc activity several different ways.
Reply With Quote
  #7   (View Single Post)  
Old 17th May 2012
tehsean tehsean is offline
Custom User
 
Join Date: Aug 2010
Posts: 22
Thanked 1 Time in 1 Post
Default

Quote:
Originally Posted by jggimi View Post
That's not kernel space consumption, that's video memory. The 5.0-release, uniprocessor i386 kernel consumes just under 9MB.

Using config(8) to disable drivers will save no RAM whatsoever; they are statically linked within the monolithic kernel.
And FWIW, I attempted to get OpenBSD 4.8 or 4.9 (can't recall) running on a machine with 20MB ram with a GENERIC modified kernel config. I got down to about 6MB but that was cutting out all of the USB / BT / anything relevant in the last 10 years of computer hardware.

In the end it worked but I had some issues with PCMCIA cards that I think may have been related to my 'choices'.
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
Kernel memory usage LightBit FreeBSD General 1 19th February 2012 12:33 AM
save entropy problem map7 FreeBSD General 1 30th August 2010 06:47 AM
PLEASE HELP SAVE BSD MAGAZINE Kruzer Off-Topic 14 27th August 2009 05:10 PM
how to save stackoverflow podcasts? ephemera Off-Topic 4 19th July 2009 03:32 PM
Doing a fresh install - what to save? Bruco FreeBSD General 4 30th May 2009 01:49 PM


All times are GMT. The time now is 12:22 AM.


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