[haiku-bugs] Re: [Haiku] #7742: SWAP file constantly recreated, takes up alot of space
- From: "axeld" <trac@xxxxxxxxxxxx>
- Date: Tue, 04 Sep 2012 19:28:16 -0000
#7742: SWAP file constantly recreated, takes up alot of space
-----------------------------------------+----------------------------
Reporter: Cypress | Owner: axeld
Type: bug | Status: closed
Priority: normal | Milestone: R1/alpha4
Component: Preferences/VirtualMemory | Version: R1/Development
Resolution: fixed | Keywords:
Blocked By: | Blocking:
Has a Patch: 1 | Platform: All
-----------------------------------------+----------------------------
Comment (by axeld):
A few comments:
{{{
+ if (swapAutomatic) {
+ swapEnabled = true;
+ swapSize = (off_t)vm_page_num_pages() * B_PAGE_SIZE * 2;
+ }
}}}
I would make the default size dependent on the size of memory: if < 1GB *2
is fine, above that, I would think that the same amount as the amount of
memory is sufficient.
{{{
+ off_t maxSwap = freeSpace;
+ if (swapAutomatic) {
+ // Adjust automatic swap to a maximum of 25% of the free
space
+ maxSwap = (off_t)(0.25 * freeSpace);
} else {
- size = (off_t)vm_page_num_pages() * B_PAGE_SIZE * 2;
+ // If user specified, leave 10% of the disk free
+ maxSwap = freeSpace - (off_t)(0.10 * freeSpace);
+ dprintf("%s: Warning: User specified swap file consumes
over 90%% of "
+ "the available free space, limiting to 90%%\n",
__func__);
}
}}}
If you don't absolutely need floating point computation, don't use it in
the kernel. In this case /4 respectively /10 should do the trick here.
--
Ticket URL: <http://dev.haiku-os.org/ticket/7742#comment:15>
Haiku <http://dev.haiku-os.org>
Haiku - the operating system.
Other related posts:
- » [haiku-bugs] [Haiku] #7742: SWAP file constantly recreated, takes up alot of space- Cypress
- » [haiku-bugs] Re: [Haiku] #7742: SWAP file constantly recreated, takes up alot of space- mmlr
- » [haiku-bugs] Re: [Haiku] #7742: SWAP file constantly recreated, takes up alot of space- kallisti5
- » [haiku-bugs] Re: [Haiku] #7742: SWAP file constantly recreated, takes up alot of space- kallisti5
- » [haiku-bugs] Re: [Haiku] #7742: SWAP file constantly recreated, takes up alot of space- leavengood
- » [haiku-bugs] Re: [Haiku] #7742: SWAP file constantly recreated, takes up alot of space- kallisti5
- » [haiku-bugs] [Haiku] #7742: SWAP file constantly recreated, takes up alot of space- kallisti5
- » [haiku-bugs] Re: [Haiku] #7742: SWAP file constantly recreated, takes up alot of space- axeld
- » [haiku-bugs] Re: [Haiku] #7742: SWAP file constantly recreated, takes up alot of space- axeld
- » [haiku-bugs] Re: [Haiku] #7742: SWAP file constantly recreated, takes up alot of space- kallisti5
- » [haiku-bugs] Re: [Haiku] #7742: SWAP file constantly recreated, takes up alot of space- kallisti5
- » [haiku-bugs] Re: [Haiku] #7742: SWAP file constantly recreated, takes up alot of space- kallisti5
- » [haiku-bugs] Re: [Haiku] #7742: SWAP file constantly recreated, takes up alot of space- kallisti5
- » [haiku-bugs] Re: [Haiku] #7742: SWAP file constantly recreated, takes up alot of space- kallisti5
- » [haiku-bugs] [Haiku] #7742: SWAP file constantly recreated, takes up alot of space- kallisti5
- » [haiku-bugs] Re: [Haiku] #7742: SWAP file constantly recreated, takes up alot of space- kallisti5
- » [haiku-bugs] Re: [Haiku] #7742: SWAP file constantly recreated, takes up alot of space - axeld
- » [haiku-bugs] Re: [Haiku] #7742: SWAP file constantly recreated, takes up alot of space- axeld
- » [haiku-bugs] Re: [Haiku] #7742: SWAP file constantly recreated, takes up alot of space- kallisti5
- » [haiku-bugs] Re: [Haiku] #7742: SWAP file constantly recreated, takes up alot of space- kallisti5
- » [haiku-bugs] [Haiku] #7742: SWAP file constantly recreated, takes up alot of space- kallisti5
- » [haiku-bugs] Re: [Haiku] #7742: SWAP file constantly recreated, takes up alot of space- kallisti5