linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] zcache: Support zero-filled pages more efficiently
@ 2013-03-13  7:05 Wanpeng Li
  2013-03-13  7:05 ` [PATCH 1/4] zcache: introduce zero-filled pages handler Wanpeng Li
                   ` (3 more replies)
  0 siblings, 4 replies; 14+ messages in thread
From: Wanpeng Li @ 2013-03-13  7:05 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Greg Kroah-Hartman, Dan Magenheimer, Seth Jennings,
	Konrad Rzeszutek Wilk, Minchan Kim, linux-mm, linux-kernel,
	Wanpeng Li

Motivation:

- Seth Jennings points out compress zero-filled pages with LZO(a lossless 
  data compression algorithm) will waste memory and result in fragmentation.
  https://lkml.org/lkml/2012/8/14/347
- Dan Magenheimer add "Support zero-filled pages more efficiently" feature 
  in zcache TODO list https://lkml.org/lkml/2013/2/13/503

Design:

- For store page, capture zero-filled pages(evicted clean page cache pages and 
  swap pages), but don't compress them, set pampd which store zpage address to
  0x2(since 0x0 and 0x1 has already been ocuppied) to mark special zero-filled
  case and take advantage of tmem infrastructure to transform handle-tuple(pool
  id, object id, and an index) to a pampd. Twice compress zero-filled pages will
  contribute to one zcache_[eph|pers]_pageframes count accumulated.
- For load page, traverse tmem hierachical to transform handle-tuple to pampd 
  and identify zero-filled case by pampd equal to 0x2 when filesystem reads
  file pages or a page needs to be swapped in, then refill the page to zero
  and return.

Test:

dd if=/dev/zero of=zerofile bs=1MB count=500
vmtouch -t zerofile
vmtouch -e zerofile

formula:
- fragmentation level = (zcache_[eph|pers]_pageframes * PAGE_SIZE - zcache_[eph|pers]_zbytes) 
  * 100 / (zcache_[eph|pers]_pageframes * PAGE_SIZE)
- memory zcache occupy = zcache_[eph|pers]_zbytes 

Result:

without zero-filled awareness:
- fragmentation level: 98%
- memory zcache occupy: 238MB
with zero-filled awareness:
- fragmentation level: 0%
- memory zcache occupy: 0MB

Wanpeng Li (4):
  introduce zero-filled pages handler
  zero-filled pages awareness
  introduce zero-filled pages stat count
  add pageframes count once compress zero-filled pages twice

 drivers/staging/zcache/tmem.c        |    4 +-
 drivers/staging/zcache/tmem.h        |    5 +
 drivers/staging/zcache/zcache-main.c |  141 +++++++++++++++++++++++++++++++---
 3 files changed, 139 insertions(+), 11 deletions(-)

-- 
1.7.7.6

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 14+ messages in thread
[parent not found: <<1363158321-20790-1-git-send-email-liwanp@linux.vnet.ibm.com>]

end of thread, other threads:[~2013-03-14 23:42 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-13  7:05 [PATCH 0/4] zcache: Support zero-filled pages more efficiently Wanpeng Li
2013-03-13  7:05 ` [PATCH 1/4] zcache: introduce zero-filled pages handler Wanpeng Li
2013-03-13  7:05 ` [PATCH 2/4] zcache: zero-filled pages awareness Wanpeng Li
2013-03-13  7:05 ` [PATCH 3/4] zcache: introduce zero-filled pages stat count Wanpeng Li
2013-03-13  7:05 ` [PATCH 4/4] zcache: add pageframes count once compress zero-filled pages twice Wanpeng Li
     [not found] <<1363158321-20790-1-git-send-email-liwanp@linux.vnet.ibm.com>
     [not found] ` <<1363158321-20790-5-git-send-email-liwanp@linux.vnet.ibm.com>
2013-03-13 16:42   ` Dan Magenheimer
2013-03-14  0:20     ` Wanpeng Li
2013-03-14  0:20     ` Wanpeng Li
2013-03-14 16:10       ` Dan Magenheimer
2013-03-14 23:41         ` Wanpeng Li
2013-03-14 23:41         ` Wanpeng Li
     [not found] ` <<1363158321-20790-3-git-send-email-liwanp@linux.vnet.ibm.com>
2013-03-13 16:53   ` [PATCH 2/4] zcache: zero-filled pages awareness Dan Magenheimer
2013-03-13 23:35     ` Wanpeng Li
2013-03-13 23:35     ` Wanpeng Li

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).