From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EA309C77B7C for ; Wed, 24 May 2023 05:55:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239451AbjEXFzl (ORCPT ); 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 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@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.