All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steve Dickson <SteveD@redhat.com>
To: David Howells <dhowells@redhat.com>, linux-cachefs@redhat.com
Cc: linux-nfs@vger.kernel.org, neilb@suse.de,
	linux-fsdevel@vger.kernel.org, jlayton@poochiereds.net,
	jsnow@redhat.com
Subject: Re: [Linux-cachefs] [PATCH 1/2] cachefilesd can spin when disk space is short.
Date: Wed, 27 Jan 2016 11:03:34 -0500	[thread overview]
Message-ID: <56A8EA56.1020304@RedHat.com> (raw)
In-Reply-To: <20160125164930.9670.46763.stgit@warthog.procyon.org.uk>



On 01/25/2016 11:49 AM, David Howells wrote:
> From: NeilBrown <neilb@suse.de>
> 
> When cachefilesd finds that it needs to cull, but that culling doesn't
> achieve anything, it sets an alarm to wake it in 30 seconds to try again.
> But as read_cache_state() will detect that culling is still needed, it will
> immediately try again anyway.
> 
> This results in 100% cpu usage of no value.
> 
> This patch causes culling to be blocked until the 30 second alarm goes off.
> 
> It also changes the test to decide whether to enter poll() after blocking
> signals to test exactly those values that might be changed by a signal.
> Testing these is important, testing anything else is pointless.
> 
> Signed-off-by: NeilBrown <neilb@suse.de>
> Signed-off-by: David Howells <dhowells@redhat.com>
Reviewed-by: Steve Dickson <steved@redhat.com>

steved.

> ---
> 
>  cachefilesd.c |    9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/cachefilesd.c b/cachefilesd.c
> index 6658ba5..eaa1bb0 100644
> --- a/cachefilesd.c
> +++ b/cachefilesd.c
> @@ -99,6 +99,7 @@ static struct object **cullready;
>  static unsigned nr_in_build_table;
>  static unsigned nr_in_ready_table;
>  static int ncullable;
> +static bool cull_delayed;
>  
>  
>  static const char *configfile = "/etc/cachefilesd.conf";
> @@ -246,6 +247,7 @@ static void sigio(int sig)
>  static void sigalrm(int sig)
>  {
>  	jumpstart_scan = true;
> +	cull_delayed = false;
>  }
>  
>  /*****************************************************************************/
> @@ -613,11 +615,11 @@ static void cachefilesd(void)
>  
>  		/* sleep without racing on reap and cull with the signal
>  		 * handlers */
> -		if (!scan && !reap && !cull) {
> +		if (!scan && !reap && !(cull && !cull_delayed)) {
>  			if (sigprocmask(SIG_BLOCK, &sigs, &osigs) < 0)
>  				oserror("Unable to block signals");
>  
> -			if (!reap && !cull) {
> +			if (!reap && !stop && !jumpstart_scan) {
>  				if (ppoll(pollfds, 1, NULL, &osigs) < 0 &&
>  				    errno != EINTR)
>  					oserror("Unable to suspend process");
> @@ -644,7 +646,7 @@ static void cachefilesd(void)
>  			if (cull) {
>  				if (nr_in_ready_table > 0)
>  					cull_objects();
> -				else if (nr_in_build_table == 0)
> +				else if (nr_in_build_table == 0 && !cull_delayed)
>  					jumpstart_scan = true;
>  			}
>  
> @@ -1364,6 +1366,7 @@ static void decant_cull_table(void)
>  
>  	/* if nothing there, scan again in a short while */
>  	if (nr_in_build_table == 0) {
> +		cull_delayed = true;
>  		signal(SIGALRM, sigalrm);
>  		alarm(30);
>  		return;
> 

  reply	other threads:[~2016-01-27 16:03 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-25 16:41 [PATCH] CacheFiles: Provide read-and-reset release counters for cachefilesd David Howells
2016-01-25 16:49 ` [PATCH 1/2] cachefilesd can spin when disk space is short David Howells
2016-01-27 16:03   ` Steve Dickson [this message]
2016-02-01 22:53   ` [Linux-cachefs] " John Snow
2016-02-01 22:53     ` John Snow
2016-01-25 16:49 ` [PATCH 2/2] Suspend/resume culling based on recently released file/block counts David Howells
2016-01-27 16:03   ` [Linux-cachefs] " Steve Dickson
2016-02-01 23:29   ` John Snow
2016-02-03 14:01   ` David Howells
2016-02-03 16:30     ` John Snow
2016-01-27 16:39 ` [Linux-cachefs] [PATCH] CacheFiles: Provide read-and-reset release counters for cachefilesd Steve Dickson

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=56A8EA56.1020304@RedHat.com \
    --to=steved@redhat.com \
    --cc=dhowells@redhat.com \
    --cc=jlayton@poochiereds.net \
    --cc=jsnow@redhat.com \
    --cc=linux-cachefs@redhat.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=neilb@suse.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.