Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp1968320rdb; Thu, 7 Dec 2023 14:10:31 -0800 (PST) X-Google-Smtp-Source: AGHT+IFEvXQ9NmV1BoWUDGJVYYc8MJkcLu2yNT4zPNYqDLU25qydcyK2T6UiO0jFoj6bot4DiuHF X-Received: by 2002:a05:6a20:bf20:b0:181:b87a:b8ba with SMTP id gc32-20020a056a20bf2000b00181b87ab8bamr3122158pzb.53.1701987031327; Thu, 07 Dec 2023 14:10:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701987031; cv=none; d=google.com; s=arc-20160816; b=Z4QkxMhF1xh9i0nELzcbPxIELLm321V4ZVQipE1tfwjnthBb2F+WEQ1epwJJtNXrKB xOwDZlmvyKMhWTXOdBuTtsfl7uHtWCQWsVNLuF/4LFFxbdwPcU+mBH4Vu9wbQm5AAUz2 0U7npidiNJtRsFBeNMT8zYusVnatcw267AueB6Gm+ajrGx0eIsxvLPTM5UKX5bh7Z2WA HRrxNlXX05k6Lw2vwteokgAs0PAnWieTh10gkrkz0SY7QRG+Xqug2ggMsO9UXYi9QMV3 TUC5JmivK4tv0j/Yxxgmw6owV030vkvnjuFZW10D2VIeadQUzu4NRYQjBi6Zifgvalm4 5PDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=pH1oxLSwhQvWIhVCj8LzWrye4aCz9bpVtCZJRtVEskY=; fh=jIN+6Wqgt6SSQnL7/3TpfxcFZwD87PxYsnCTiMWH9Z0=; b=hDfoYnl+izE4t+XuS/Ymn4XNOdNeCviYkhzixkRdsXKmVxYkFDcDQ3jjKDyas+Rj9S uht9A1N9Zu8rINsbGrR3Klrlv9zn/X2iAEpSOpwT2XrDaCQzdpYyLdi2iRBHjiviBiKs 0O7kagKUnfc+DacUJzFEZtgU9MJthSuBCZGD+/vcFFqwPv3R0/nw+MPpFfYF4Wz59HK6 FJXalHYDL4M8/9wTntNq9Sv3vyHodAf/bRKVuRYMHUx7PVQtgc7mYxV4GDvHrcSlQM1/ /UZyxKSrSw8Z7245rL6uXx6DZdMkVorvI1RgQdhIYVwQtZknuXMUtE8DtqadIe5tdxi4 Bc2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="neI12TK/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id b19-20020a056a000cd300b006ce6c32583fsi380292pfv.81.2023.12.07.14.10.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Dec 2023 14:10:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="neI12TK/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id CBA76801F23B; Thu, 7 Dec 2023 14:10:28 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232106AbjLGWKN (ORCPT + 99 others); Thu, 7 Dec 2023 17:10:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231830AbjLGWKL (ORCPT ); Thu, 7 Dec 2023 17:10:11 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 28AB698 for ; Thu, 7 Dec 2023 14:10:17 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 20215C433C8; Thu, 7 Dec 2023 22:10:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1701987016; bh=sBNd3oxL6+a22NEO/VDNFOidep38poCkeBZb+XkzywM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=neI12TK/fHjGgZNDnLArNdLQEFClIYknp5Ch25AvJ3uzwa2mhmCuGfWn6SZmc4Xyh gQMahdRIXK77n5/TMkaJuK/OTaGAPpUr8VBnnr4q3wtd7Fji08gZbr7yFVPHi4KIgb kPw8zNI7nHJ/VS+tzDxLN1M0wA5VuigBoMI9/5Yj/pDRS49Sl+6w9ez2hmAT7NjNC7 qQdXIGld6g178tGepH6B2006iUsLwQmpAinMxrh1bo76odHAfwiueeCK5A2UhUESZZ nVUMpRinVsxy8gbJ5s20Klo6zNQG6cK7+fyob9qhJiofGyOE3G4twLx4NuUzZqYJo8 EHr/yFHXpV51A== Date: Thu, 7 Dec 2023 15:10:13 -0700 From: Keith Busch To: "Matthew Wilcox (Oracle)" Cc: Jens Axboe , Andrew Morton , "Kirill A . Shutemov" , Hugh Dickins , linux-mm@kvack.org, linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH] block: Remove special-casing of compound pages Message-ID: References: <20230814144100.596749-1-willy@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230814144100.596749-1-willy@infradead.org> X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email 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 (groat.vger.email [0.0.0.0]); Thu, 07 Dec 2023 14:10:29 -0800 (PST) On Mon, Aug 14, 2023 at 03:41:00PM +0100, Matthew Wilcox (Oracle) wrote: > void __bio_release_pages(struct bio *bio, bool mark_dirty) > { > - struct bvec_iter_all iter_all; > - struct bio_vec *bvec; > + struct folio_iter fi; > + > + bio_for_each_folio_all(fi, bio) { > + struct page *page; > + size_t done = 0; > > - bio_for_each_segment_all(bvec, bio, iter_all) { > - if (mark_dirty && !PageCompound(bvec->bv_page)) > - set_page_dirty_lock(bvec->bv_page); > - bio_release_page(bio, bvec->bv_page); > + if (mark_dirty) { > + folio_lock(fi.folio); > + folio_mark_dirty(fi.folio); > + folio_unlock(fi.folio); > + } > + page = folio_page(fi.folio, fi.offset / PAGE_SIZE); > + do { > + bio_release_page(bio, page++); > + done += PAGE_SIZE; > + } while (done < fi.length); > } > } Is it okay to release same-folio pages while creating the bio instead of releasing all the pages at the completion? If so, the completion could provide just the final bio_release_page() instead looping. I'm more confirming if that's an appropriate way to use folios here.