psubuntu logo

PSUbuntu Wiki : PSUbuntuGPU

HomePage :: Categories :: PageIndex :: RecentChanges :: RecentlyCommented :: Login/Register

Using the PS3 GPU as swap


Note: this will only work with kernel 2.6.28+, This kernel is included with Ubuntu version 9.04, consider upgrading your Ubuntu or
compiling your own kernel

Recently, Gregford posted a guide to use the ps3 vram as swap, this can increase the performance of Ubuntu on your PS3 quite a lot, as the vram is faster than the harddrive. You can find the original guide here.



Enabling ps3vram

Open up a terminal window
run the following commands:

sudo mkswap /dev/ps3vram
sudo swapon -p1 /dev/ps3vram


swapon -p1 means sets the priority higher than the hard drive swap, so Ubuntu will leave the hard drive alone until all other memory is used.

Now lets see if that worked by using another command:
swapon -s

The result should be simmilar to this:

greg@Playstation3:~$ swapon -s
Filename Type Size UsedPriority
/dev/ps3da5 partition 489940 97140 -1 <-- Hard drive swap
/dev/ps3vram partition 250872 12241
<-- Vram swap



Mounting the swap at boot (Ubuntu 9.04)

You might already have noticed that as soon as you reboot your system your precious vram swap is gone, don't worry there's a solution to that. By slightly modifying a post made by JMS that can be found here.

Open a terminal window
Note: instead of "gedit" you can use "nano", I prefer gedit as you can place the cursor where you want to type instead of using the arrow keys. You can install gedit by running the following command "sudo apt-get install gedit"

sudo gedit /etc/modules
add "ps3vram" at the end of the file

save the file and get back to the terminal
sudo gedit /etc/init.d/bootmisc.sh
scroll untill you see these lines of code:

# Don't run bootclean again after this!
rm -f /tmp/.clean /var/run/.clean /var/lock/.clean
}


Now by adding the following:
mkswap /dev/ps3vram
swapon -p 1 /dev/ps3vram


make it look like:

# Don't run bootclean again after this!
rm -f /tmp/.clean /var/run/.clean /var/lock/.clean

mkswap /dev/ps3vram
swapon -p 1 /dev/ps3vram


Again save the file and reboot your system.
When you're back go to "System > System monitor" and check your swap, it should be boosted to 722MB!

Again, credits go to Gregford and JMS.

Mounting the swap at boot (Ubuntu 9.10)


Open a terminal window
Note: instead of "gedit" you can use "nano", I prefer gedit as you can place the cursor where you want to type instead of using the arrow keys. You can install gedit by running the following command "sudo apt-get install gedit"

sudo gedit /etc/modules
add "ps3vram" at the end of the file

save the file and get back to the terminal
sudo gedit /etc/rc.local
scroll untill you see these lines of code:

exit 0

Before add the following:
mkswap /dev/ps3vram
swapon -p 1 /dev/ps3vram


Save the file and reboot your system.
When you're back go to "System > System monitor" and check your swap, it should be boosted to 722MB!

Credits go to Civilian http://psubuntu.com/forums/viewtopic.php?p=8227#p8227

Alternative way of mounting the swap at boot using Udev (Ubuntu 9.10)


If the above described way turns out not to work for you, you might want to give this alternative way using Udev a try:

With your favourite text editor, create a file called 10-ps3vram-swap.rules in the directory /etc/udev/rules.d (i.e. with vi):

sudo vi /etc/udev/rules.d/10-ps3vram-swap.rules

Sudo will probably ask you for your password.

Go to insert mode with i and add the following line (selected text can be pasted into vi with the middle mouse button):

KERNEL=="ps3vram", ACTION=="add", RUN+="/sbin/mkswap /dev/ps3vram", RUN+="/sbin/swapon -p 10 /dev/ps3vram"

Save the file with ESC, then :x, then ENTER.

Reboot your PS3 and check with the command swapon -s if the VRAM has been correctly added as swap. It should look something like this:

dode@PS3:~# swapon -s
Filename                                Type         Size      Used      Priority
/dev/ps3da5                             partition    497972    0         -1
/dev/ps3vram                            partition    250872    128336    10

The output shows that 128 MB of the VRAM swap are used while the harddisk swap has not yet been used since it has a lower priority.

The above info has been taken from the Gentoo Linux Wiki (thanks to one of the comments on this page)
Note that the entry in /etc/fstab mentioned there is redundant (job already done by swapon) and causes "device busy" errors at boot time.

There are 30 comments on this page. [Display comments]

Valid XHTML 1.0 Transitional :: Valid CSS :: Powered by WikkaWiki
Page was generated in 0.1750 seconds