forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
zram:calculate available memory when zram is used
When zram is used, available+Swap free memory is obviously bigger than we actually can use, because zram can compress memory by compression algorithm and zram compressed data will occupy memory too. So, we can count the compression ratio of zram in the kernel. The space will be saved by zram and other swap device are calculated as follows: zram[swapfree - swapfree * compress ratio] + swapdev[swapfree] We can evaluate the available memory of the whole system as: MemAvailable+zram[swapfree - swapfree * compress ratio]+swapdev[swapfree] Add an entry to the /proc/meminfo file, returns swap will save space. Which name is more appropriate is still under consideration. There are several alternative names: SwapAvailable, SwapSaved, SwapCompressible Signed-off-by: wangyong <yongw.pur@gmail.com>
- Loading branch information
1 parent
808d854
commit 0c03fad
Showing
7 changed files
with
128 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters