Message ID | 20230123173007.325544-5-dhowells@redhat.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1736114wrn; Mon, 23 Jan 2023 09:51:23 -0800 (PST) X-Google-Smtp-Source: AMrXdXv444p9XF7Gs4As/xk0SoDMQN1QLsjUJKSfYunLB4OUublppFzTYuAPHjnO4mLZEzZx1egs X-Received: by 2002:aa7:c9c7:0:b0:499:cc32:6a52 with SMTP id i7-20020aa7c9c7000000b00499cc326a52mr37890408edt.16.1674496283023; Mon, 23 Jan 2023 09:51:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674496283; cv=none; d=google.com; s=arc-20160816; b=VP97R7ojwFsKYCbG6AEvtzDCjlNH4nQW/7On/pAkrxwlOSjPxgus67mLB45oTju2bA FBLmwDf4Kl98sRnIzwZvJzDrjrFC0oEKKoBRu26tStRgbNpQVgFeCRA2Ipc38BNZEd4R Me4+fIiVqbPz4L/jofbZ6AE7gv3TYqHmKESJ2iTL6OLm0jRP8keaGUFm1PIUosFkOZRk ekxvwVJYg8zTH4+YWzHAW7QDCVi7HYrtVYB8qaEHYqTuQmyte9pT/4hSGSJYSGPb282u dsluAHSB4C/kO+A3mzpSNiVxMraZzfTiqEapqKUVfmhss7j63VICwRB8Ra6zG6LFO9mU 0lSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=bxZsldujvKlYIKHvA4IAxT3TcGniFcgHJOVEtOWexok=; b=IoiI+lchQ+ZV48qrGjeVvlYpaNjkguK8D3Kl1SkN9jigoKGaRN75I8/o2MXjPbc6Uo 4RluzbvDCtljBcDzvOmNBwJndPvh1JLaS5AZIHh3IUlgbCYtORVfcABsCugPmKd44ZMw CrFtluHYPbl/HsE3w8hlb1+OhPeGPw82vryFwkSzvUIRPWvUr0VEUREEzA7s/CENq/E/ pVa5Lj8We2bLJeTzfnQZLHZS4//4YRxZaOp3rr0P6XDASGaa/GHGhRlYqUpatsWH/5H+ ZGUozugEDFxzmdBPoAaVGgExoxUk9kvPdSgnDKdQW+jmof80/HPJXbitUWDj3WFwesRw 8wFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ZeQ2IPIR; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id wg10-20020a17090705ca00b007c4f75345e2si33928451ejb.431.2023.01.23.09.51.00; Mon, 23 Jan 2023 09:51:23 -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=@redhat.com header.s=mimecast20190719 header.b=ZeQ2IPIR; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232571AbjAWRb6 (ORCPT <rfc822;rust.linux@gmail.com> + 99 others); Mon, 23 Jan 2023 12:31:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38314 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233199AbjAWRbx (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 23 Jan 2023 12:31:53 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 042BF2DE54 for <linux-kernel@vger.kernel.org>; Mon, 23 Jan 2023 09:30:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1674495027; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bxZsldujvKlYIKHvA4IAxT3TcGniFcgHJOVEtOWexok=; b=ZeQ2IPIRey/d9RrbN5JXxr+0cvrpm/Lj0qLeyYEHx2qUgvwPnJYy1AAFMn81fRl35LAM8V c3Tj7/7CLiuyZTPiMUK7fvoCKK0m8h7uGLDI5mWWEp82OAj/tazuUY/hpXsQOye+vNaniy beUJcUswUVruBWshSSZklpibPsrQAys= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-237--KJ79ehvM1ivgAVOHAwz0A-1; Mon, 23 Jan 2023 12:30:24 -0500 X-MC-Unique: -KJ79ehvM1ivgAVOHAwz0A-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id CCB293C14859; Mon, 23 Jan 2023 17:30:21 +0000 (UTC) Received: from warthog.procyon.org.uk.com (unknown [10.33.36.97]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6A9E8492B02; Mon, 23 Jan 2023 17:30:20 +0000 (UTC) From: David Howells <dhowells@redhat.com> To: Al Viro <viro@zeniv.linux.org.uk>, Christoph Hellwig <hch@infradead.org> Cc: David Howells <dhowells@redhat.com>, Matthew Wilcox <willy@infradead.org>, Jens Axboe <axboe@kernel.dk>, Jan Kara <jack@suse.cz>, Jeff Layton <jlayton@kernel.org>, Logan Gunthorpe <logang@deltatee.com>, linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Christoph Hellwig <hch@lst.de> Subject: [PATCH v8 04/10] iomap: don't get an reference on ZERO_PAGE for direct I/O block zeroing Date: Mon, 23 Jan 2023 17:30:01 +0000 Message-Id: <20230123173007.325544-5-dhowells@redhat.com> In-Reply-To: <20230123173007.325544-1-dhowells@redhat.com> References: <20230123173007.325544-1-dhowells@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=unavailable 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755836614148539492?= X-GMAIL-MSGID: =?utf-8?q?1755836614148539492?= |
Series |
iov_iter: Improve page extraction (pin or just list)
|
|
Commit Message
David Howells
Jan. 23, 2023, 5:30 p.m. UTC
From: Christoph Hellwig <hch@lst.de> ZERO_PAGE can't go away, no need to hold an extra reference. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: David Howells <dhowells@redhat.com> --- fs/iomap/direct-io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On Mon, Jan 23, 2023 at 05:30:01PM +0000, David Howells wrote: > From: Christoph Hellwig <hch@lst.de> > > ZERO_PAGE can't go away, no need to hold an extra reference. > > Signed-off-by: Christoph Hellwig <hch@lst.de> > Signed-off-by: David Howells <dhowells@redhat.com> I did originally attribute this to you as it's just extracted as an intermedia step from your patch. But I can live with it being credited to me if you want.
On 1/23/23 09:30, David Howells wrote: > From: Christoph Hellwig <hch@lst.de> > > ZERO_PAGE can't go away, no need to hold an extra reference. That statement is true, but... > > Signed-off-by: Christoph Hellwig <hch@lst.de> > Signed-off-by: David Howells <dhowells@redhat.com> > --- > fs/iomap/direct-io.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/fs/iomap/direct-io.c b/fs/iomap/direct-io.c > index 9804714b1751..47db4ead1e74 100644 > --- a/fs/iomap/direct-io.c > +++ b/fs/iomap/direct-io.c > @@ -202,7 +202,7 @@ static void iomap_dio_zero(const struct iomap_iter *iter, struct iomap_dio *dio, > bio->bi_private = dio; > bio->bi_end_io = iomap_dio_bio_end_io; > > - get_page(page); > + bio_set_flag(bio, BIO_NO_PAGE_REF); ...is it accurate to assume that the entire bio is pointing to the zero page? I recall working through this area earlier last year, and ended up just letting the zero page get pinned, and then unpinning upon release, which is harmless. I like your approach, if it is possible. I'm just not sure that it's correct given that bio's can have more than one page. thanks,
On Mon, Jan 23, 2023 at 06:42:28PM -0800, John Hubbard wrote: > > @@ -202,7 +202,7 @@ static void iomap_dio_zero(const struct iomap_iter *iter, struct iomap_dio *dio, > > bio->bi_private = dio; > > bio->bi_end_io = iomap_dio_bio_end_io; > > - get_page(page); > > + bio_set_flag(bio, BIO_NO_PAGE_REF); > > ...is it accurate to assume that the entire bio is pointing to the zero > page? I recall working through this area earlier last year, and ended up > just letting the zero page get pinned, and then unpinning upon release, > which is harmless. Yes, the bio is built 4 lines above what is quoted here, and submitted right after it. It only contains the ZERO_PAGE.
On 1/23/23 21:59, Christoph Hellwig wrote: > On Mon, Jan 23, 2023 at 06:42:28PM -0800, John Hubbard wrote: >>> @@ -202,7 +202,7 @@ static void iomap_dio_zero(const struct iomap_iter *iter, struct iomap_dio *dio, >>> bio->bi_private = dio; >>> bio->bi_end_io = iomap_dio_bio_end_io; >>> - get_page(page); >>> + bio_set_flag(bio, BIO_NO_PAGE_REF); >> >> ...is it accurate to assume that the entire bio is pointing to the zero >> page? I recall working through this area earlier last year, and ended up >> just letting the zero page get pinned, and then unpinning upon release, >> which is harmless. > > Yes, the bio is built 4 lines above what is quoted here, and submitted > right after it. It only contains the ZERO_PAGE. OK, yes. All good, then. thanks,
On 23.01.23 18:30, David Howells wrote: > From: Christoph Hellwig <hch@lst.de> > > ZERO_PAGE can't go away, no need to hold an extra reference. > > Signed-off-by: Christoph Hellwig <hch@lst.de> > Signed-off-by: David Howells <dhowells@redhat.com> > --- > fs/iomap/direct-io.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/fs/iomap/direct-io.c b/fs/iomap/direct-io.c > index 9804714b1751..47db4ead1e74 100644 > --- a/fs/iomap/direct-io.c > +++ b/fs/iomap/direct-io.c > @@ -202,7 +202,7 @@ static void iomap_dio_zero(const struct iomap_iter *iter, struct iomap_dio *dio, > bio->bi_private = dio; > bio->bi_end_io = iomap_dio_bio_end_io; > > - get_page(page); > + bio_set_flag(bio, BIO_NO_PAGE_REF); > __bio_add_page(bio, page, len, 0); > iomap_dio_submit_bio(iter, dio, bio, pos); > } > Reviewed-by: David Hildenbrand <david@redhat.com>
diff --git a/fs/iomap/direct-io.c b/fs/iomap/direct-io.c index 9804714b1751..47db4ead1e74 100644 --- a/fs/iomap/direct-io.c +++ b/fs/iomap/direct-io.c @@ -202,7 +202,7 @@ static void iomap_dio_zero(const struct iomap_iter *iter, struct iomap_dio *dio, bio->bi_private = dio; bio->bi_end_io = iomap_dio_bio_end_io; - get_page(page); + bio_set_flag(bio, BIO_NO_PAGE_REF); __bio_add_page(bio, page, len, 0); iomap_dio_submit_bio(iter, dio, bio, pos); }