linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko@kernel.org>
To: Mikulas Patocka <mpatocka@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Alexander Viro <viro@zeniv.linux.org.uk>,
	Mel Gorman <mgorman@suse.de>,
	Johannes Weiner <hannes@cmpxchg.org>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] mm: add cond_resched to generic_swapfile_activate
Date: Mon, 25 Jul 2016 09:26:09 +0200	[thread overview]
Message-ID: <20160725072609.GB9401@dhcp22.suse.cz> (raw)
In-Reply-To: <alpine.LRH.2.02.1607221710580.4818@file01.intranet.prod.int.rdu2.redhat.com>

On Fri 22-07-16 17:11:20, Mikulas Patocka wrote:
> The function generic_swapfile_activate can take quite long time, it iterates
> over all blocks of a file, so add cond_resched to it. I observed about 1 second
> stalls when activating a swapfile that was almost unfragmented - this patch
> fixes it.
> 
> Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>

Acked-by: Michal Hocko <mhocko@suse.com>

> 
> ---
>  mm/page_io.c |    2 ++
>  1 file changed, 2 insertions(+)
> 
> Index: linux-4.7-rc7/mm/page_io.c
> ===================================================================
> --- linux-4.7-rc7.orig/mm/page_io.c	2016-05-30 17:34:37.000000000 +0200
> +++ linux-4.7-rc7/mm/page_io.c	2016-07-11 17:23:33.000000000 +0200
> @@ -166,6 +166,8 @@ int generic_swapfile_activate(struct swa
>  		unsigned block_in_page;
>  		sector_t first_block;
>  
> +		cond_resched();
> +
>  		first_block = bmap(inode, probe_block);
>  		if (first_block == 0)
>  			goto bad_bmap;

-- 
Michal Hocko
SUSE Labs

--
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:[~2016-07-25  7:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-22 21:10 [PATCH 0/2] mm patches Mikulas Patocka
2016-07-22 21:11 ` [PATCH 1/2] mm: add cond_resched to generic_swapfile_activate Mikulas Patocka
2016-07-25  7:26   ` Michal Hocko [this message]
2016-07-22 21:12 ` [PATCH 2/2] mm: optimize copy_page_to/from_iter_iovec Mikulas Patocka
2016-07-23 20:59   ` Andi Kleen

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=20160725072609.GB9401@dhcp22.suse.cz \
    --to=mhocko@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@suse.de \
    --cc=mpatocka@redhat.com \
    --cc=viro@zeniv.linux.org.uk \
    /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