linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: John Snow <jsnow@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
Subject: Re: [Linux-cachefs] [PATCH 1/2] cachefilesd can spin when disk space is short.
Date: Mon, 1 Feb 2016 17:53:22 -0500	[thread overview]
Message-ID: <56AFE1E2.9060203@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: John Snow <jsnow@redhat.com>

> ---
> 
>  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;
> 
> --
> Linux-cachefs mailing list
> Linux-cachefs@redhat.com
> https://www.redhat.com/mailman/listinfo/linux-cachefs
> 

-- 
�js

  parent reply	other threads:[~2016-02-01 22:53 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20160125164111.9466.79976.stgit@warthog.procyon.org.uk>
2016-01-25 16:49 ` [PATCH 1/2] cachefilesd can spin when disk space is short David Howells
2016-01-27 16:03   ` [Linux-cachefs] " Steve Dickson
2016-02-01 22:53   ` John Snow [this message]
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

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=56AFE1E2.9060203@redhat.com \
    --to=jsnow@redhat.com \
    --cc=dhowells@redhat.com \
    --cc=jlayton@poochiereds.net \
    --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 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).