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 4D4CBC38142 for ; Mon, 23 Jan 2023 14:21:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232263AbjAWOVp (ORCPT ); Mon, 23 Jan 2023 09:21:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36220 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232257AbjAWOVn (ORCPT ); Mon, 23 Jan 2023 09:21:43 -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 7EB7418B29 for ; Mon, 23 Jan 2023 06:20:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1674483654; 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=3Qw6OoQIblD+SHFIDSF3ygbKeoxmTzUe8MMuhcikIz8=; b=N270oJ5X+YSZ26Ic9zPu28OhqgmqolL26CO4uwS37+Mqp3RuUur8xbw7ApqTuM63zowGuj rKbzOggQTJblaHRJkb/pWE0Pm+gDHHoV6JYk88+bTi4uju6FZBfW4DzawpgWcLz6FpoAjk q7cl0lbBrjzuxMq4YJzWpqxKF8yXSvM= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-609-a8byMG8TPQO0ska7UDeWAw-1; Mon, 23 Jan 2023 09:20:46 -0500 X-MC-Unique: a8byMG8TPQO0ska7UDeWAw-1 Received: by mail-wr1-f71.google.com with SMTP id m12-20020adfa3cc000000b002b881cb0cb4so2018431wrb.3 for ; Mon, 23 Jan 2023 06:20:44 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:organization:from:references :cc:to:content-language:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=3Qw6OoQIblD+SHFIDSF3ygbKeoxmTzUe8MMuhcikIz8=; b=lEDlk1C+ksd0k/wk3939PEALTr4Y+zCg2C/DrXDz+lv3N+p+HZaRYs+NEZ3yFfcQOB 8dr+p0zO4Ev8EPGopVdtdby8Rv3ZyvpK5k7xBdNDd7IBKJceSNIcOzMZkcgQ5TqQ7Z/q TJIFr+7ekha/F1A3KvHn08zby5ffg+g4QMo6RC9Opu8c2E8v6U6rHR+YhUAsHptaHnBb wLnxVYLM9ufwqmrVIGKjghI3EW4NAU1tdSnkh+VuN7Eiid2xipahiy6PTVUiWGMIpdpz iq7rzVIue7f+7WavWTjSPZNNJmKQTda7zysSy5XfCVbnEZkswmH7puv3QUrIelvzBes3 VQ1A== X-Gm-Message-State: AFqh2kol4aLpHg8lASkUjSxlY1ul+hVg2tkYd8Si3wKuvl6vK6zmKFNx OM2gzsXDeBJp3NeE0SWMqQaoeb3q09+a2a0cCxOHFNiOznLZYs0RGv/uQYTFtKl0j1TsuzT+D+l jO1eN8hnhIyrvbs9Hs3jHZbN/ X-Received: by 2002:a05:600c:3083:b0:3da:e4d:e6ba with SMTP id g3-20020a05600c308300b003da0e4de6bamr23672671wmn.14.1674483643852; Mon, 23 Jan 2023 06:20:43 -0800 (PST) X-Google-Smtp-Source: AMrXdXtA0SmMxGfIXBjxWwrkcsAPkrTFymy9qeDOZWk2TkY+Bo+QqROnDkmX5yaFF9e6G40kzNARmg== X-Received: by 2002:a05:600c:3083:b0:3da:e4d:e6ba with SMTP id g3-20020a05600c308300b003da0e4de6bamr23672641wmn.14.1674483643563; Mon, 23 Jan 2023 06:20:43 -0800 (PST) Received: from ?IPV6:2003:cb:c704:1100:65a0:c03a:142a:f914? (p200300cbc704110065a0c03a142af914.dip0.t-ipconnect.de. [2003:cb:c704:1100:65a0:c03a:142a:f914]) by smtp.gmail.com with ESMTPSA id 21-20020a05600c26d500b003d9b87296a9sm10216753wmv.25.2023.01.23.06.20.42 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 23 Jan 2023 06:20:43 -0800 (PST) Message-ID: <77f3fc56-05d8-def0-e518-0906c729e7df@redhat.com> Date: Mon, 23 Jan 2023 15:20:41 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0 Subject: Re: [PATCH v7 2/8] iov_iter: Add a function to extract a page list from an iterator Content-Language: en-US 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 , John Hubbard , linux-mm@kvack.org 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> <3911637.1674481111@warthog.procyon.org.uk> From: David Hildenbrand Organization: Red Hat In-Reply-To: <3911637.1674481111@warthog.procyon.org.uk> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 23.01.23 14:38, David Howells wrote: > 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 -- what was >> pinned must be released via unpin_user_page() -- was the biggest workitem. >> >> Not sure how that relates to your work here (that's why I was asking): if 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" and > do no ref-getting at all. Things can be converted over to "unpin the pages 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. Unfortunately, I'll have to let BIO experts comment on that :) I only know the MM side of things here. > > For cifs RDMA, do I need to make it pass in FOLL_LONGTERM? And does that need > a special cleanup? Anything that holds pins "possibly forever" should that. vmsplice() is another example that should use it, once properly using FOLL_PIN. [FOLL_GET | FOLL_LONGTERM is not really used/defined with semantics] > > sk_buff fragment handling could still be tricky. I'm thinking that in that > code I'll need to store FOLL_GET/PIN in the bottom two bits of the frag page > 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 > -- Thanks, David / dhildenb