diff options
author | Mikulas Patocka <mpatocka@redhat.com> | 2016-07-28 15:48:47 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-07-28 16:07:41 -0700 |
commit | 7e4411bfe6dd29713f879717b433304a1992526d (patch) | |
tree | c0a0f753e75420ca6186f5eccecccd61b3f6b59a /mm | |
parent | 4e390b2b2f34b8daaabf2df1df0cf8f798b87ddb (diff) | |
download | linux-stable-7e4411bfe6dd29713f879717b433304a1992526d.tar.gz linux-stable-7e4411bfe6dd29713f879717b433304a1992526d.tar.bz2 linux-stable-7e4411bfe6dd29713f879717b433304a1992526d.zip |
mm: add cond_resched() to generic_swapfile_activate()
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.
Link: http://lkml.kernel.org/r/alpine.LRH.2.02.1607221710580.4818@file01.intranet.prod.int.rdu2.redhat.com
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Acked-by: Michal Hocko <mhocko@suse.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/page_io.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/mm/page_io.c b/mm/page_io.c index dcc5d3769608..fb1fa269d3a0 100644 --- a/mm/page_io.c +++ b/mm/page_io.c @@ -166,6 +166,8 @@ int generic_swapfile_activate(struct swap_info_struct *sis, unsigned block_in_page; sector_t first_block; + cond_resched(); + first_block = bmap(inode, probe_block); if (first_block == 0) goto bad_bmap; |