From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752449AbcGYH0T (ORCPT ); Mon, 25 Jul 2016 03:26:19 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:35429 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751015AbcGYH0M (ORCPT ); Mon, 25 Jul 2016 03:26:12 -0400 Date: Mon, 25 Jul 2016 09:26:09 +0200 From: Michal Hocko To: Mikulas Patocka Cc: Andrew Morton , Alexander Viro , Mel Gorman , Johannes Weiner , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] mm: add cond_resched to generic_swapfile_activate Message-ID: <20160725072609.GB9401@dhcp22.suse.cz> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.6.0 (2016-04-01) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Acked-by: Michal Hocko > > --- > 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