diff options
author | Sahitya Tummala <stummala@codeaurora.org> | 2021-03-16 14:59:18 +0530 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2021-03-26 10:27:44 -0700 |
commit | d6d2b491a82e1e411a6766fbfb87c697d8701554 (patch) | |
tree | a845211793358143ef3e744190cf76545c33e0e8 /fs/f2fs/segment.c | |
parent | 61461fc921b756ae16e64243f72af2bfc2e620db (diff) | |
download | linux-d6d2b491a82e1e411a6766fbfb87c697d8701554.tar.gz linux-d6d2b491a82e1e411a6766fbfb87c697d8701554.tar.bz2 linux-d6d2b491a82e1e411a6766fbfb87c697d8701554.zip |
f2fs: allow to change discard policy based on cached discard cmds
With the default DPOLICY_BG discard thread is ioaware, which prevents
the discard thread from issuing the discard commands. On low RAM setups,
it is observed that these discard commands in the cache are consuming
high memory. This patch aims to relax the memory pressure on the system
due to f2fs pending discard cmds by changing the policy to DPOLICY_FORCE
based on the nm_i->ram_thresh configured.
Signed-off-by: Sahitya Tummala <stummala@codeaurora.org>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/segment.c')
-rw-r--r-- | fs/f2fs/segment.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index 33cb8aa5ec8f..ad48f1f16387 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -1762,7 +1762,8 @@ static int issue_discard_thread(void *data) if (!atomic_read(&dcc->discard_cmd_cnt)) continue; - if (sbi->gc_mode == GC_URGENT_HIGH) + if (sbi->gc_mode == GC_URGENT_HIGH || + !f2fs_available_free_memory(sbi, DISCARD_CACHE)) __init_discard_policy(sbi, &dpolicy, DPOLICY_FORCE, 1); sb_start_intwrite(sbi->sb); |