linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Theodore Ts'o <tytso@mit.edu>
To: Michal Hocko <mhocko@suse.cz>
Cc: Nikolay Borisov <kernel@kyup.com>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Dave Chinner <david@fromorbit.com>, Marian Marinov <mm@1h.com>,
	Hugh Dickins <hughd@google.com>,
	linux-mm@kvack.org, LKML <linux-kernel@vger.kernel.org>,
	linux-ext4@vger.kernel.org
Subject: Re: [PATCH] mm, vmscan: Do not wait for page writeback for GFP_NOFS allocations
Date: Thu, 2 Jul 2015 10:25:51 -0400	[thread overview]
Message-ID: <20150702142551.GB9456@thunk.org> (raw)
In-Reply-To: <20150701133715.GA6287@dhcp22.suse.cz>

On Wed, Jul 01, 2015 at 03:37:15PM +0200, Michal Hocko wrote:
> diff --git a/mm/vmscan.c b/mm/vmscan.c
> index 37e90db1520b..6c44d424968e 100644
> --- a/mm/vmscan.c
> +++ b/mm/vmscan.c
> @@ -995,7 +995,7 @@ static unsigned long shrink_page_list(struct list_head *page_list,
>  				goto keep_locked;
>  
>  			/* Case 3 above */
> -			} else {
> +			} else if (sc->gfp_mask & __GFP_FS) {
>  				wait_on_page_writeback(page);
>  			}
>  		}

Um, I've just taken a closer look at this code now that I'm back from
vacation, and I'm not sure this is right.  This Case 3 code occurs
inside an

	if (PageWriteback(page)) {
	    ...
	}

conditional, and if I'm not mistaken, if the flow of control exits
this conditional, it is assumed that the page is *not* under writeback.
This patch will assume the page has been cleaned if __GFP_FS is set,
which could lead to a dirty page getting dropped, so I believe this is
a bug.  No?

It would seem to me that a better fix would be to change the Case 2
handling:

			/* Case 2 above */
			} else if (global_reclaim(sc) ||
-			    !PageReclaim(page) || !(sc->gfp_mask & __GFP_IO)) {
+			    !PageReclaim(page) || !(sc->gfp_mask & __GFP_FS)) {
				/*
				 * This is slightly racy - end_page_writeback()
				 * might have just cleared PageReclaim, then
				 * setting PageReclaim here end up interpreted
				 * as PageReadahead - but that does not matter
				 * enough to care.  What we do want is for this
				 * page to have PageReclaim set next time memcg
				 * reclaim reaches the tests above, so it will
				 * then wait_on_page_writeback() to avoid OOM;
				 * and it's also appropriate in global reclaim.
				 */
				SetPageReclaim(page);
				nr_writeback++;

				goto keep_locked;


Am I missing something?

							- Ted
							

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

  parent reply	other threads:[~2015-07-02 14:25 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-30 15:17 Michal Hocko
2015-07-01  6:17 ` Michal Hocko
2015-07-01 13:37   ` Michal Hocko
2015-07-01 14:30     ` Rik van Riel
2015-07-02 14:25     ` Theodore Ts'o [this message]
2015-07-02 15:13       ` Michal Hocko
2015-08-04  6:32         ` Hugh Dickins
2015-08-04  9:51           ` Michal Hocko
2015-08-04 21:32             ` Hugh Dickins
2015-08-04 21:36             ` Hugh Dickins
2015-08-07  7:52           ` Nikolay Borisov
2015-08-13  2:13             ` Hugh Dickins

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=20150702142551.GB9456@thunk.org \
    --to=tytso@mit.edu \
    --cc=akpm@linux-foundation.org \
    --cc=david@fromorbit.com \
    --cc=hannes@cmpxchg.org \
    --cc=hughd@google.com \
    --cc=kernel@kyup.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.cz \
    --cc=mm@1h.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