mksquashfs: This really is the release

Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
unsquashfs: This really is the release

Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
mksquashfs: fix phys mem calculation for 32-bit processes on PAE/64-bit kernels

When adding the code to base default memory usage on physical memory
(by default use 25% of physical memory), I made an oversight.  I assumed
the process would be able to address 25% of physical memory.

However, for 32-bit processes running on a PAE kernel or 64-bit kernel,
25% of physical memory can easily exceed the addressible memory for a
32-bit process, e.g. if a machine has 24 GB of physical memory, the
code would asume the process could easily use 6 GB.

A 32-bit process by definition can only address 4 GB (32-bit pointers).
But, due to the typical kernel/user-space split (1GB/3GB, or 2GB/2GB)
on PAE kernels, a 32-bit process may only be able to address 2 GB.

So, if Mksquashfs is a 32-bit application running on a PAE/64-bit kernel,
the code assumes it can address much more memory than it really can, which
means it runs out of memory.

The fix is to impose a maximum default limit on 32-bit kernels, or
otherwise to never use a value more than 25% of the address space.  If
we assume the maximum address space is 2 GB, then the maximum becomes
512 MB.  But, given most kernels used the 1GB/3GB split, that may be
unduely conservative, and 25% of 3 GB (756 MB) may be better.  This
patch compromises on 640 MB, which is mid-way between the 512 MB and 756 MB
values.  It is also the fixed default value previously used by Mksquashfs.

This patch also alters the code which imposes a maximum size.  Previously
it was believed limiting to the physical memory size was adequate.  But
obviously this needs to be updated to take into account a 32-bit process
may only be able to address 2 GB.  In the process I've also taken the
opportunity to limit all requests to no more than 75% of physical memory.

Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>