All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Theodore Ts'o" <tytso@mit.edu>
To: Wang Jianchao <jianchao.wan9@gmail.com>
Cc: adilger.kernel@dilger.ca, jack@suse.cz, guoqing.jiang@linux.dev,
	linux-kernel@vger.kernel.org, linux-ext4@vger.kernel.org
Subject: Re: [PATCH V4 4/5] ext4: get discard out of jbd2 commit kthread contex
Date: Tue, 31 Aug 2021 00:00:23 -0400	[thread overview]
Message-ID: <YS2pV1L/MM4jvlVf@mit.edu> (raw)
In-Reply-To: <20210830075246.12516-5-jianchao.wan9@gmail.com>

On Mon, Aug 30, 2021 at 03:52:45PM +0800, Wang Jianchao wrote:
> From: Wang Jianchao <wangjianchao@kuaishou.com>
> 
> Right now, discard is issued and waited to be completed in jbd2
> commit kthread context after the logs are committed. When large
> amount of files are deleted and discard is flooding, jbd2 commit
> kthread can be blocked for long time. Then all of the metadata
> operations can be blocked to wait the log space.
> 
> One case is the page fault path with read mm->mmap_sem held, which
> wants to update the file time but has to wait for the log space.
> When other threads in the task wants to do mmap, then write mmap_sem
> is blocked. Finally all of the following read mmap_sem requirements
> are blocked, even the ps command which need to read the /proc/pid/
> -cmdline. Our monitor service which needs to read /proc/pid/cmdline
> used to be blocked for 5 mins.
> 
> This patch frees the blocks back to buddy after commit and then do
> discard in a async kworker context in fstrim fashion, namely,
>  - mark blocks to be discarded as used if they have not been allocated
>  - do discard
>  - mark them free
> After this, jbd2 commit kthread won't be blocked any more by discard
> and we won't get NOSPC even if the discard is slow or throttled.
> 
> Link: https://marc.info/?l=linux-kernel&m=162143690731901&w=2
> Suggested-by: Theodore Ts'o <tytso@mit.edu>
> Reviewed-by: Jan Kara <jack@suse.cz>
> Signed-off-by: Wang Jianchao <wangjianchao@kuaishou.com>

I had applied the V3 version of this patch series for testing
purposes, and then accidentally included in the dev branch.  So an
earlier version of this patch series has been in the ext4 git tree for
a while.  I've done a comparison between the V3 and V4 patches, and
aside from a minor whitespace change in patch #1, the only patch that
had any real changes was this one (#4).  Patch #5 was also added in
the V4 series.

So I've edited the ext4 git tree using rebase magic, replacing patch
#4 and adding patch #5.

In other words, this is a slightly more complicated, "Thanks,
applied".  :-)

					- Ted

  reply	other threads:[~2021-08-31  4:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-30  7:52 [PATCH V4 0/5] ext4: get discard out of jbd2 commit kthread Wang Jianchao
2021-08-30  7:52 ` [PATCH V4 1/5] ext4: remove the 'group' parameter of ext4_trim_extent Wang Jianchao
2021-08-30  7:52 ` [PATCH V4 2/5] ext4: add new helper interface ext4_try_to_trim_range() Wang Jianchao
2021-08-30  7:52 ` [PATCH V4 3/5] ext4: remove the repeated comment of ext4_trim_all_free Wang Jianchao
2021-08-30  7:52 ` [PATCH V4 4/5] ext4: get discard out of jbd2 commit kthread contex Wang Jianchao
2021-08-31  4:00   ` Theodore Ts'o [this message]
2021-08-30  7:52 ` [PATCH V4 5/5] ext4: flush background discard kwork when retry allocation Wang Jianchao

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=YS2pV1L/MM4jvlVf@mit.edu \
    --to=tytso@mit.edu \
    --cc=adilger.kernel@dilger.ca \
    --cc=guoqing.jiang@linux.dev \
    --cc=jack@suse.cz \
    --cc=jianchao.wan9@gmail.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.