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 E6C34C77B7A for ; Fri, 26 May 2023 09:16:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242950AbjEZJQZ (ORCPT ); Fri, 26 May 2023 05:16:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236878AbjEZJQY (ORCPT ); Fri, 26 May 2023 05:16:24 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F134F13D for ; Fri, 26 May 2023 02:15:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685092536; 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: in-reply-to:in-reply-to:references:references; bh=/vGFdqik0rBjuVyxRP6fkQFD2f5M7p6nEHdizh76LOg=; b=UoFfkDIdbQCL3Mypyx8ox9zkYuI9NpNxdcdZaWKJhS7dbimzUDvKLPv4HgH6GEdh/+0Inr 8QHexAWwi/MK/yNZ/pVjE8958kq/9ZrjaGRncpPhBSXNRnEchVddgdw5iA8f+sGOpw/ka+ qJiKf4/pfGRIg0iF27LQ9YhBTZFRMOQ= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-670-xsMc0qpcOM-rMmA8xGTNwA-1; Fri, 26 May 2023 05:15:31 -0400 X-MC-Unique: xsMc0qpcOM-rMmA8xGTNwA-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 22CC71C08DAC; Fri, 26 May 2023 09:15:30 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.39.192.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id 756EE492B00; Fri, 26 May 2023 09:15:27 +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: <4f479af6-2865-4bb3-98b9-78bba9d2065f@lucifer.local> References: <4f479af6-2865-4bb3-98b9-78bba9d2065f@lucifer.local> <89c7f535-8fc5-4480-845f-de94f335d332@lucifer.local> <20230525223953.225496-1-dhowells@redhat.com> <20230525223953.225496-2-dhowells@redhat.com> <520730.1685090615@warthog.procyon.org.uk> To: Lorenzo Stoakes Cc: dhowells@redhat.com, Christoph Hellwig , David Hildenbrand , Jens Axboe , Al Viro , Matthew Wilcox , Jan Kara , Jeff Layton , 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, Andrew Morton Subject: Re: [RFC PATCH v2 1/3] mm: Don't pin ZERO_PAGE in pin_user_pages() MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <522653.1685092526.1@warthog.procyon.org.uk> Date: Fri, 26 May 2023 10:15:26 +0100 Message-ID: <522654.1685092526@warthog.procyon.org.uk> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Lorenzo Stoakes wrote: > > iov_iter_extract_pages(), on the other hand, is only used in two places > > with these patches and the pins are always released with > > unpin_user_page*() so it's a lot easier to audit. > > Thanks for the clarification. I guess these are the cases where you're > likely to see zero page usage, but since this is changing all PUP*() callers > don't you need to audit all of those too? I don't think it should be necessary. This only affects pages obtained from gup with FOLL_PIN - and, so far as I know, those always have to be released with unpin_user_page*() which is part of the gup API and thus it should be transparent to the users. Pages obtained FOLL_GET, on the other hand, aren't freed through the gup API - and there are a bunch of ways of releasing them - and getting additional refs too. David