2023-09-27 13:31:18

by Ritesh Harjani

[permalink] [raw]
Subject: Re: [PATCH v7 06/12] ext4: Separate block bitmap and buddy bitmap freeing in ext4_mb_clear_bb()

Kemeng Shi <[email protected]> writes:

> This patch separates block bitmap and buddy bitmap freeing in order to
> update block bitmap with ext4_mb_mark_context in following patch.
>
> Separated freeing is safe with concurrent allocation as long as:
> 1. Firstly allocate block in buddy bitmap, and then in block bitmap.
> 2. Firstly free block in block bitmap, and then buddy bitmap.
> Then freed block will only be available to allocation when both buddy
> bitmap and block bitmap are updated by freeing.
> Allocation obeys rule 1 already, just do sperated freeing with rule 2.
>
> Separated freeing has no race with generate_buddy as:
> Once ext4_mb_load_buddy_gfp is executed successfully, the update-to-date
> buddy page can be found in sbi->s_buddy_cache and no more buddy
> initialization of the buddy page will be executed concurrently until
> buddy page is unloaded. As we always do free in "load buddy, free,
> unload buddy" sequence, separated freeing has no race with generate_buddy.
>

Agreed. And thanks for adding a separate patch which talks about this
change.

> Signed-off-by: Kemeng Shi <[email protected]>
> ---
> fs/ext4/mballoc.c | 98 +++++++++++++++++++++++------------------------
> 1 file changed, 49 insertions(+), 49 deletions(-)

The patch looks good to me. Please feel free to add -

Reviewed-by: Ritesh Harjani (IBM) <[email protected]>