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 028D7C54E94 for ; Mon, 23 Jan 2023 13:39:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231611AbjAWNji (ORCPT ); Mon, 23 Jan 2023 08:39:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59496 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231480AbjAWNjg (ORCPT ); Mon, 23 Jan 2023 08:39:36 -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 33DEB22A2C for ; Mon, 23 Jan 2023 05:38:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1674481119; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WPilpoakSHmLf1IHUm8451fbPrKn+kFkLmYeiPr3VRk=; b=DTynkswSeYh2wsv+dTnytsy+3OSWrgibUTjLrqBVLg4W6dI0j6v0V+eOwAjQweQawRMK7A aw0H86r5Gz6qqePZ2frriZ0AH/3qMj2pG76i7AtnZ3PIK981/TlOJ+gaXWX/CAOgxFsvhA 3ptSvwxSXKg5s8QA0b7d0Y/PKpsHIc0= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-139-W9xSYacsPoiXHiW6bj2Uzw-1; Mon, 23 Jan 2023 08:38:34 -0500 X-MC-Unique: W9xSYacsPoiXHiW6bj2Uzw-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A0B5A857F43; Mon, 23 Jan 2023 13:38:33 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.33.36.23]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0E46F2026D2A; Mon, 23 Jan 2023 13:38:31 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 From: David Howells In-Reply-To: References: <7bbcccc9-6ebf-ffab-7425-2a12f217ba15@redhat.com> <246ba813-698b-8696-7f4d-400034a3380b@redhat.com> <20230120175556.3556978-1-dhowells@redhat.com> <20230120175556.3556978-3-dhowells@redhat.com> <3814749.1674474663@warthog.procyon.org.uk> <3903251.1674479992@warthog.procyon.org.uk> To: David Hildenbrand Cc: dhowells@redhat.com, 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 , John Hubbard , linux-mm@kvack.org Subject: Re: [PATCH v7 2/8] iov_iter: Add a function to extract a page list from an iterator MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3911636.1674481111.1@warthog.procyon.org.uk> Content-Transfer-Encoding: quoted-printable Date: Mon, 23 Jan 2023 13:38:31 +0000 Message-ID: <3911637.1674481111@warthog.procyon.org.uk> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org David Hildenbrand wrote: > That would be the ideal case: whenever intending to access page content,= use > FOLL_PIN instead of FOLL_GET. > = > The issue that John was trying to sort out was that there are plenty of > callsites that do a simple put_page() instead of calling > unpin_user_page(). IIRC, handling that correctly in existing code -- wha= t was > pinned must be released via unpin_user_page() -- was the biggest workite= m. > = > Not sure how that relates to your work here (that's why I was asking): i= f you > could avoid FOLL_GET, that would be great :) Well, it simplifies things a bit. I can make the new iov_iter_extract_pages() just do "pin" or "don't pin" a= nd do no ref-getting at all. Things can be converted over to "unpin the page= s or doing nothing" as they're converted over to using iov_iter_extract_pages() from iov_iter_get_pages*(). The block bio code then only needs a single bit of state: pinned or not pinned. For cifs RDMA, do I need to make it pass in FOLL_LONGTERM? And does that = need a special cleanup? sk_buff fragment handling could still be tricky. I'm thinking that in tha= t code I'll need to store FOLL_GET/PIN in the bottom two bits of the frag pa= ge pointer. Sometimes it allocates a new page and attaches it (have ref); sometimes it does zerocopy to/from a page (have pin) and sometimes it may = be pointing to a kernel buffer (don't pin or ref). David