From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.linuxfoundation.org ([140.211.169.12]:32940 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756260AbdGYBsT (ORCPT ); Mon, 24 Jul 2017 21:48:19 -0400 Subject: Patch "f2fs: try to freeze in gc and discard threads" has been added to the 4.12-stable tree To: jaegeuk@kernel.org, gregkh@linuxfoundation.org Cc: , From: Date: Mon, 24 Jul 2017 18:48:13 -0700 Message-ID: <150094729320527@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org List-ID: This is a note to let you know that I've just added the patch titled f2fs: try to freeze in gc and discard threads to the 4.12-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: f2fs-try-to-freeze-in-gc-and-discard-threads.patch and it can be found in the queue-4.12 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let know about it. >>From 1d7be2708277edfef95171d52fb65ee26eaa076b Mon Sep 17 00:00:00 2001 From: Jaegeuk Kim Date: Wed, 17 May 2017 10:36:58 -0700 Subject: f2fs: try to freeze in gc and discard threads From: Jaegeuk Kim commit 1d7be2708277edfef95171d52fb65ee26eaa076b upstream. This allows to freeze gc and discard threads. Signed-off-by: Jaegeuk Kim Signed-off-by: Greg Kroah-Hartman --- fs/f2fs/gc.c | 9 +++++---- fs/f2fs/segment.c | 25 ++++++++++++++++--------- 2 files changed, 21 insertions(+), 13 deletions(-) --- a/fs/f2fs/gc.c +++ b/fs/f2fs/gc.c @@ -32,13 +32,14 @@ static int gc_thread_func(void *data) wait_ms = gc_th->min_sleep_time; + set_freezable(); do { + wait_event_interruptible_timeout(*wq, + kthread_should_stop() || freezing(current), + msecs_to_jiffies(wait_ms)); + if (try_to_freeze()) continue; - else - wait_event_interruptible_timeout(*wq, - kthread_should_stop(), - msecs_to_jiffies(wait_ms)); if (kthread_should_stop()) break; --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -16,6 +16,7 @@ #include #include #include +#include #include "f2fs.h" #include "segment.h" @@ -1060,18 +1061,24 @@ static int issue_discard_thread(void *da struct f2fs_sb_info *sbi = data; struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info; wait_queue_head_t *q = &dcc->discard_wait_queue; -repeat: - if (kthread_should_stop()) - return 0; - __issue_discard_cmd(sbi, true); - __wait_discard_cmd(sbi, true); + set_freezable(); - congestion_wait(BLK_RW_SYNC, HZ/50); + do { + wait_event_interruptible(*q, kthread_should_stop() || + freezing(current) || + atomic_read(&dcc->discard_cmd_cnt)); + if (try_to_freeze()) + continue; + if (kthread_should_stop()) + return 0; - wait_event_interruptible(*q, kthread_should_stop() || - atomic_read(&dcc->discard_cmd_cnt)); - goto repeat; + __issue_discard_cmd(sbi, true); + __wait_discard_cmd(sbi, true); + + congestion_wait(BLK_RW_SYNC, HZ/50); + } while (!kthread_should_stop()); + return 0; } #ifdef CONFIG_BLK_DEV_ZONED Patches currently in stable-queue which might be from jaegeuk@kernel.org are queue-4.12/f2fs-load-inode-s-flag-from-disk.patch queue-4.12/f2fs-don-t-clear-sgid-when-inheriting-acls.patch queue-4.12/f2fs-use-spin_-un-lock_irq-save-restore.patch queue-4.12/f2fs-sanity-check-checkpoint-segno-and-blkoff.patch queue-4.12/f2fs-sanity-check-size-of-nat-and-sit-cache.patch queue-4.12/f2fs-try-to-freeze-in-gc-and-discard-threads.patch queue-4.12/f2fs-wake-up-all-waiters-in-f2fs_submit_discard_endio.patch queue-4.12/f2fs-do-not-issue-small-discards-in-lfs-mode.patch