Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp938814rwd; Wed, 31 May 2023 07:27:14 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4MOpwrk5lEuNqGrPDRWFk3IsKrvX47UB6yKIBzMqE6icig5CU4F9kLk5xGWfZXh7Anzw3i X-Received: by 2002:a05:6a20:6a0f:b0:101:3c60:6794 with SMTP id p15-20020a056a206a0f00b001013c606794mr17304629pzk.2.1685543234430; Wed, 31 May 2023 07:27:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685543234; cv=none; d=google.com; s=arc-20160816; b=X67GoudoXa5za1NMTLCCW9nMZxpQW99pjFvDbdApz2GxrcCg4vEe0d+2ul+U+VV6Ap Fq4sTdvUdSYM1MOULRoXoJ5A6b384xbSx7cVGLMLhQOGFqF+0dElDSZiyB6Ozke1PRiD T4MBo6JSlDayH0C6IwYSU2khaYYg6ngt+92dgIAy8rKOtGhk5dRWU+Fe56olVyt4/H5E j5f2y7HdVtjHfYDr7d2Z1iVs2dmKEHZ9Zw4Qh4OQXfTVaWuFg2w58GZ5CdefWDKA+6Ww yW8ZoVKpSJ4nvrYYHrN8BnMlUv4YmFMa6xCtz8wBgRn8vmso9c7+NPGKjKmFtA+9/dwv PYUg== 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-transfer-encoding :content-id:mime-version:subject:cc:to:references:in-reply-to:from :organization:dkim-signature; bh=ziEVWybyK4gf6HAMK2OABfQt5DxF+29cSopVoad9/Oc=; b=WNE/JRXf56AcfxEXH8o1y3ckHpZwdmMlhfI04tsKEp3D5ul62/d/ogVGEzXd39NAVs wuDe5Jnzs63G39Qe4lh+8bYlwAU4693XwpnpRNCDp4/ndWkK5H4G8HL+v6Quyp6TKr5o T9xy95ml1EBD5EmfYZvYN8yB3jeO8PDXgzhUhjcTWp40wI8olUQZiNNMYqQXT+ZW5uFX dWz2zWZp6UmYie7UMD8viiFXYnP9Zc7aQXfNOgi+ptwuI2ws9nMjzfYPQgBbnPpVY9mA RhWBCy1F4MmLuGez+iRZfTsuIEh3wolmLzMtXvwP9g6t8sksGS9kFNZtnpLFcwkOjgpq SnDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=MmKVjiQh; 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 j124-20020a636e82000000b0053ef2b7f245si1024701pgc.621.2023.05.31.07.26.58; Wed, 31 May 2023 07:27:14 -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=MmKVjiQh; 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 S237145AbjEaOIm (ORCPT + 99 others); Wed, 31 May 2023 10:08:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47596 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235420AbjEaOI1 (ORCPT ); Wed, 31 May 2023 10:08:27 -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 1AA3110F8 for ; Wed, 31 May 2023 07:03:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685541721; 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=ziEVWybyK4gf6HAMK2OABfQt5DxF+29cSopVoad9/Oc=; b=MmKVjiQhuSASBSMtKq48N5dSt9moWK5rcI66Qzj2mVKQ5q+9nCSCpCqsGVaZW/g0c4syr9 TTLwNX2sPXF/jxHoMn3KGkje36eaMQdqp9BOyosarjlsU7/8Uv6dspoTfav0p9hGkRVydn ulEYvlyZ7QTDPupWPynB30RxhpWoZ/M= 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-205-8xAnoC19Ms-okkMyrsc2Qw-1; Wed, 31 May 2023 09:55:41 -0400 X-MC-Unique: 8xAnoC19Ms-okkMyrsc2Qw-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D5F228032E4; Wed, 31 May 2023 13:55:40 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.42.28.182]) by smtp.corp.redhat.com (Postfix) with ESMTP id E03D6C154D7; Wed, 31 May 2023 13:55:37 +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: <492558dc-1377-fc4b-126f-c358bb000ff7@redhat.com> References: <492558dc-1377-fc4b-126f-c358bb000ff7@redhat.com> <20230526214142.958751-1-dhowells@redhat.com> <20230526214142.958751-2-dhowells@redhat.com> <510965.1685522152@warthog.procyon.org.uk> To: David Hildenbrand Cc: dhowells@redhat.com, Christoph Hellwig , Lorenzo Stoakes , 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: [PATCH v4 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: <703627.1685541335.1@warthog.procyon.org.uk> Content-Transfer-Encoding: quoted-printable Date: Wed, 31 May 2023 14:55:35 +0100 Message-ID: <703628.1685541335@warthog.procyon.org.uk> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 X-Spam-Status: No, score=-2.3 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=unavailable 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 David Hildenbrand wrote: > Yes, it would be clearer if we would be using "pinned" now only for FOLL= _PIN You're not likely to get that. "To pin" is too useful a verb that gets us= ed in other contexts too. For that reason, I think FOLL_PIN was a poor choic= e of name:-/. I guess the English language has got somewhat overloaded. Maybe FOLL_PEG? ;-) > and everything else is simply "taking a temporary reference on the page"= . Excluding refs taken with pins, many refs are more permanent than pins as,= so far as I'm aware, pins only last for the duration of an I/O operation. > >> "Note that the refcount of any zero_pages returned among the pinned p= ages will > >> not be incremented, and unpin_user_page() will similarly not decremen= t it." > > That's not really right (although it happens to be true), because we'r= e > > talking primarily about the pin counter, not the refcount - and they m= ay be > > separate. > = > In any case (FOLL_PIN/FOLL_GET) you increment/decrement the refcount. If= we > have a separate pincount, we increment/decrement the refcount by 1 when > (un)pinning. FOLL_GET isn't relevant here - only FOLL_PIN. Yes, as it happens, we coun= t a ref if we count a pin, but that's kind of irrelevant; what matters is that= the effect must be undone with un-PUP. It would be nice not to get a ref on the zero page in FOLL_GET, but I don'= t think we can do that yet. Too many places assume that GUP will give them = a ref they can release later via ordinary methods. David