[OE-core] The swap partition's size is too big for BSP?

Cui, Dexuan dexuan.cui at intel.com
Mon Jul 4 12:02:04 UTC 2011


Richard Purdie wrote:
> On Mon, 2011-07-04 at 13:35 +0800, Cui, Dexuan wrote:
>> In meta/recipes-core/initrdscripts/files/init-install.sh, we have
>> 
>> # 5% for the swap
>> swap_ratio=5               # dexuan: this variable is not used at
>> all! ... 
>> swap_size=$((disk_size*5/100))
>> 
>> This algorithm seems too wasty -- e.g., for a CrownBay box with a
>> 160GB disk, we would create a 8GB swap partition while the box has
>> only 1GB memory.  
>> 
>> What's the proper swap size?
>> This link http://www.cyberciti.biz/tips/linux-swap-space.html
>> discussed this and I think the below algorithm seems suitable for
>> us:  
>> 
>> Systems with 2GB of ram or less require the same size of swap space
>> Systems with 2GB to 4GB of ram require a minimum of 2GB of swap space
>> Systems with 4GB to 16GB of ram require a minimum of 4GB of swap
>> space 
>> Systems with 16GB to 64GB of ram require a minimum of 8GB of swap
>> space 
>> Systems with 64GB to 256GB of ram require a minimum of 16GB of swap
>> space 
>> 
>> Any comment?
> 
> Looks like a much better idea to me, I'll take patches :)
Ok, I'll try to make a patch for this algorithm.

> For reference if you want to do suspend to disk (swap) you need a lot
> of swap space btw. Still no where near that much though!
Does (or should )Yocto Linux support suspend-to-disk? I'm not sure about this.
BTW: Linux can alse use a regular file as swap area.
So in case the swap size is not enough (e.g., for suspend-to-disk), I think a user could create a big enough file  to meet the need (I didn't test this with Linux yet).

Thanks,
-- Dexuan



More information about the Openembedded-core mailing list