All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Dave Chinner <david@fromorbit.com>
Cc: riel@redhat.com,
	Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>,
	linux-kernel@vger.kernel.org, xfs@oss.sgi.com,
	kosaki.motohiro@jp.fujitsu.com, fengguang.wu@intel.com,
	kamezawa.hiroyu@jp.fujitsu.com
Subject: Re: [PATCH] mm/vmscan: Do not block forever at shrink_inactive_list().
Date: Mon, 19 May 2014 22:59:15 -0700	[thread overview]
Message-ID: <20140519225915.3370328d.akpm@linux-foundation.org> (raw)
In-Reply-To: <20140520004449.GE18954@dastard>

On Tue, 20 May 2014 10:44:49 +1000 Dave Chinner <david@fromorbit.com> wrote:

> @@ -258,14 +258,23 @@ xfs_bmapi_allocate_worker(
>  	struct xfs_bmalloca	*args = container_of(work,
>  						struct xfs_bmalloca, work);
>  	unsigned long		pflags;
> +	unsigned long		new_pflags = PF_FSTRANS;
>  
> -	/* we are in a transaction context here */
> -	current_set_flags_nested(&pflags, PF_FSTRANS);
> +	/*
> +	 * we are in a transaction context here, but may also be doing work
> +	 * in kswapd context, and hence we may need to inherit that state
> +	 * temporarily to ensure that we don't block waiting for memory reclaim
> +	 * in any way.
> +	 */
> +	if (args->kswapd)
> +		new_pflags |= PF_MEMALLOC | PF_SWAPWRITE | PF_KSWAPD;

So current_is_kswapd() returns true for a thread which is not kswapd. 
That's a bit smelly.

Should this thread really be incrementing KSWAPD_INODESTEAL instead of
PGINODESTEAL, for example?  current_is_kswapd() does a range of things,
only one(?) of which you actually want.

It would be cleaner to create a new PF_ flag to select just that
behavior.  That's a better model than telling the world "I am magic and
special".

But we're awfully close to running out of PF_ space and I don't know if
this ugly justifies consuming a flag.

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

WARNING: multiple messages have this Message-ID (diff)
From: Andrew Morton <akpm@linux-foundation.org>
To: Dave Chinner <david@fromorbit.com>
Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>,
	riel@redhat.com, kosaki.motohiro@jp.fujitsu.com,
	fengguang.wu@intel.com, kamezawa.hiroyu@jp.fujitsu.com,
	linux-kernel@vger.kernel.org, xfs@oss.sgi.com
Subject: Re: [PATCH] mm/vmscan: Do not block forever at shrink_inactive_list().
Date: Mon, 19 May 2014 22:59:15 -0700	[thread overview]
Message-ID: <20140519225915.3370328d.akpm@linux-foundation.org> (raw)
In-Reply-To: <20140520004449.GE18954@dastard>

On Tue, 20 May 2014 10:44:49 +1000 Dave Chinner <david@fromorbit.com> wrote:

> @@ -258,14 +258,23 @@ xfs_bmapi_allocate_worker(
>  	struct xfs_bmalloca	*args = container_of(work,
>  						struct xfs_bmalloca, work);
>  	unsigned long		pflags;
> +	unsigned long		new_pflags = PF_FSTRANS;
>  
> -	/* we are in a transaction context here */
> -	current_set_flags_nested(&pflags, PF_FSTRANS);
> +	/*
> +	 * we are in a transaction context here, but may also be doing work
> +	 * in kswapd context, and hence we may need to inherit that state
> +	 * temporarily to ensure that we don't block waiting for memory reclaim
> +	 * in any way.
> +	 */
> +	if (args->kswapd)
> +		new_pflags |= PF_MEMALLOC | PF_SWAPWRITE | PF_KSWAPD;

So current_is_kswapd() returns true for a thread which is not kswapd. 
That's a bit smelly.

Should this thread really be incrementing KSWAPD_INODESTEAL instead of
PGINODESTEAL, for example?  current_is_kswapd() does a range of things,
only one(?) of which you actually want.

It would be cleaner to create a new PF_ flag to select just that
behavior.  That's a better model than telling the world "I am magic and
special".

But we're awfully close to running out of PF_ space and I don't know if
this ugly justifies consuming a flag.


  parent reply	other threads:[~2014-05-20  5:59 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-19 14:40 [PATCH] mm/vmscan: Do not block forever at shrink_inactive_list() Tetsuo Handa
2014-05-19 17:42 ` Rik van Riel
2014-05-20  0:44 ` Dave Chinner
2014-05-20  0:44   ` Dave Chinner
2014-05-20  3:54   ` Tetsuo Handa
2014-05-20  3:54     ` Tetsuo Handa
2014-05-20  5:24     ` Dave Chinner
2014-05-20  5:24       ` Dave Chinner
2014-05-20  5:59   ` Andrew Morton [this message]
2014-05-20  5:59     ` Andrew Morton
2014-05-20  6:03     ` Andrew Morton
2014-05-20  6:03       ` Andrew Morton
2014-05-20  6:33       ` Dave Chinner
2014-05-20  6:33         ` Dave Chinner
2014-05-20  6:30     ` Dave Chinner
2014-05-20  6:30       ` Dave Chinner
2014-05-20 14:58       ` Tetsuo Handa
2014-05-20 14:58         ` Tetsuo Handa
2014-05-20 16:12         ` Motohiro Kosaki
2014-05-20 16:12           ` Motohiro Kosaki
2014-05-26 11:45           ` [PATCH] mm/vmscan: Do not block forever atshrink_inactive_list() Tetsuo Handa
2014-05-26 11:45             ` Tetsuo Handa
2014-06-03 21:43             ` David Rientjes
2014-06-03 21:43               ` David Rientjes
2014-06-05 12:45               ` [PATCH] mm/vmscan: Do not block forever at shrink_inactive_list() Tetsuo Handa
2014-06-05 12:45                 ` Tetsuo Handa
2014-06-05 13:17                 ` Dave Chinner
2014-06-05 13:17                   ` Dave Chinner
2014-06-06 12:19                   ` [PATCH] mm/vmscan: Do not block forever atshrink_inactive_list() Tetsuo Handa
2014-06-06 12:19                     ` Tetsuo Handa
2014-06-09 11:53                 ` [PATCH] mm/vmscan: Do not block forever at shrink_inactive_list() Tetsuo Handa
2014-06-09 11:53                   ` Tetsuo Handa
2014-07-02 12:40                   ` Tetsuo Handa
2014-05-20  7:20     ` Christoph Hellwig
2014-05-20  7:20       ` Christoph Hellwig
2014-05-20  2:35 ` Jianyu Zhan

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=20140519225915.3370328d.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=david@fromorbit.com \
    --cc=fengguang.wu@intel.com \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=kosaki.motohiro@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=penguin-kernel@I-love.SAKURA.ne.jp \
    --cc=riel@redhat.com \
    --cc=xfs@oss.sgi.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 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.