lkml.org 
[lkml]   [2013]   [Mar]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRE: [PATCH 2/4] zcache: zero-filled pages awareness
> From: Wanpeng Li [mailto:liwanp@linux.vnet.ibm.com]
> Subject: [PATCH 2/4] zcache: zero-filled pages awareness
>
> Compression of zero-filled pages can unneccessarily cause internal
> fragmentation, and thus waste memory. This special case can be
> optimized.
>
> This patch captures zero-filled pages, and marks their corresponding
> zcache backing page entry as zero-filled. Whenever such zero-filled
> page is retrieved, we fill the page frame with zero.
>
> Signed-off-by: Wanpeng Li <liwanp@linux.vnet.ibm.com>
> ---
> drivers/staging/zcache/tmem.c | 4 +-
> drivers/staging/zcache/tmem.h | 5 ++
> drivers/staging/zcache/zcache-main.c | 87 ++++++++++++++++++++++++++++++----
> 3 files changed, 85 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/staging/zcache/tmem.c b/drivers/staging/zcache/tmem.c
> index a2b7e03..62468ea 100644
> --- a/drivers/staging/zcache/tmem.c
> +++ b/drivers/staging/zcache/tmem.c
> @@ -597,7 +597,9 @@ int tmem_put(struct tmem_pool *pool, struct tmem_oid *oidp, uint32_t index,
> if (unlikely(ret == -ENOMEM))
> /* may have partially built objnode tree ("stump") */
> goto delete_and_free;
> - (*tmem_pamops.create_finish)(pampd, is_ephemeral(pool));
> + if (pampd != (void *)ZERO_FILLED)
> + (*tmem_pamops.create_finish)(pampd, is_ephemeral(pool));
> +
> goto out;
>
> delete_and_free:
> diff --git a/drivers/staging/zcache/tmem.h b/drivers/staging/zcache/tmem.h
> index adbe5a8..6719dbd 100644
> --- a/drivers/staging/zcache/tmem.h
> +++ b/drivers/staging/zcache/tmem.h
> @@ -204,6 +204,11 @@ struct tmem_handle {
> uint16_t client_id;
> };
>
> +/*
> + * mark pampd to special vaule in order that later
> + * retrieve will identify zero-filled pages
> + */
> +#define ZERO_FILLED 0x2

You can avoid changing tmem.[ch] entirely by moving this
definition into zcache-main.c and by moving the check
comparing pampd against ZERO_FILLED into zcache_pampd_create_finish()
I think that would be cleaner...

If you change this and make the pageframe counter fix for PATCH 4/4,
please add my ack for the next version:

Acked-by: Dan Magenheimer <dan.magenheimer@oracle.com>



\
 
 \ /
  Last update: 2013-03-13 18:41    [W:0.108 / U:0.012 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site