public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Boris Burkov <boris@bur.io>
To: Qu Wenruo <wqu@suse.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 0/5] btrfs: qgroup: reduce GFP_ATOMIC usage for ulist
Date: Wed, 30 Aug 2023 15:06:37 -0700	[thread overview]
Message-ID: <20230830220637.GB834639@zen> (raw)
In-Reply-To: <cover.1693391268.git.wqu@suse.com>

On Wed, Aug 30, 2023 at 06:37:22PM +0800, Qu Wenruo wrote:
> [REPO]
> https://github.com/adam900710/linux/tree/qgroup_mutex
> 
> Yep, the branch name shows my previous failed attempt to solve the
> problem.
> 
> [PROBLEM]
> There are quite some GFP_ATOMIC usage for btrfs qgroups, most of them
> are for ulists.
> 
> Those ulists are just used as a temporary memory to trace the involved
> qgroups.
> 
> [ENHANCEMENT]
> This patchset would address the problem by adding a new list_head called
> iterator for btrfs_qgroup.
> 
> And all call sites but one of ulist allocation can be migrated to use
> the new qgroup_iterator facility to iterate qgroups without any memory
> allocation.
> 
> The only remaining ulist call site is @qgroups ulist utilized inside
> btrfs_qgroup_account_extent(), which is utilized to get all involved
> qgroups for both old and new roots.
> 
> I tried to extract the qgroups collection code into a dedicate loop
> out of qgroup_update_refcnt(), but it would lead to test case failure of
> btrfs/028 (accounts underflow).
> 
> Thus for now only the safe part is sent to the list.
> 
> And BTW since we can skip quite some memory allocation failure handling
> (since there is no memory allocation), we also save some lines of code.

These all LGTM, thanks!

Reviewed-by: Boris Burkov <boris@bur.io>

> 
> Qu Wenruo (5):
>   btrfs: qgroup: iterate qgroups without memory allocation for
>     qgroup_reserve()
>   btrfs: qgroup: use qgroup_iterator facility for
>     btrfs_qgroup_free_refroot()
>   btrfs: qgroup: use qgroup_iterator facility for qgroup_convert_meta()
>   btrfs: qgroup: use qgroup_iterator facility for
>     __qgroup_excl_accounting()
>   btrfs: qgroup: use qgroup_iterator facility to replace @tmp ulist of
>     qgroup_update_refcnt()
> 
>  fs/btrfs/qgroup.c | 252 ++++++++++++++++------------------------------
>  fs/btrfs/qgroup.h |   9 ++
>  2 files changed, 94 insertions(+), 167 deletions(-)
> 
> -- 
> 2.41.0
> 

      parent reply	other threads:[~2023-08-30 22:10 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-30 10:37 [PATCH 0/5] btrfs: qgroup: reduce GFP_ATOMIC usage for ulist Qu Wenruo
2023-08-30 10:37 ` [PATCH 1/5] btrfs: qgroup: iterate qgroups without memory allocation for qgroup_reserve() Qu Wenruo
2023-08-30 21:58   ` Boris Burkov
2023-08-30 10:37 ` [PATCH 2/5] btrfs: qgroup: use qgroup_iterator facility for btrfs_qgroup_free_refroot() Qu Wenruo
2023-08-30 10:37 ` [PATCH 3/5] btrfs: qgroup: use qgroup_iterator facility for qgroup_convert_meta() Qu Wenruo
2023-08-30 10:37 ` [PATCH 4/5] btrfs: qgroup: use qgroup_iterator facility for __qgroup_excl_accounting() Qu Wenruo
2023-08-30 10:37 ` [PATCH 5/5] btrfs: qgroup: use qgroup_iterator facility to replace @tmp ulist of qgroup_update_refcnt() Qu Wenruo
2023-08-30 22:09   ` Boris Burkov
2023-08-30 22:55     ` Qu Wenruo
2023-09-05 13:07   ` David Sterba
2023-08-30 22:06 ` Boris Burkov [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=20230830220637.GB834639@zen \
    --to=boris@bur.io \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=wqu@suse.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