linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Dan Magenheimer <dan.magenheimer@oracle.com>
To: Wanpeng Li <liwanp@linux.vnet.ibm.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Dan Magenheimer <dan.magenheimer@oracle.com>,
	Seth Jennings <sjenning@linux.vnet.ibm.com>,
	Konrad Rzeszutek Wilk <konrad@darnok.org>,
	Minchan Kim <minchan@kernel.org>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Bob Liu <bob.liu@oracle.com>
Subject: RE: [PATCH 02/10] staging: zcache: remove zcache_freeze
Date: Thu, 11 Apr 2013 10:13:42 -0700 (PDT)	[thread overview]
Message-ID: <ecb7519b-669a-48e4-b217-a77ecb60afd4@default> (raw)
In-Reply-To: <<1365553560-32258-3-git-send-email-liwanp@linux.vnet.ibm.com>>

> From: Wanpeng Li [mailto:liwanp@linux.vnet.ibm.com]
> Subject: [PATCH 02/10] staging: zcache: remove zcache_freeze
> 
> The default value of zcache_freeze is false and it won't be modified by
> other codes. Remove zcache_freeze since no routine can disable zcache
> during system running.
> 
> Signed-off-by: Wanpeng Li <liwanp@linux.vnet.ibm.com>

I'd prefer to leave this code in place as it may be very useful
if/when zcache becomes more tightly integrated into the MM subsystem
and the rest of the kernel.  And the subtleties for temporarily disabling
zcache (which is what zcache_freeze does) are non-obvious and
may cause data loss so if someone wants to add this functionality
back in later and don't have this piece of code, it may take
a lot of pain to get it working.

Usage example: All CPUs are fully saturated so it is questionable
whether spending CPU cycles for compression is wise.  Kernel
could disable zcache using zcache_freeze.  (Yes, a new entry point
would need to be added to enable/disable zcache_freeze.)

My two cents... others are welcome to override.

> ---
>  drivers/staging/zcache/zcache-main.c |   55 +++++++++++-----------------------
>  1 file changed, 18 insertions(+), 37 deletions(-)
> 
> diff --git a/drivers/staging/zcache/zcache-main.c b/drivers/staging/zcache/zcache-main.c
> index e23d814..fe6801a 100644
> --- a/drivers/staging/zcache/zcache-main.c
> +++ b/drivers/staging/zcache/zcache-main.c
> @@ -1118,15 +1118,6 @@ free_and_out:
>  #endif /* CONFIG_ZCACHE_WRITEBACK */
> 
>  /*
> - * When zcache is disabled ("frozen"), pools can be created and destroyed,
> - * but all puts (and thus all other operations that require memory allocation)
> - * must fail.  If zcache is unfrozen, accepts puts, then frozen again,
> - * data consistency requires all puts while frozen to be converted into
> - * flushes.
> - */
> -static bool zcache_freeze;
> -
> -/*
>   * This zcache shrinker interface reduces the number of ephemeral pageframes
>   * used by zcache to approximately the same as the total number of LRU_FILE
>   * pageframes in use, and now also reduces the number of persistent pageframes
> @@ -1221,44 +1212,34 @@ int zcache_put_page(int cli_id, int pool_id, struct tmem_oid *oidp,
>  {
>  	struct tmem_pool *pool;
>  	struct tmem_handle th;
> -	int ret = -1;
> +	int ret = 0;
>  	void *pampd = NULL;
> 
>  	BUG_ON(!irqs_disabled());
>  	pool = zcache_get_pool_by_id(cli_id, pool_id);
>  	if (unlikely(pool == NULL))
>  		goto out;
> -	if (!zcache_freeze) {
> -		ret = 0;
> -		th.client_id = cli_id;
> -		th.pool_id = pool_id;
> -		th.oid = *oidp;
> -		th.index = index;
> -		pampd = zcache_pampd_create((char *)page, size, raw,
> -				ephemeral, &th);
> -		if (pampd == NULL) {
> -			ret = -ENOMEM;
> -			if (ephemeral)
> -				inc_zcache_failed_eph_puts();
> -			else
> -				inc_zcache_failed_pers_puts();
> -		} else {
> -			if (ramster_enabled)
> -				ramster_do_preload_flnode(pool);
> -			ret = tmem_put(pool, oidp, index, 0, pampd);
> -			if (ret < 0)
> -				BUG();
> -		}
> -		zcache_put_pool(pool);
> +
> +	th.client_id = cli_id;
> +	th.pool_id = pool_id;
> +	th.oid = *oidp;
> +	th.index = index;
> +	pampd = zcache_pampd_create((char *)page, size, raw,
> +			ephemeral, &th);
> +	if (pampd == NULL) {
> +		ret = -ENOMEM;
> +		if (ephemeral)
> +			inc_zcache_failed_eph_puts();
> +		else
> +			inc_zcache_failed_pers_puts();
>  	} else {
> -		inc_zcache_put_to_flush();
>  		if (ramster_enabled)
>  			ramster_do_preload_flnode(pool);
> -		if (atomic_read(&pool->obj_count) > 0)
> -			/* the put fails whether the flush succeeds or not */
> -			(void)tmem_flush_page(pool, oidp, index);
> -		zcache_put_pool(pool);
> +		ret = tmem_put(pool, oidp, index, 0, pampd);
> +		if (ret < 0)
> +			BUG();
>  	}
> +	zcache_put_pool(pool);
>  out:
>  	return ret;
>  }
> --
> 1.7.10.4

--
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>

       reply	other threads:[~2013-04-11 17:14 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <<1365553560-32258-1-git-send-email-liwanp@linux.vnet.ibm.com>
     [not found] ` <<1365553560-32258-3-git-send-email-liwanp@linux.vnet.ibm.com>
2013-04-11 17:13   ` Dan Magenheimer [this message]
2013-04-11 20:05     ` [PATCH 02/10] staging: zcache: remove zcache_freeze Greg Kroah-Hartman
2013-04-11 23:22     ` Wanpeng Li
2013-04-11 23:22     ` Wanpeng Li
2013-04-11 17:17 ` [PATCH 00/10] staging: zcache/ramster: fix and ramster/debugfs improvement Dan Magenheimer
2013-04-11 23:20   ` Wanpeng Li
2013-04-11 23:20   ` Wanpeng Li
2013-04-10  0:25 Wanpeng Li
2013-04-10  0:25 ` [PATCH 01/10] staging: zcache: fix account foregin counters against zero-filled pages Wanpeng Li
2013-04-10  0:25 ` [PATCH 02/10] staging: zcache: remove zcache_freeze Wanpeng Li
2013-04-10  0:25 ` [PATCH 03/10] staging: ramster: Provide accessory functions for counter increase Wanpeng Li
2013-04-10  0:25 ` [PATCH 04/10] staging: ramster: Provide accessory functions for counter decrease Wanpeng Li
2013-04-10  0:25 ` [PATCH 05/10] staging: ramster: Move debugfs code out of ramster.c file Wanpeng Li
2013-04-11 20:04   ` Greg Kroah-Hartman
2013-04-11 23:27     ` Wanpeng Li
2013-04-11 23:27     ` Wanpeng Li
2013-04-10  0:25 ` [PATCH 06/10] staging: ramster/debug: Use an array to initialize/use debugfs attributes Wanpeng Li
2013-04-10  0:25 ` [PATCH 07/10] staging: ramster/debug: Add RAMSTER_DEBUG Kconfig entry Wanpeng Li
2013-04-10  0:25 ` [PATCH 08/10] staging: ramster: Add incremental accessory counters Wanpeng Li
2013-04-10  0:25 ` [PATCH 09/10] staging: zcache/debug: fix coding style Wanpeng Li
2013-04-10  0:26 ` [PATCH 10/10] staging: ramster: add how-to for ramster Wanpeng Li

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ecb7519b-669a-48e4-b217-a77ecb60afd4@default \
    --to=dan.magenheimer@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=bob.liu@oracle.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=konrad@darnok.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=liwanp@linux.vnet.ibm.com \
    --cc=minchan@kernel.org \
    --cc=sjenning@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).