linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andreas Dilger <adilger@dilger.ca>
To: Khazhismel Kumykov <khazhy@google.com>
Cc: Theodore Ts'o <tytso@mit.edu>,
	linux-ext4 <linux-ext4@vger.kernel.org>,
	open list <linux-kernel@vger.kernel.org>, Jan Kara <jack@suse.cz>
Subject: Re: [PATCH v2] ext4: cond_resched in work-heavy group loops
Date: Wed, 24 Apr 2019 08:21:36 +0200	[thread overview]
Message-ID: <EB85EE47-BCCC-4A0C-9A33-0A5AC7239554@dilger.ca> (raw)
In-Reply-To: <20190423211329.149642-1-khazhy@google.com>

[-- Attachment #1: Type: text/plain, Size: 1893 bytes --]

On Apr 23, 2019, at 11:13 PM, Khazhismel Kumykov <khazhy@google.com> wrote:
> 
> These functions may take a long time looping over many groups, which
> may cause issues for non-preempt kernels.
> ext4_mb_init_backend()
> ext4_setup_system_zone()
> ext4_mb_release()
> 
> Signed-off-by: Khazhismel Kumykov <khazhy@google.com>

Reviewed-by: Andreas Dilger <adilger@dilger.ca>

> ---
> v2:
> - a few other places that in testing showed to be slow
> 
> fs/ext4/block_validity.c | 1 +
> fs/ext4/mballoc.c        | 2 ++
> 2 files changed, 3 insertions(+)
> 
> diff --git a/fs/ext4/block_validity.c b/fs/ext4/block_validity.c
> index 913061c0de1b..16134469ea3c 100644
> --- a/fs/ext4/block_validity.c
> +++ b/fs/ext4/block_validity.c
> @@ -155,6 +155,7 @@ int ext4_setup_system_zone(struct super_block *sb)
> 		return 0;
> 
> 	for (i=0; i < ngroups; i++) {
> +		cond_resched();
> 		if (ext4_bg_has_super(sb, i) &&
> 		    ((i < 5) || ((i % flex_size) == 0)))
> 			add_system_zone(sbi, ext4_group_first_block_no(sb, i),
> diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
> index 8ef5f12bbee2..99ba720dbb7a 100644
> --- a/fs/ext4/mballoc.c
> +++ b/fs/ext4/mballoc.c
> @@ -2490,6 +2490,7 @@ static int ext4_mb_init_backend(struct super_block *sb)
> 	sbi->s_buddy_cache->i_ino = EXT4_BAD_INO;
> 	EXT4_I(sbi->s_buddy_cache)->i_disksize = 0;
> 	for (i = 0; i < ngroups; i++) {
> +		cond_resched();
> 		desc = ext4_get_group_desc(sb, i, NULL);
> 		if (desc == NULL) {
> 			ext4_msg(sb, KERN_ERR, "can't read descriptor %u", i);
> @@ -2705,6 +2706,7 @@ int ext4_mb_release(struct super_block *sb)
> 
> 	if (sbi->s_group_info) {
> 		for (i = 0; i < ngroups; i++) {
> +			cond_resched();
> 			grinfo = ext4_get_group_info(sb, i);
> #ifdef DOUBLE_CHECK
> 			kfree(grinfo->bb_bitmap);
> --
> 2.21.0.593.g511ec345e18-goog
> 


Cheers, Andreas






[-- Attachment #2: Message signed with OpenPGP --]
[-- Type: application/pgp-signature, Size: 873 bytes --]

  reply	other threads:[~2019-04-24  6:21 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-16  2:59 [PATCH] ext4: add cond_resched() to ext4_mb_init_backend() Khazhismel Kumykov
2019-04-18 11:53 ` Jan Kara
2019-04-18 20:05   ` Khazhismel Kumykov
2019-04-23 21:13     ` [PATCH v2] ext4: cond_resched in work-heavy group loops Khazhismel Kumykov
2019-04-24  6:21       ` Andreas Dilger [this message]
2019-04-25 16:58       ` Theodore Ts'o

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=EB85EE47-BCCC-4A0C-9A33-0A5AC7239554@dilger.ca \
    --to=adilger@dilger.ca \
    --cc=jack@suse.cz \
    --cc=khazhy@google.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tytso@mit.edu \
    /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).