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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 43869C38142 for ; Mon, 23 Jan 2023 13:38:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 86DAF6B0071; Mon, 23 Jan 2023 08:38:40 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 81DB46B0072; Mon, 23 Jan 2023 08:38:40 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 70DCC6B0073; Mon, 23 Jan 2023 08:38:40 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 61D366B0071 for ; Mon, 23 Jan 2023 08:38:40 -0500 (EST) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 031E940807 for ; Mon, 23 Jan 2023 13:38:39 +0000 (UTC) X-FDA: 80386168800.01.BF25BFB Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf29.hostedemail.com (Postfix) with ESMTP id 2DB2E120007 for ; Mon, 23 Jan 2023 13:38:38 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=L40v10LW; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf29.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1674481118; h=from:from:sender: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:dkim-signature; bh=WPilpoakSHmLf1IHUm8451fbPrKn+kFkLmYeiPr3VRk=; b=WTBiL/QrVK6sQHD+h2miWgN6Ss4o3a4UkFrD8EG1DrENWuTKa4dcbJNVADvHKsZhG45TaX p53S7+DM4iDMFOrdLcPVx9BO6D6iw0FMBowjAMp/Mo3Ig76Dz3Uo8o7jmzqHZNKrGPulfl YqZLZY31Vh8kCxK1XwmKagef/47dd3c= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=L40v10LW; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf29.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1674481118; a=rsa-sha256; cv=none; b=trOxNkmNOFHT3Y/QMnkPdki64fo7P0E4KEc/3tV8BTHNhvUeI20YIZoJz3Was9U8km0DIe h0AinyBMAUZ22O6eUK+Iz4OlPYnt02Y3HaZ2j0IWonwZkZHo/08oJVJolI7H5OU7aRlRns IcoC6zUJpY1TsHZma4PpH1k/Pzr3oik= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1674481117; 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=L40v10LWfZ/5bxCqTcSy3BcCC7l8bElufFslR1W8TwaHkL2SO1AOuDHplXOTIFcyfg2Gz+ Huo1fnmijaz8hQeLAz3/YsSaY3rrWTrr0DodU2QHEuyDNcIuJW0Ih3ACpgNsQjDANhHbbp XWoTenOxNTYOwLfo6WCj6JHW6tzoZa8= 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 X-Rspamd-Queue-Id: 2DB2E120007 X-Rspamd-Server: rspam09 X-Rspam-User: X-Stat-Signature: wxgkuor14etz6r334pijm5bt7a49d5b8 X-HE-Tag: 1674481118-299976 X-HE-Meta: U2FsdGVkX199Fe8uwHewA3nLYzjsW8D+AKs1ZNxQaF34zfHlr7KQHSvMZqiuq1yT2fSJEi/OXEx/Txm41GLGiT1ZU8qxHyfrVOuKVX3FBuDAEgna8YIoLtalYFwsy3jjPvefadYjkRLf0Nq0dBr9xl+9wvhjU6nV93XeNLuChR170m8HbQT4iIxfjSu3NEzUgxWxHW1L4ctrBIQTQYUpD2GEJ4j2ppFQFUvTaq/YwR5o9seBUg1H0dwi+vQ2zyoPpxR4larrw4eAP9VPnaNvfXrlw8lcmnWP6Vb6BO7oAjDNkdZDfbsZbxA4lLUf/5FsnPjOlOaslMqV76Z9mDghG2q2F4ITc126yzASI3+d/7sfSZMdOpHRmSAvcMpl/+Ut+Ms3b2rd/cFtE06tW0d6U7GEJ+4x7IyxrvfoeMVv3Hq+8pkmBQ4SsBUh0TYc7ScOJWeyrjcCl+NCKpKbtsLX75vDiQRtthE7EAX/Q3ogOsRCqf2uFrkJD8AokuGYbFF8XQIN9jMJflF+geRSdKUTt6qy9M/F92kpUPZ/qwbyBtc21J9DDohs+bHeZQmU7PP/A2Tab60AAO4pSMRzp1DmSxYeIfTHNtJaVOQPJrDvTUUiuixwBhiLnshDc/2pUrvGGb9powclsFmlAXxRcag9OxC7i6OJnK1kML4whVma1HFARAKTERhcRDX8o5d8JjrK+It8L64XSPuFGeaZxNDWbBsfYbNe89C2it1C9pk3HpOKtnxXtGQRBN2BDKfecWoMjb/z+U5V2G6rYlYP26tjVjAzB4UtV7wDQVi2OyymFcjRG5nDxwjIguc7p5sq+W8JzYvxa6j0il/9h12Rket9PAOh2MKjlFoAQXOKMqxz/iLtUDBM/RsPYYDY90T/NiiyJWLQ2B52mJSDPuMqcAO66oSp6x09pX4SeVyK4Lhquq+TVb4vQ4cbIoM3PcH5w1F2PvPgbRuOnawddNTEK2h 8Cv3duSu E36qMVZuTkHicmKW+Arc2reLdk+mCgIpDgHK0YJNu9l0xaOl6XdKNPgRUGxWsdNMjHHuEtEhpu+HRSJ87HrCC/gbRntuIxLU0ADqvC+296uyDLIozdMnTV5U5PStbpKNb4hZDRQQpRhuBOyhIrPPwNlXRs8+uHnfShF3qgxzo7q+JjsWdikF7qOKINgjDMw/xurrbwpdl9TQaR3plDNplOhuvhKNla4oSVf57ohCK3ZqLUDMrQw9aExRN2aF4nOPIjRLj/koUsTnhcKBmE2ne87g13TzoqM1UsxnPFJeC+fEMkfH+I8Hpv9vR9g== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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