From: Joseph Qi <joseph.qi@linux.alibaba.com>
To: Gang He <ghe@suse.com>, mark@fasheh.com, jlbec@evilplan.org
Cc: linux-kernel@vger.kernel.org, ocfs2-devel@oss.oracle.com,
akpm@linux-foundation.org
Subject: [Ocfs2-devel] [PATCH] ocfs2: fix potential soft lockup during fstrim
Date: Sun, 27 Sep 2020 10:59:38 +0800 [thread overview]
Message-ID: <cd133863-e81e-69f3-74da-bac4f52beb21@linux.alibaba.com> (raw)
In-Reply-To: <20200927015815.14904-1-ghe@suse.com>
On 2020/9/27 09:58, Gang He wrote:
> When we discard unused blocks on a mounted ocfs2 filesystem, fstrim
> handles each block goup with locking/unlocking global bitmap meta-file
> repeatedly. we should let fstrim thread take a break(if need) between
> unlock and lock, this will avoid the potential soft lockup problem,
> and also gives the upper applications more IO opportunities, these
> applications are not blocked for too long at writing files.
>
> Signed-off-by: Gang He <ghe@suse.com>
It makes sense.
Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com>
> ---
> fs/ocfs2/alloc.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c
> index 4c1b90442d6f..2cf9321919b5 100644
> --- a/fs/ocfs2/alloc.c
> +++ b/fs/ocfs2/alloc.c
> @@ -7654,8 +7654,10 @@ int ocfs2_trim_mainbm(struct super_block *sb, struct fstrim_range *range)
> * main_bm related locks for avoiding the current IO starve, then go to
> * trim the next group
> */
> - if (ret >= 0 && group <= last_group)
> + if (ret >= 0 && group <= last_group) {
> + cond_resched();
> goto next_group;
> + }
> out:
> range->len = trimmed * sb->s_blocksize;
> return ret;
>
prev parent reply other threads:[~2020-09-27 2:59 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-27 1:58 [Ocfs2-devel] [PATCH] ocfs2: fix potential soft lockup during fstrim Gang He
2020-09-27 2:59 ` Joseph Qi [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cd133863-e81e-69f3-74da-bac4f52beb21@linux.alibaba.com \
--to=joseph.qi@linux.alibaba.com \
--cc=akpm@linux-foundation.org \
--cc=ghe@suse.com \
--cc=jlbec@evilplan.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark@fasheh.com \
--cc=ocfs2-devel@oss.oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).