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 4AE84C36010 for ; Fri, 4 Apr 2025 10:20:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A2921280004; Fri, 4 Apr 2025 06:20:19 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9D8C9280003; Fri, 4 Apr 2025 06:20:19 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8A05F280004; Fri, 4 Apr 2025 06:20:19 -0400 (EDT) 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 6A14F280003 for ; Fri, 4 Apr 2025 06:20:19 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 4FF101A2564 for ; Fri, 4 Apr 2025 10:20:20 +0000 (UTC) X-FDA: 83295966600.30.0364E55 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf24.hostedemail.com (Postfix) with ESMTP id 6C209180006 for ; Fri, 4 Apr 2025 10:20:18 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=PZMfxUvv; dmarc=pass (policy=quarantine) header.from=redhat.com; spf=pass (imf24.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.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=1743762018; 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:in-reply-to: references:dkim-signature; bh=ZM0A/oRdmAxA5jmTmP75juZ/meSWa8jgxrQORVgbvvg=; b=uZNMPzCurmRcNhFttLJI0UyRKB82v//jvNcNG8a7YkuBSah/GwP6PCrD2Gzxj7EpcuHRRj jbKCWh3kmM0xERrEOb0YW4eTH0tSnfnRVKwoY5T64DM0EjskcgcKKBQDshdNsmhSJpNNeT 4cQnRytMDNSVzDr3yod9AcTJx0itZTM= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=PZMfxUvv; dmarc=pass (policy=quarantine) header.from=redhat.com; spf=pass (imf24.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1743762018; a=rsa-sha256; cv=none; b=26dVaZ5Za1JTizOC4JECMFtyHhyMpT4OR5QlHP1UV76W5G4CXHAjvWphGdqJq/mIgp+iZD gFB+r7XAlbwL4mItOPledpITayTkuvWNH1F33nIZpsN2Ayaai+hEbjXHhIU/5lP7ILkNev QqNK6GQCu7BoJa1c/G/0w9tXbU33xXQ= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1743762017; 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; bh=ZM0A/oRdmAxA5jmTmP75juZ/meSWa8jgxrQORVgbvvg=; b=PZMfxUvv4qYmfz2H7HGCsZ0r0hioHuLQR5WmOyzT0ka8AVcRSNbdWdxsE9AQW2kMLCgOUt XyZ9A+dQce1gO4jOxTU5g+AdU1wsTDZ2Guiwe0vhwmXbHLo60ohXpEAi2Em8mU/CGYXq+z pr3amrnCh+W0IIRsnB1KJfrpmL9P8Y4= Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-32-gRfsPYc7OOyFT85TfoRdNQ-1; Fri, 04 Apr 2025 06:20:14 -0400 X-MC-Unique: gRfsPYc7OOyFT85TfoRdNQ-1 X-Mimecast-MFC-AGG-ID: gRfsPYc7OOyFT85TfoRdNQ_1743762013 Received: from mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.40]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 3D96219560B4; Fri, 4 Apr 2025 10:20:13 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.42.28.40]) by mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id CE81B19560AD; Fri, 4 Apr 2025 10:20:10 +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 To: "Kirill A. Shutemov" , John Hubbard , David Hildenbrand cc: dhowells@redhat.com, hch@infradead.org, willy@infradead.org, linux-mm@kvack.org Subject: Does GUP page unpinning have to be done in the pinning context? MIME-Version: 1.0 Date: Fri, 04 Apr 2025 11:20:09 +0100 Message-ID: <939183.1743762009@warthog.procyon.org.uk> X-Scanned-By: MIMEDefang 3.0 on 10.30.177.40 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: gZpuj4Syfha4F8AfHvVgOY_TeUkENQ4h1kiC2LblTQ4_1743762013 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="us-ascii" Content-ID: <939182.1743762008.1@warthog.procyon.org.uk> X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: 6C209180006 X-Stat-Signature: 1uyggd347s4wk8gp9sn7ocbw1jceopup X-Rspam-User: X-HE-Tag: 1743762018-335559 X-HE-Meta: U2FsdGVkX19j+6fbQCXqITUe5WsxH9dH3CSni7TXmxhWwixilxtn5NjJ2Hky0+8dBQPVBLBTVkvoh9eMPSA/0nI5lYR0CRsayorCfegcMlc2T8Y6hM48AUujZk/cp82n4owvo1DjUtbA4uoM0jZn+/aE6m6kEo+Hf3yG+YC6djHtwM3sDWV3Xs7FlY/8nQi5+HK/4nJYubJKwO6fCHlrFR5skcvnj2aNFop1myAYJsgVhLRzEog9N0MJ2Sw3bZ9VwaFDff75g9lTZPKVQYD4Vrw1IC4/uTrDNL103TMsVnCSjWrDs7rivu1UB0+whalpxLez/CBp29TL2JzyPpRdqZVx4X3RWcqfRerm+c9iL05GS20w+kQ3J2HhDGHuVxGzma3YiALjiORi5CwNYLjqXferjV0bP2uw7mxahk88cKlXauhWFtLUiAeRAm5DgotCYF9FxON9ri501evduec0pBdlA6r3LJ723QjIsOHL+xOo4t0R7usxlpNmE/tGTYD+8VfySApPDHB48dcpLIuRV440N/O62uDjpUHSVsTWYu6UkEdu/8vyUrAjJVtWeXyuiM3o++MKVXCoVAfyTH/o6L3q8aHDdhb9d5kPi73H5+ATzA6SfUvCIGpKVXSVOtztQSJ75ubUenMVXIaQb1O8bJ1DHjaDOVvpysO3g0fKN6jiEIIfrYMKDj4IPDtdWf280l9jv93jWF7CscaFpdyZO3gmJ1/B3ERzLQ/hCAbmCRE7oU3lJT9QNo+hHAE0YZ+mKUYjLr1vQb4OWUD7GczYY/vI9xDQho5GaAE0iDPiHNNhHLlSGR2u/76Jks5ekjIMugMTwymCG0UnR0iMbG29QodYizYlCWfwLXpPXMWSdn5b6Too9yTMxbydLmgXwd+GGQYLJ9kr5IS6yda68aoXLRRaVZlBhUfohm9117mM89kY6r9yAlx/F7mg6DxM4mmo3NDcHJ9jJ56xARi2NlC OU2BbxVy BjdOmxQGxZEYatpzT2AIxmjPj1rdgifZ8ISAPdPNPVCCdAyFBzqUvlvF1t3W7vpvDXx/b+VufXJD4caCEF3lcgkmZs5q/S0EKKaEjNuqvmn/ylIhpC7Ty3f7ci8E++bKd2bDxh8XC/Z9lNq9dlbV/T++GYrnZQMxJAKGa6Th/Exdp5oAHosxTtf7k4DK9CW28eUxygzg7WAhm5LQrm3kwqydzP3b2m55kHDParIk1pzYUB/mb0J/qrLZ8PZ+Ryxb64YQo5my7wXG5HvTXoDO4rtcZqMFL3BH8C2Sgpb4o+IViJsb1H+XZxiUxAObbSrUU/ZnFp+Mzd8A/zBBQsAIFPP8v0pghiwbKEWGmhBoFnzTYPieA+iMmw7sE1L2KqfSFjuLRaA5G9NLa1a11PNDTBh/4zuMJKI7iYgZ0rlZwSTiJfxALnYQ5/8Jb8Q== 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: List-Subscribe: List-Unsubscribe: Hi Kirill, John, David, I don't know if you're the experts on GUP, but can you tell me if unpinning, e.g. unpin_user_page(), needs to be done in the same MM context and/or the same user context as the initial pinning? And, if so, is there some way to break that link? I'm looking at how I might extend page pinning into the socket layer and sendmsg(MSG_ZEROCOPY). The problem is that sendmsg() merely queues the buffers with no guarantee that it's finished with them by the time it's returned. You get a SO_EE_ORIGIN_ZEROCOPY message to tell you that. I have to deal with the issue that the process that did the sendmsg(), the MM context and the user context may all have ceased to exist by the time the transmission completes if I don't pin them. Thanks, David