Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp6155824ybl; Mon, 23 Dec 2019 00:46:06 -0800 (PST) X-Google-Smtp-Source: APXvYqxYMmRMjxqTrXeXm92VIfbif9htT8wFCrF4L03NsgNOyqHrAlHojTh7Pxao/AtJrYX8fLn6 X-Received: by 2002:a05:6830:685:: with SMTP id q5mr5518709otr.208.1577090766360; Mon, 23 Dec 2019 00:46:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577090766; cv=none; d=google.com; s=arc-20160816; b=JKVGkyF2CDVhCjSXCMZFjEidkdKHnYAjYr+7U8rxXk2334BlBZuVvqg67JNuhfTogC uUWpT9/a4KhbvIRjVrLVcUjUp/Q/z6CPARq0OLKe7Rryl3/1b2EgysPMTO+a/sAd5sKq HfGbKe7wacLiaMiEq9EAVZssyOZj7x7iSyWziy5ob6o+btBVTPJ0U2HHdrLqy6Bzugxk QsxOBQduquDmK17Rxs15P8noJk13+rS7i0z2BbTWlD6+VuSmppRD4NyaBwbtoh+/cgpD 4JsU6+pGLuvMEU7R1qhrYXVIpp2o2eaaGyIQm1RADSw9zO4XYdaaP83vXvk/bNP8Rwow ZqDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=cDv9UaL4HKxCZwOpeNm1xbtf2cmQl4fg1wQxfmqaPlY=; b=A9RjHRTkYaDbEUBrszE8H+Sj95RQM1JuaEi/B6tODygFZ7BzZPR6t7beEpcxMYxYRl jcg+yXD7z+mqy3ITsiNhWACn1w5Uk6tkTsf9nhr2owg+o5S7oGpMFCtY72xGwOnfZNWB hju+K+7w88Je9XFrFtNdDv2sP15bNCdzECBakoJmL0fx0TmSgMzANSTo4BemAdNA6KSN bAzTrzqhIst/vFNTgMrxq5ZiOjL/yEOXblvo/GxvE6Dnhop7fikl8IlLKsBawyqbZBEy rHcbtswSmuVFRdFfJmtvsxH4Zj1oHBGK/9wy57wO6I13Ft7EQZJHHToI/ZnwQFGJxMtr oigg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f15si4403654oib.61.2019.12.23.00.45.25; Mon, 23 Dec 2019 00:46:06 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726028AbfLWIlO (ORCPT + 99 others); Mon, 23 Dec 2019 03:41:14 -0500 Received: from mail-ot1-f66.google.com ([209.85.210.66]:41523 "EHLO mail-ot1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725901AbfLWIlO (ORCPT ); Mon, 23 Dec 2019 03:41:14 -0500 Received: by mail-ot1-f66.google.com with SMTP id r27so21194602otc.8; Mon, 23 Dec 2019 00:41:13 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=cDv9UaL4HKxCZwOpeNm1xbtf2cmQl4fg1wQxfmqaPlY=; b=f2zAyaDXwgl4tc6L5OljcVFXROCwReDChWEOjREH3Ho857KqigiMUBkYVvSd9Tj21t T6dDGuVTd4kwkAz9j8VTiyi9MdhvwvMV6WyJgMB8w/jXVz9q0SgmWbn3WaH7m1/x3BDV QjUAnUJh+aL56YOlwDH6jE/T+OTqKsGzF5cbWnWN3s1gyBmhWOuoFK+6YNpwqCwj4p9u en0NQGwgdDcdJy3WAiW4/UeYffsh96tljoF1cLZINldvnRPnD3fEwlQ0mzWYKHDh37wQ bp3Gky2wuhiLt+mUrw1cxYleKMSomU8EstGezn5MiT5fQTNleS7xVoNF83vl/1scPhUa 4moQ== X-Gm-Message-State: APjAAAUTg841JTkrunoyV5cnT2VNz6KEm8sHHrGmN7htgWkekBzEtLAs JXD/cOcWB1E4rM3nud9ZzJI81cSR6rABozRRZ5Dolbfo X-Received: by 2002:a9d:dc1:: with SMTP id 59mr31479287ots.250.1577090473314; Mon, 23 Dec 2019 00:41:13 -0800 (PST) MIME-Version: 1.0 References: <20191223040020.109570-1-yuchao0@huawei.com> In-Reply-To: <20191223040020.109570-1-yuchao0@huawei.com> From: Geert Uytterhoeven Date: Mon, 23 Dec 2019 09:41:02 +0100 Message-ID: Subject: Re: [PATCH] f2fs: introduce DEFAULT_IO_TIMEOUT_JIFFIES To: Chao Yu Cc: Jaegeuk Kim , linux-f2fs-devel@lists.sourceforge.net, Linux Kernel Mailing List , Chao Yu , Linux FS Devel Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, CC linux-fsdevel On Mon, Dec 23, 2019 at 5:01 AM Chao Yu wrote: > As Geert Uytterhoeven reported: > > for parameter HZ/50 in congestion_wait(BLK_RW_ASYNC, HZ/50); > > On some platforms, HZ can be less than 50, then unexpected 0 timeout > jiffies will be set in congestion_wait(). > > This patch introduces a macro DEFAULT_IO_TIMEOUT_JIFFIES to limit > mininum value of timeout jiffies. > > Signed-off-by: Chao Yu Thanks for your patch! > --- > fs/f2fs/compress.c | 3 ++- > fs/f2fs/data.c | 5 +++-- > fs/f2fs/f2fs.h | 2 ++ > fs/f2fs/gc.c | 3 ++- > fs/f2fs/inode.c | 3 ++- > fs/f2fs/node.c | 3 ++- > fs/f2fs/recovery.c | 6 ++++-- > fs/f2fs/segment.c | 12 ++++++++---- > fs/f2fs/super.c | 6 ++++-- > 9 files changed, 29 insertions(+), 14 deletions(-) > > diff --git a/fs/f2fs/compress.c b/fs/f2fs/compress.c > index 1bc86a54ad71..ee4fe8e644aa 100644 > --- a/fs/f2fs/compress.c > +++ b/fs/f2fs/compress.c > @@ -945,7 +945,8 @@ static int f2fs_write_raw_pages(struct compress_ctx *cc, > } else if (ret == -EAGAIN) { > ret = 0; > cond_resched(); > - congestion_wait(BLK_RW_ASYNC, HZ/50); > + congestion_wait(BLK_RW_ASYNC, > + DEFAULT_IO_TIMEOUT_JIFFIES); > lock_page(cc->rpages[i]); > clear_page_dirty_for_io(cc->rpages[i]); > goto retry_write; > diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c > index f1f5c701228d..78b5c0b0287e 100644 > --- a/fs/f2fs/data.c > +++ b/fs/f2fs/data.c > @@ -2320,7 +2320,8 @@ int f2fs_encrypt_one_page(struct f2fs_io_info *fio) > /* flush pending IOs and wait for a while in the ENOMEM case */ > if (PTR_ERR(fio->encrypted_page) == -ENOMEM) { > f2fs_flush_merged_writes(fio->sbi); > - congestion_wait(BLK_RW_ASYNC, HZ/50); > + congestion_wait(BLK_RW_ASYNC, > + DEFAULT_IO_TIMEOUT_JIFFIES); > gfp_flags |= __GFP_NOFAIL; > goto retry_encrypt; > } > @@ -2900,7 +2901,7 @@ static int f2fs_write_cache_pages(struct address_space *mapping, > if (wbc->sync_mode == WB_SYNC_ALL) { > cond_resched(); > congestion_wait(BLK_RW_ASYNC, > - HZ/50); > + DEFAULT_IO_TIMEOUT_JIFFIES); > goto retry_write; > } > goto next; > diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h > index 16edbf4e05e8..4bdc20a94185 100644 > --- a/fs/f2fs/f2fs.h > +++ b/fs/f2fs/f2fs.h > @@ -559,6 +559,8 @@ enum { > > #define DEFAULT_RETRY_IO_COUNT 8 /* maximum retry read IO count */ > > +#define DEFAULT_IO_TIMEOUT_JIFFIES (max_t(long, HZ/50, 1)) > + > /* maximum retry quota flush count */ > #define DEFAULT_RETRY_QUOTA_FLUSH_COUNT 8 > Seeing other file systems (ext4, xfs) and even core MM code suffers from the same issue, perhaps it makes sense to move this into congestion_wait(), i.e. increase the timeout to 1 if it's zero in the latter function? Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds