Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp2013488rdb; Thu, 7 Dec 2023 15:57:48 -0800 (PST) X-Google-Smtp-Source: AGHT+IGHZzZdCQO8XsJHhrCSIY7y3P/n6srpRcc8F9IosurzVFnzhk4xSOyqnXVPZLEoasXMYJXm X-Received: by 2002:a05:6a20:1591:b0:18b:ca68:4e9a with SMTP id h17-20020a056a20159100b0018bca684e9amr22487pzj.28.1701993467811; Thu, 07 Dec 2023 15:57:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701993467; cv=none; d=google.com; s=arc-20160816; b=w3Sks1/ausaw5b/eLqICVzt189CJ7EPNaGktO3sk6jWynX4NkvWaowAv8OPbdBuxPl XD68MuTa7hl5m20rFk7mEsCLc+ZKdIjuAFZ4ywq0LhvgEhNdEe6KZ/lKE/z9/EaOhiP/ kubUEIhFfcJ8pxLw0Z9tGOGQJmpLRP0tW75+mS3iC+PKTDzZmreY3GpQcAwYlwaCkOPP 3zdulCeiDjspa0cUEBtyGXjmc99qk+BnXL3WkuATdQS0Rp8Lhsp0dz3UJ6clDAoB/GGM daPlAz1+OM0U8OLfgy6f7Q9TAY7MA1+JzwoH/wUmVmrYheOx5EABDiw73udH3hjkbR8I on/Q== 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=YO6MVl02oBiITEYrEywlC3LVDyTUqOlWipn5vN0fmhA=; fh=L7VvMwWDB0ty/A/FbGM7Vepwx578O10DJ9Sir/rYmko=; b=0u/Ry2j90w9mH2Cz/ey6uOtOZrB/u0booKrLVhUgYC78bpWZt/KlP3+t9AYW4pABEM Nhiq6jX0mdc6Z6+I0ZMSoNzpwQQOgcXJUBBkfjaL3YuIRUxt7+RWigi8NB6zerVbnoar X1Hv1C1rdovHwg3q2vk9vYZpkJpfwvrR+2fsfDE5s0VQWknZZ1XI+Qwag/HofYXbmBnI 49S7580XhVh1/L8ejzZBaGLRjjo96eH45+xUPQrZ/sJQ5dHOeyIj8xBqg3KO04fAOJaj gBdVNYSSmRe05W/LBZsfjpPUyATT/u2OxUIMp6NqHceLnSu98ALhW25zYuIJ+lkO1qbj icsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=gqhWqtmp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id by32-20020a056a0205a000b005c66415a758si530325pgb.468.2023.12.07.15.57.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Dec 2023 15:57:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=gqhWqtmp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id BEEAD80F7F3C; Thu, 7 Dec 2023 15:57:32 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235331AbjLGX5S (ORCPT + 99 others); Thu, 7 Dec 2023 18:57:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235554AbjLGX5N (ORCPT ); Thu, 7 Dec 2023 18:57:13 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2023E1720; Thu, 7 Dec 2023 15:57:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=YO6MVl02oBiITEYrEywlC3LVDyTUqOlWipn5vN0fmhA=; b=gqhWqtmpvP9SALAF/Q1zmqoGHm HxMwUKrMpAPGfReElYZa/S3TvjzUkkyxt10c7razZ5wU/hSxDRc3RN+qkzI4JtEhv37wXZd9YSbbS jmePUN0WrspPoPUXkxLQOf7YyHxFy1OiHeXOzAdUxMBynWUHg342NjmGGP19/c1f9GAzvI+qJMQYw n4937Xk5nGkIBOJPaceqsLyaBJkOgp/i2Yeaa/1eCg4UW6P61UajreLPS91lO2endUQfeifDbnTti kRHruEUK3J0P+gpL56LlxdthWqnXJR3WCc6ztejMQz4wuBkPMZW5ovM7EQDeY0a9vMaw1w0ZXJUcU e9k8dAbg==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1rBOEp-004cCW-JH; Thu, 07 Dec 2023 23:57:03 +0000 Date: Thu, 7 Dec 2023 23:57:03 +0000 From: Matthew Wilcox To: Keith Busch 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: X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,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 fry.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 (fry.vger.email [0.0.0.0]); Thu, 07 Dec 2023 15:57:32 -0800 (PST) On Thu, Dec 07, 2023 at 03:10:13PM -0700, Keith Busch wrote: > 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. For this patch, I'm just replicating the existing behaviour. We can probably do much better. Honestly, the whole thing is kind of grotesque and needs to be reformed ... but I think that's part of the physr project.