Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp5327250rwd; Tue, 23 May 2023 23:24:59 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6LWFIOcGOWl2jVmmWNF6jSUTuM+6RjJkz4o++elf6O4sIAZprWyF1zrz5Mu4hx1ePYT67D X-Received: by 2002:a05:6a00:23c7:b0:64d:5c1d:353 with SMTP id g7-20020a056a0023c700b0064d5c1d0353mr1989091pfc.19.1684909498672; Tue, 23 May 2023 23:24:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684909498; cv=none; d=google.com; s=arc-20160816; b=T7r6TLDsPot+QZ99uEBZUqgKJxSneh8fQnCzDJLW8/CHAhzwj6MeGEp99Wm7SC0zR3 b1s6G2BBAEVSJr3x8z1KfRAuFqu4DMuCQfwk82dG2nVVBUnagewKNdvdLEab5YC/Qjxh iH30NVsC9TBl4PRy3YAFkPI/3I6NrfTsTEaUPys1ZcDjSzk9sVG44f6ayZMxJ9peBP++ AmsdlZHW/uE67FQMN+Kbj38xKm08c5+04NVJIPBCpvz+IIKKZ9S/2+rNfKYktREtyI5/ jT4XZvBGP+0MoWOZsSFzC3aRzY7O3+63IAxeeGN63Hd+y+NDRi8PEVFWIlvDMJh42POU 9m7Q== 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=jdIJRr6SVbAXSsPF/i2aTGQx/YOfpWz8tHC0SKlBXi4=; b=xFFIIIWbT1DrV+O5PcSL3HIWtDfQdDurOj2opVIgd+iVhFXgUArQbLy2kVfPh0thK2 m5WncJPvttAr0xZthyEXu+7zPNtNeBwxST2ct7on29CKQbbBXcp6n6hKVYR6+9LoW7PG JZfAsPustgggHJzzU7g4bcs4hkpH2hPG5KtyzD7JZM6WhDwfpxdvWBxQmJ2jkSEyJA4P oeazwyACigC8/z6TK8RwO0rfyQyXZQ0/gvh906qMiVEwrZKsEFsy7x7Djvatp2T4V2XM eUtQNGuXLz9TabBUcxzlVO+rgHsNx9AxZNbx6TypQh33RKdq+Gf/C2T9ZXMLcYv4kOXq XMgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b="bhZ/q6+B"; 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 bk13-20020a056a02028d00b0053ef1b5a506si2367025pgb.275.2023.05.23.23.24.43; Tue, 23 May 2023 23:24:58 -0700 (PDT) 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="bhZ/q6+B"; 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 S239493AbjEXFzl (ORCPT + 99 others); Wed, 24 May 2023 01:55:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40608 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236309AbjEXFzk (ORCPT ); Wed, 24 May 2023 01:55:40 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 703C2132; Tue, 23 May 2023 22:55:38 -0700 (PDT) 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=jdIJRr6SVbAXSsPF/i2aTGQx/YOfpWz8tHC0SKlBXi4=; b=bhZ/q6+BbvgH//aJqOs/m6J8Iz +iluoYt2ZJ8g0cscenhvfA5X65IhkckRAUYzkya87DkwdCo6YdN/coXONlstI7WVrcH5dus57/fiH AQTRj4f+Vb6RLA1cThpIX+mFOj5ujUWhXudJ/myZanGPeMkNoZDObVmAa9ltm3JaJbn5FU9gJ4QmT DNs8PzSe0nSinW1wti1EPfTh2gjMRRUCm0frJG/MHSioDV6HUIwJp5pBMy27IJjPsvGjOdzbGK0HE WSfIn5enW2dqrNATZaCM45sX/ZnHVxMALuPL3qYle7MGsW99GH5SgmSDaybr3b2VwkPMUiZTyqgMD Giy06sZQ==; Received: from hch by bombadil.infradead.org with local (Exim 4.96 #2 (Red Hat Linux)) id 1q1hT6-00CRbU-25; Wed, 24 May 2023 05:55:28 +0000 Date: Tue, 23 May 2023 22:55:28 -0700 From: Christoph Hellwig To: David Howells Cc: Christoph Hellwig , Jens Axboe , Al Viro , Matthew Wilcox , Jan Kara , Jeff Layton , David Hildenbrand , Jason Gunthorpe , Logan Gunthorpe , Hillf Danton , Christian Brauner , Linus Torvalds , linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: Extending page pinning into fs/direct-io.c Message-ID: References: <20230522205744.2825689-1-dhowells@redhat.com> <3068545.1684872971@warthog.procyon.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3068545.1684872971@warthog.procyon.org.uk> 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,T_SCC_BODY_TEXT_LINE 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 On Tue, May 23, 2023 at 09:16:11PM +0100, David Howells wrote: > I've been poking at it this afternoon, but it doesn't look like it's going to > be straightforward, unfortunately. The mm folks have been withdrawing access > to the pinning API behind the ramparts of the mm/ dir. Further, the dio code > will (I think), under some circumstances, arbitrarily insert the zero_page > into a list of things that are maybe pinned or maybe unpinned, but I can (I > think) also be given a pinned zero_page from the GUP code if the page tables > point to one and a DIO-write is requested - so just doing if page == zero_page > isn't sufficient. Yes. I think the proper workaround is to add a MM helper that just pins a single page and make it available to direct-io.c. It should not be exported and clearly marked to not be used in new code. > What I'd like to do is to make the GUP code not take a ref on the zero_page > if, say, FOLL_DONT_PIN_ZEROPAGE is passed in, and then make the bio cleanup > code always ignore the zero_page. I don't think that'll work, as we can't mix different pin vs get types in a bio. And that's really a good thing. > Something that I noticed is that the dio code seems to wangle to page bits on > the target pages for a DIO-read, which seems odd, but I'm not sure I fully > understand the code yet. I don't understand this sentence.