Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2160121rwd; Fri, 26 May 2023 02:36:49 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4WdLeGj7CLpyH/AaXtJ6R0ggtRDT9IqG+qiEbQhflieRoKLGIJmdPxAyzbcwlDn1FSQJTZ X-Received: by 2002:a05:6a20:734e:b0:10c:29e5:941e with SMTP id v14-20020a056a20734e00b0010c29e5941emr1644741pzc.59.1685093809610; Fri, 26 May 2023 02:36:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685093809; cv=none; d=google.com; s=arc-20160816; b=GszIFR1K+jbc1jKsb8jJsqg/UYfmyr+q8lRDePtHMOHhf1U5NCwGuvKLFUFQEFUAdr 2DVmQOZUSoiWinjLkMWyq1xBBHB4+gvJtfAfh35eT3a4tPHIiPxRXZDbLtexKtDsyOvz rQUxyQ6rE0RtxppCSSE6Tn0Iw9cmIv5xEtbOM8W+ZA0ARjuQFhYJc4lxJn+vmkd9wrut QfzM0RdILXf9jTZodnVqE/7tt5UNMtQ97+d7Ys+v5ZODoKeNEPI2v6vTD843re1pHWYm 0/WpxjNgP9kGnsrk0zmCrmlyPZ6P+dnfH/HOCQy8Mk1b34CqMjVDcLtQfItC4YsG4zaR Pb2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:content-id:mime-version:subject :cc:to:references:in-reply-to:from:organization:dkim-signature; bh=/vGFdqik0rBjuVyxRP6fkQFD2f5M7p6nEHdizh76LOg=; b=VQKqT+LFHtgsJ9/4TFotzGu95WhqsGx1gaHFq28JEgNoKuEyNT1Zrq0s10w7sHZi1/ mnR9XU1+NlNjtZ2TCvpq3X1c826eeVmTgaQGu7qaKu/WxZWD0HBEKqvHbsCeYQvN0Pj7 fGg0K5w+92vnLn5NtcSp3cA+HaZ/nCvsmBuidKaq6jrKISs8ICEaK9t4PAT8gGLKS3c0 I8Od0zan49tb4m0vwOtw6Tg6YQRO/prJgALrMaZtdoQXJkd70gXHMPLQ2uN5m6vYRstZ qD5Fc96YP2kUtLl1cXZuPkp6Uqa3U9WzGftxmjFR5K20L7mIRfL3hoHYXMW2HZENU+xO Sg8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Pyr9Vjlk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 14-20020a63114e000000b0053f23442f24si1944318pgr.502.2023.05.26.02.36.35; Fri, 26 May 2023 02:36:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Pyr9Vjlk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242957AbjEZJQV (ORCPT + 99 others); Fri, 26 May 2023 05:16:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57080 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242739AbjEZJQS (ORCPT ); Fri, 26 May 2023 05:16:18 -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 0735212C for ; Fri, 26 May 2023 02:15:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685092532; 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=Pyr9Vjlk030gJR2Znp75JklHos9N8E+WETEa9NfqwMsetrI3yvq/8uwVjV/Wbou+PPPcx5 ewFawdeJmNLiK3QhNqAq3NxdTf/g2iQMf45Lc7fXbBuZxC6h0XuOiPuPSjsNJNV351XLWU /ZlCH3zQeCXtsCpTwyh4QNFCemtlpjk= 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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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