[lkml]   [2013]   [Nov]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[Patch 3.11.7 1/1]mm: remove and free expired data in time in zswap
In zswap, store page A to zbud if the compression ratio is high, insert
its entry into rbtree. if there is a entry B which has the same offset
in the rbtree.Remove and free B before insert the entry of A.

if the compression ratio of page A is not high, return without checking
the same offset one in rbtree.

if there is a entry B which has the same offset in the rbtree. Now, we
make sure B is invalid or expired. But the entry and compressed memory
of B are not freed in time.

Because zswap spaces data in memory, it makes the utilization of memory
lower. the other valid data in zbud is writeback to swap device more
possibility, when zswap is full.

So if we make sure a entry is expired, free it in time.

mm/zswap.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/mm/zswap.c b/mm/zswap.c
index cbd9578..90a2813 100644
--- a/mm/zswap.c
+++ b/mm/zswap.c
@@ -596,6 +596,7 @@ fail:
return ret;

+static void zswap_frontswap_invalidate_page(unsigned type, pgoff_t
* frontswap hooks
@@ -614,7 +615,7 @@ static int zswap_frontswap_store(unsigned type,
pgoff_t offset,

if (!tree) {
ret = -ENODEV;
- goto reject;
+ goto nodev;

/* reclaim space if needed */
@@ -695,6 +696,8 @@ freepage:
+ zswap_frontswap_invalidate_page(type, offset);
return ret;


 \ /
  Last update: 2013-11-08 11:01    [W:1.425 / U:0.004 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site