Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp4075188rwb; Sat, 21 Jan 2023 05:31:20 -0800 (PST) X-Google-Smtp-Source: AMrXdXuTHa6I5xuF7QW5kyiFa6pMmFaWRU3/GpFGE0dwms3MSq4VBWKkHYj4DFSU9hsd2Xtqh5cy X-Received: by 2002:a17:907:6746:b0:84d:1c67:97d7 with SMTP id qm6-20020a170907674600b0084d1c6797d7mr21359683ejc.30.1674307880581; Sat, 21 Jan 2023 05:31:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674307880; cv=none; d=google.com; s=arc-20160816; b=bvqG1R8sxuZuEgxn3N9Ui8FN+Qa7APfuaYGYI6VlDzFJAvW3zreyEhClqrcDNen4sl R6geCqDl2EVLBSquHrt4GXLXtOUDzlGQ5uRfb46BOg7F9T89ZY/fCX41KuBFoImjRqml +aIjrFMXPQUKWa3wM55HncLPShweKgACklSnKaItMunryqYJigyfTWCWmFAiNfVkOGpA sgXVQC7XuiQbW9L+uTXrRBd1KS2wqiMTaqUO01vyJ7n/mU2nwXnZ9KU5j0POzgoAoB4s 7vLP0DttNhd8S6+Wzsl6eTMZMUXJFGMkazxcE+bq9j9sqb/xukBWIpoOa3DxMnYE4KYO S++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=h38rVeQQMBfQzoUhfoAzFr4F8hjsgaO+ehHdHYEzIRQ=; b=kriMdqqm/he4/YFnz42z5SOV38jVJIaHEyywsBGF4Qi94chvMim4W+iwsWOwyOIBQ4 B4abxp/ne/zOIZvT4EW9K4tgXrty4OpA5LzuuDP2761g2IHovPllHooYKL27MLN6e2+a Fk3gFi5mcro9lWMovJhIawVbA9NuFW1+DvMtvYJX2bvpzE9s203DAHx9TDWHY5xK9LLU zwAjcOho0kao48hCV9Vwe08x2939asSevgWoMC/IPn0y4lyTO/RKAgdT47zNpKfB7dBq T+Q+RZ805ZlbSEEmU5caPJBtZ6t6zJXUV8BtvwSUW0lgWI2DMQyijeydIh9EIsdpuWZv PCgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=36l70iQ5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hb43-20020a170907162b00b0087052df6f02si24835520ejc.901.2023.01.21.05.31.01; Sat, 21 Jan 2023 05:31:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=36l70iQ5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229535AbjAUNHx (ORCPT + 50 others); Sat, 21 Jan 2023 08:07:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229750AbjAUNHw (ORCPT ); Sat, 21 Jan 2023 08:07:52 -0500 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 845D85FF7; Sat, 21 Jan 2023 05:07:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; 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=h38rVeQQMBfQzoUhfoAzFr4F8hjsgaO+ehHdHYEzIRQ=; b=36l70iQ579yXxTkbmz5v8IUwI8 dnY1RHAis4/kPbZ4s1dTWo7GGfM9+PsYDTvA/Y7tnUMkk6QtsFs4q3RKtjxDRhwuxuddoTGXyhO21 k3JOYcYvcpXRAS+o1eh4SKp7tAljXABwtv1V+QRSwm37U6FUjpYQGnNiK3mHnqLPE6Ta8oKvy3hRT ORbZCwTOtTrIkfJNbScpHez+noQTh1b6xZCPAw/hInfsoARdweG+zT4biwF7CgnJ7WfbNp/FVNG4p OKs8PWLCIAssIuDfFuv/kE3kFIh5X1L2FKd5gvAIiVG8zCLBH27F4ZOhEXG6tctvKDIol7/AKT43h hsATTidw==; Received: from hch by bombadil.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1pJDam-00Dswd-Q5; Sat, 21 Jan 2023 13:07:32 +0000 Date: Sat, 21 Jan 2023 05:07:32 -0800 From: Christoph Hellwig To: David Howells Cc: Al Viro , Christoph Hellwig , Matthew Wilcox , Jens Axboe , Jan Kara , Jeff Layton , Logan Gunthorpe , linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Christoph Hellwig Subject: Re: [PATCH v7 6/8] block: Make bio structs pin pages rather than ref'ing if appropriate Message-ID: References: <20230120175556.3556978-1-dhowells@redhat.com> <20230120175556.3556978-7-dhowells@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230120175556.3556978-7-dhowells@redhat.com> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,URIBL_BLOCKED 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 This really does three things: 1) add the BIO_PAGE_PINNED infrastructure 2) convert bio_iov_iter_get_pages to use iov_iter_extract_pages 3) convert bio_map_user_iov to use iov_iter_extract_pages so it should be three pages, with the first one also containing what is in your previous patch. > @@ -1183,7 +1185,7 @@ void __bio_release_pages(struct bio *bio, bool mark_dirty) > bio_for_each_segment_all(bvec, bio, iter_all) { > if (mark_dirty && !PageCompound(bvec->bv_page)) > set_page_dirty_lock(bvec->bv_page); > - put_page(bvec->bv_page); > + bio_release_page(bio, bvec->bv_page); This can be micro-optimized a bit by only doing the flags conversion once.