lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YKLXev4cjeRuGRqd@mit.edu>
Date:   Mon, 17 May 2021 16:52:10 -0400
From:   "Theodore Y. Ts'o" <tytso@....edu>
To:     Wang Jianchao <jianchao.wan9@...il.com>
Cc:     Andreas Dilger <adilger.kernel@...ger.ca>,
        linux-ext4@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] ext4: get discard out of jbd2 commit kthread

On Mon, May 17, 2021 at 11:57:09AM +0800, Wang Jianchao wrote:
> 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 moves the discard out of jbd2 kthread context and do it
> in kworker. And drain the kwork when cannot get space in mb buddy.
> This is done out of jbd2 handle and won't block the commit process.
> After that, we could use blk-wbt or other method to throttle the
> discard and needn't to worry it block the jbd2 commit kthread any
> more.

Wouldn't be much simpler to do something like this?

		if (discard_bio) {
-			submit_bio_wait(discard_bio);
-			bio_put(discard_bio);
+			submit_bio(discard_bio);
		}


We're throwing away the return value from submit_bio_wait(), so
there's no real need to wait for I/O to complete so we can fetch the
I/O status.

That way we don't need to move all of this to a kworker context.

     	    	       	       	   - Ted

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ