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 F1134EB64DD for ; Tue, 27 Jun 2023 16:01:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 963A08D0003; Tue, 27 Jun 2023 12:01:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9138E8D0001; Tue, 27 Jun 2023 12:01:50 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7B4FE8D0003; Tue, 27 Jun 2023 12:01:50 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 6D0E88D0001 for ; Tue, 27 Jun 2023 12:01:50 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 57BC2140A7F for ; Tue, 27 Jun 2023 16:01:43 +0000 (UTC) X-FDA: 80948993286.02.6157EE0 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf01.hostedemail.com (Postfix) with ESMTP id 3AB29400A5 for ; Tue, 27 Jun 2023 16:00:43 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=h+Gq7Dnq; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf01.hostedemail.com: domain of peterx@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=peterx@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1687881644; 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:in-reply-to:references:references:dkim-signature; bh=pj+zOzmUOF0cqvoi71YUgGQfKZGwkYWd7D7VJ4Uthv0=; b=VFRRQYdzUaoDt4BOXZ1PRUfjtQWIxSoX3L3FUV0eDflnAZSNgoJ6RUJZ0OjFzJZ1/AQmfe 2ad7aaDH+Y4x87IWUOqh0vrVbHoBq3Kf5bkBHg3wJsR0/+DPZHuVr1Bk61Nl57v/I4vBqv E4pGbqSF1iPEV156dt9aHsrgRlTzReU= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=h+Gq7Dnq; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf01.hostedemail.com: domain of peterx@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=peterx@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1687881644; a=rsa-sha256; cv=none; b=tG0B4NOWiceYbAnCfQzu5fKhacliTX3c4wG79L7omVn/KecQc99I1PI6OJ9cVL4Yn0yOIi c48UThNjEXqNjsrS5f+euzbqKYESEagGovrZMPGTImyr98CzGIPvCzNpJPjKYgDgtNnNTM V+ZlpGdcqUIDSVyeB7rPRxY0jkFsbAA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687881643; 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=pj+zOzmUOF0cqvoi71YUgGQfKZGwkYWd7D7VJ4Uthv0=; b=h+Gq7Dnq23acIY8nA3z2H+44SEGsuNUfrakzmftRL68a0VtzOyRjlcWoo1+xFS35FSIaQ+ MmBY2JgbRvAs1O0g0tuYaBpHy3uZKamUzjYGhoiYWLkYAbnLaBnFTI6Vp8T4UAKZGZ9SVD K6sAyTfCIXF1iE4zZG1QpMODF3KjPgA= Received: from mail-ua1-f72.google.com (mail-ua1-f72.google.com [209.85.222.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-101-cEAs5Wa3MPqIguaElEHQig-1; Tue, 27 Jun 2023 12:00:41 -0400 X-MC-Unique: cEAs5Wa3MPqIguaElEHQig-1 Received: by mail-ua1-f72.google.com with SMTP id a1e0cc1a2514c-7944afceb23so17450241.0 for ; Tue, 27 Jun 2023 09:00:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687881640; x=1690473640; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=pj+zOzmUOF0cqvoi71YUgGQfKZGwkYWd7D7VJ4Uthv0=; b=CzEGdBA3BPKzrOBVm79BOp6/buKcWgff/Y9JC+Z6aeaYOrBxz5938fYXZqq75b3KbK ixFeJ44U5kdWfjb0UTehsBYO5cMWORLTSI6vyEWuJUR3xuEpU95k4ryt4bIAKKRqmooJ Rx+ezqNS5s9oi5jdSiLNtfIsGNQBi+Ty5QkwI+Mj12QO85taF0KX6Cqxnpog2W1OEi/s fwGn8hpMXY6uNFCaYlBMoUhWhVLHCzk/qFhENVZQyiVNduzSkm35rL7YPX1dxPiwz8Fp IKFaP8Ok0m4ex8jEX/ydE/PUBFyFPSaMSiGe958CnTO0+21UYyTiRsLQcTlMX/fypXc6 +m/g== X-Gm-Message-State: AC+VfDySRgo+dGN5gOe1Mvz+XSsSoB97YQ49TCKsIrVzVM0P4h76C4fu aWmrM6ItCkaaPCAW9St65gMRoMqZaslcUU6set55UfffapYlH4NP3YTjkA2Uoo/qeXZTupdL5w0 HHg/BkMvuH0Q= X-Received: by 2002:a05:6102:ed0:b0:440:b01a:5c1a with SMTP id m16-20020a0561020ed000b00440b01a5c1amr11686237vst.2.1687881640295; Tue, 27 Jun 2023 09:00:40 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7xVFFwcrphaqlcGPfMPVlXHfKmzWiSqArAVdBUA8Cx9G2oeekuo3uEn/YLT+Qi8i+897tJMQ== X-Received: by 2002:a05:6102:ed0:b0:440:b01a:5c1a with SMTP id m16-20020a0561020ed000b00440b01a5c1amr11686193vst.2.1687881640022; Tue, 27 Jun 2023 09:00:40 -0700 (PDT) Received: from x1n (cpe5c7695f3aee0-cm5c7695f3aede.cpe.net.cable.rogers.com. [99.254.144.39]) by smtp.gmail.com with ESMTPSA id n10-20020a0cec4a000000b0060530c942f4sm4686678qvq.46.2023.06.27.09.00.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jun 2023 09:00:39 -0700 (PDT) Date: Tue, 27 Jun 2023 12:00:38 -0400 From: Peter Xu To: Jason Gunthorpe Cc: David Hildenbrand , "Kasireddy, Vivek" , "dri-devel@lists.freedesktop.org" , "linux-mm@kvack.org" , Mike Kravetz , Gerd Hoffmann , "Kim, Dongwon" , Andrew Morton , James Houghton , Jerome Marchand , "Chang, Junxiao" , "Kirill A . Shutemov" , "Hocko, Michal" , Muchun Song , John Hubbard Subject: Re: [PATCH v1 0/2] udmabuf: Add back support for mapping hugetlb pages Message-ID: References: <20230622072710.3707315-1-vivek.kasireddy@intel.com> <6e429fbc-e0e6-53c0-c545-2e2cbbe757de@redhat.com> MIME-Version: 1.0 In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Disposition: inline X-Rspam-User: X-Stat-Signature: atcc3yakywe4k4y3j36urjy44k8499bg X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 3AB29400A5 X-HE-Tag: 1687881643-148211 X-HE-Meta: U2FsdGVkX18rkkRt0q/xwCC5X9HkWGPa46PHxZDOe/bRE0KODzOqRPQmI7PLjiB000MLs0xTfnmjifabzpnGyxAFbrf/J9KIXDFi8NKDZlvix61PTIY1M9IpBU6KVagQeUigwIT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pQ55/0Z/Ed7j7nuva/T3OVYs1HlqyMK6NsTsiT6EWCh6shr++eUcPSPY3iUMRhoU2HKaUeh4jyxvDxDm5cs3aZiPJHcN0VUevlCMS+MSTmoNDivdwrS3xlRsFHRjYfdf2Fmi0mxPjWtMT/SkQNCbkTN4d+xfcif7z2GkJ9tWMWKh4hDoCq5Mj9Z0Ve3QX9oXsaQUg== 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: On Tue, Jun 27, 2023 at 12:52:34PM -0300, Jason Gunthorpe wrote: > On Mon, Jun 26, 2023 at 03:04:21PM -0400, Peter Xu wrote: > > On Mon, Jun 26, 2023 at 03:18:48PM -0300, Jason Gunthorpe wrote: > > > On Mon, Jun 26, 2023 at 08:14:27PM +0200, David Hildenbrand wrote: > > > > > > > So we might have to implement the same page migration as gup does on > > > > FOLL_LONGTERM here ... maybe there are more such cases/drivers that actually > > > > require that handling when simply taking pages out of the memfd, believing > > > > they can hold on to them forever. > > > > > > In general I would like to see an interface to FOLL_LONGTERM pin pages > > > from a memfd. I would quite happily use that in iommufd as well. > > > > > > It solves some problems we have there with fork/exec/etc if the pages > > > are not linked to a mm_struct. > > > > Afaiu any fd based approach should mean it'll never work with private > > memories, while mm-based should be able to work on any kind. > > Is there a significant use case to open a memfd and then use > MAP_PRIVATE? Why would anyone want to do that instead of just using > normal mmap anonymous memory? I remember David Hildenbrand somewhere mentioned the use case where one wants to snapshot a VM RAM into a file, then start multiple instances by loading that VM RAM with MAP_PRIVATE, so it clones a bunch of snapshoted VM running with a single RAM file shared as a template. Not a generic use case, I guess. My question applies not only memfd but also in general - qemu by default doesn't use memfd afaict, so it boils down to e.g. whether you'll target the iommufd project to work in that case, where qemu uses anonymous memory. Privately mapped file memory is only one of those kinds. -- Peter Xu