Putting a limit on
/tmp size if it is mounted as
tmpfs is to prevent the DOS attack. If one service was compromised or one user malicious they could simply write to
/tmp until all of the swap and memory would be occupied.
Since the OOM condition does not apply to files the processes would be killed until the malicious user shell would be killed (and he would not be able to log in due to lack of memory) or the compromised service would be killed. At this stage the system would be too slow for administrator to actually do anything other then restart, which would wipe the evidence thus making it effective DOS technique.
/tmp as separate mount then a slightly different problems would happened. Making the
/ partition full may render system unbootable and in very bad situation (say a glibc update) it may require much more repairing.
While those problems can be significant for multi-system there is also a reason to prevent it for desktop users. For example I had once used a program which tried to write several GB of files in times when 512 MiB was large amount of RAM, which would render system unusably had the
tmpfs been unlimited. In such way it only cause problems for the program itself and others trying to write to
50% of RAM for tmpsfs allows to use 50% of RAM for other things like running programs thus preventing the large swapping. Since it is generally assumed that minimal amount of information is kept there (41M on my system), but it needs to be quickly accessible is the reason of using tmpfs in the first place (no need to preserve it accross reboots is enabling it). Thus 50% is 'reasonable' to both having large slack in case a peak
/tmp usage happens while at the same time preventing the system slowdown.
As mentioned by abdelsaid you can change the settings in
none /tmp tmpfs size=2G 0 0 # Change the size= parameter to whatever you want
PS. Where are you trying to compile the kernels (in
/tmp)? Usually you compile them with user rights AND save the results in case you need 3rd party modules etc. gcc should keep minimal amount of files on
/tmp thus avoiding the whole problem.
Once you use 4 GB of
/tmp on 4GB system it is possible (especially when you are using heavyweight desktop environment) that your system will slow down significantly.