Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp2563787rdh; Wed, 27 Sep 2023 06:31:18 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFg1AX/I6OZVfMYf9oYhQg+CWyJcV3YxDcB6/W3mFghxeA//N19GeXeMjTMyPd3r1vJLGtk X-Received: by 2002:a05:6a00:148a:b0:68b:ff3b:e14a with SMTP id v10-20020a056a00148a00b0068bff3be14amr2402028pfu.18.1695821477844; Wed, 27 Sep 2023 06:31:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695821477; cv=none; d=google.com; s=arc-20160816; b=m22oN7nAn9gAhOsa17zh1tvuRYgwpWsm6X7Lu0IEcA7XagFCsjkiDVgEQgos0HPKT6 Q7H9FNo1x5Q+yK3qrGVkZBj9j8nRxHmGDxeH5K2KktSyBIIxJbY0PshdwE4x2nDzoE6V NrvMNowOwD/tFAOOZGDEO6P5jtYq41KQVXTbGGzqaZ/h6Uu73HpcywhePiTbfDXLCv4b YHw3zUKVbZzlHMX3aupKTK+bp9/lxxxm9byLQp95mtme3seh+MSgL3qn6Tnch1cZ1mKd 0OCUjB3lA87lsyPAGY0OKXVNHFMucR8hw3bTRVi31GeLN+eQDp4+VJJSookCitw3wEEo mRNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:subject:cc:to:from:message-id:date :dkim-signature; bh=dJOVwtHQyTbslSpjfBitXSuheNCEieFwv87lFiuO0e4=; fh=i7DQetGfDsfWYXohCb4E5ZTXE/R/ityVAbXNGIxurAo=; b=kNh7Jwj0ycfwR/X+HAv500wcsAA4zECvczUx6SpNw136NLIm/6bvGltyj+n2NjCRxX PfSB/K5sLEC4Cac1Iw7jO07W7adqMPKrTEkiw7Nhv9Yhc+dByyIIouzzJr7viG6tsfes 3tsmeX4K+nMUKxk6LYkwy6EM6Ysh+o1fKQ2Cw4lJb+dO1WY6hnTen6wsbfp16XrGb0qP 74JwiNkIMZPq0ioyPSQ38DGpVId3GyM4/RTAFxbecJb9J+JoVj8zAYXxucZEKWHDHUWk M1DB8FNFu1ltHYrgiGzmRjAIkup2dfzbsytcZJq2iWtJ/2ysbcUjq/3StkiMP42fP/S8 z88A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=AGG4GKT9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id j72-20020a638b4b000000b005775a0544e6si16000202pge.135.2023.09.27.06.31.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 06:31:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=AGG4GKT9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 18FCB80A2676; Wed, 27 Sep 2023 04:06:31 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231302AbjI0LG2 (ORCPT + 99 others); Wed, 27 Sep 2023 07:06:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38588 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231308AbjI0LGZ (ORCPT ); Wed, 27 Sep 2023 07:06:25 -0400 Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2E1AA13A; Wed, 27 Sep 2023 04:06:24 -0700 (PDT) Received: by mail-pl1-x62b.google.com with SMTP id d9443c01a7336-1c60778a3bfso66481505ad.1; Wed, 27 Sep 2023 04:06:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1695812783; x=1696417583; darn=vger.kernel.org; h=in-reply-to:subject:cc:to:from:message-id:date:from:to:cc:subject :date:message-id:reply-to; bh=dJOVwtHQyTbslSpjfBitXSuheNCEieFwv87lFiuO0e4=; b=AGG4GKT9Nfm7YZcZ+WK6e5OiEZqFGMj/jYnAMsdJKLym+BjJ2VabecAZ25zGZQiB7w l/0aSRBWgjF1Faw7VoOQj8kfCeuDUF8dBmuvlvNaRyZjZbEZ5s99TP6xmgnasxq+Lg1J Qg7twYI4nbZo+GWd5kGe5RzhhLUXob2S+ZT4xenBt0QA7T2cIjArWbJjDWZOwnlqShcV yd0txzI46P9nHgGqSUAV9aRxXZylJ0KACgqluXmA0qhtqkruVdPblYf33+4NQ4aL+ZFz VruPiKOd6yFlJ2kay4kUdX7dzguA4B3CbsrPmDdwBTqmH3RApW1pdyf4oQYMnP2iNgpK 9N4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695812783; x=1696417583; h=in-reply-to:subject:cc:to:from:message-id:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=dJOVwtHQyTbslSpjfBitXSuheNCEieFwv87lFiuO0e4=; b=hz2i4oDA/pnUlzD/Qg2yjzF/Zrk24gxdJWTR6llInlowAd2byV5Eyzi0CkYhfRxmvP 2P1hzWk3LfiQs7f928WtrDKZKPQBGicoAyX94F3sCQdenDhsonSpeoj1Z2eqBqGPibLN fEteFtqTEirWCkrDvPQ4hnsmVJAPHR9VLAWVfXY1mqG+wz8/3aNkrc/sjSMHyoShgMZy Cdz+Mvt1OmzMCAlZKiWsKO3jzpGTmKbc1FGuH/D2OIeOIJM1oox2gwUTXU3UdeOKJoSQ 7f12ISAY5ynDrmS4cKh8Lz6DhVNX2DvfJvmoDrJjFrOxvMUm806Ze6uZ31xnkQAH7L92 GiIw== X-Gm-Message-State: AOJu0Ywx5TTOMZT48framdkSmHHWmDEeT7PcFwF3BfL5Dm+VbbwRorVp 00sBJlefetPhupgeffBtUUr4Wkr6tiE= X-Received: by 2002:a17:903:187:b0:1bf:826:9e30 with SMTP id z7-20020a170903018700b001bf08269e30mr1504287plg.16.1695812783029; Wed, 27 Sep 2023 04:06:23 -0700 (PDT) Received: from dw-tp ([49.207.223.191]) by smtp.gmail.com with ESMTPSA id n11-20020a170902d2cb00b001c06dcd453csm12797430plc.236.2023.09.27.04.06.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 04:06:22 -0700 (PDT) Date: Wed, 27 Sep 2023 16:36:18 +0530 Message-Id: <87o7hng9jp.fsf@doe.com> From: Ritesh Harjani (IBM) To: Kemeng Shi , tytso@mit.edu, adilger.kernel@dilger.ca Cc: ojaswin@linux.ibm.com, linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v7 06/12] ext4: Separate block bitmap and buddy bitmap freeing in ext4_mb_clear_bb() In-Reply-To: <20230919201532.310085-7-shikemeng@huaweicloud.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 27 Sep 2023 04:06:31 -0700 (PDT) Kemeng Shi 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 > --- > 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)