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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9E6A1C433F5 for ; Fri, 8 Oct 2021 07:44:07 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 2C76A61027 for ; Fri, 8 Oct 2021 07:44:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 2C76A61027 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id AB8716B0071; Fri, 8 Oct 2021 03:44:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A418B6B0072; Fri, 8 Oct 2021 03:44:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8E199900002; Fri, 8 Oct 2021 03:44:06 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 7C7FF6B0071 for ; Fri, 8 Oct 2021 03:44:06 -0400 (EDT) Received: from smtpin05.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 27C5A39471 for ; Fri, 8 Oct 2021 07:44:06 +0000 (UTC) X-FDA: 78672481692.05.48B1A5C Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf07.hostedemail.com (Postfix) with ESMTP id A77BD1001CB3 for ; Fri, 8 Oct 2021 07:44:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633679045; 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=u7mEpKXIXki4+AfZLhYahWvke1tUWfWxeSdFeF0Y8RQ=; b=EjIuBF/m7p67TShfNm1PpNZaPF1rPelqQjlOWQuOYx1LfGozDxPt8wVED9DbwLanwo7DR1 roY4DN3dm5tqALmuwhfEULceDM5SMoNT8yaUTPLi0D9+4FxD9HDhw0ZRUYb0XiLASv2AMz YlbsyQO5V+JiGC04o5AhaWh0A1Z0kv0= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-540-zoQM0gQUMEu6cq28GX0yyg-1; Fri, 08 Oct 2021 03:44:04 -0400 X-MC-Unique: zoQM0gQUMEu6cq28GX0yyg-1 Received: by mail-wr1-f70.google.com with SMTP id 41-20020adf812c000000b00160dfbfe1a2so2941920wrm.3 for ; Fri, 08 Oct 2021 00:44:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:to:cc:references:from:organization:subject :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=u7mEpKXIXki4+AfZLhYahWvke1tUWfWxeSdFeF0Y8RQ=; b=vZa3z3FhBWIpD05J9lLAB2cXwo0YSWUL/lXdYverL5rjzMM6qagCIPbP0XnVN94Vs3 Bt8wbvrt9oBt2p/fdE5qRkXc/3G0M7mAuV3wXKZUQDBNt8NNswSML8mo4WotX5NdyYLr pinEfcI3nNqihzXuag3MLtSvU1dl6N81B+LPq/bokgnbU4pHakth7gF09iNB0645WPZZ GI8kKJeYVCFxtZ786xuAeWhyOVE+t928vhePB6qYuItjVcZh2AqP79zyOfYk4UPw7A41 6Xip+XfTebD39GI2EXIN7W9ft+qR4Mx6X43wvcE+rdHJRk1p/J5mqlMXDbmOJJahe2nn uDRw== X-Gm-Message-State: AOAM531cKKzffy6sSRUsJmaVVqol2gppKIZ+/cwSkD61yss9jw+70bc4 +erUxnL+F59jZA4RORmCDLWrB/voyzIQGvhozbsb/GXVzegeROz8dJjM/JPKp1+lX32/pSB3wK7 WzcjPkpqsNpY= X-Received: by 2002:a1c:22d7:: with SMTP id i206mr1764281wmi.122.1633679042851; Fri, 08 Oct 2021 00:44:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzFPZDiPSVeT3d38H8Z/bNS65Xx9+eqy3hlmwhiYjlLCPHXHl/2fm5Cekwbs4vZT55wYV26kg== X-Received: by 2002:a1c:22d7:: with SMTP id i206mr1764260wmi.122.1633679042645; Fri, 08 Oct 2021 00:44:02 -0700 (PDT) Received: from [192.168.3.132] (p5b0c676e.dip0.t-ipconnect.de. [91.12.103.110]) by smtp.gmail.com with ESMTPSA id u5sm1676921wrg.57.2021.10.08.00.44.00 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 08 Oct 2021 00:44:01 -0700 (PDT) To: Rasmus Villemoes , John Hubbard , Suren Baghdasaryan , Kees Cook Cc: Michal Hocko , Pavel Machek , Andrew Morton , Colin Cross , Sumit Semwal , Dave Hansen , Matthew Wilcox , "Kirill A . Shutemov" , Vlastimil Babka , Johannes Weiner , Jonathan Corbet , Al Viro , Randy Dunlap , Kalesh Singh , Peter Xu , rppt@kernel.org, Peter Zijlstra , Catalin Marinas , vincenzo.frascino@arm.com, =?UTF-8?B?Q2hpbndlbiBDaGFuZyAo5by16Yym5paHKQ==?= , Axel Rasmussen , Andrea Arcangeli , Jann Horn , apopple@nvidia.com, Yu Zhao , Will Deacon , fenghua.yu@intel.com, thunder.leizhen@huawei.com, Hugh Dickins , feng.tang@intel.com, Jason Gunthorpe , Roman Gushchin , Thomas Gleixner , krisman@collabora.com, Chris Hyser , Peter Collingbourne , "Eric W. Biederman" , Jens Axboe , legion@kernel.org, Rolf Eike Beer , Cyrill Gorcunov , Muchun Song , Viresh Kumar , Thomas Cedeno , sashal@kernel.org, cxfcosmos@gmail.com, LKML , linux-fsdevel@vger.kernel.org, linux-doc@vger.kernel.org, linux-mm , kernel-team References: <20211006175821.GA1941@duo.ucw.cz> <92cbfe3b-f3d1-a8e1-7eb9-bab735e782f6@rasmusvillemoes.dk> <20211007101527.GA26288@duo.ucw.cz> <202110071111.DF87B4EE3@keescook> From: David Hildenbrand Organization: Red Hat Subject: Re: [PATCH v10 3/3] mm: add anonymous vma name refcounting Message-ID: Date: Fri, 8 Oct 2021 09:43:59 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: A77BD1001CB3 X-Stat-Signature: t4ztp1157fwiikaf5a4f4nw4to5b8w8s Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b="EjIuBF/m"; spf=none (imf07.hostedemail.com: domain of david@redhat.com has no SPF policy when checking 170.10.133.124) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-HE-Tag: 1633679045-211849 Content-Transfer-Encoding: quoted-printable 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 08.10.21 09:25, Rasmus Villemoes wrote: > On 07/10/2021 21.02, John Hubbard wrote: >> On 10/7/21 11:50, Suren Baghdasaryan wrote: >> ... >=20 >>>>> The desire is for one of these two parties to be a human who can ge= t >>>>> the data and use it as is without additional conversions. >>>>> /proc/$pid/maps could report FD numbers instead of pathnames, which >>>>> could be converted to pathnames in userspace. However we do not do >>>>> that because pathnames are more convenient for humans to identify a >>>>> specific resource. Same logic applies here IMHO. >>>> >>>> Yes, please. It really seems like the folks that are interested in t= his >>>> feature want strings. (I certainly do.) For those not interested in = the >>>> feature, it sounds like a CONFIG to keep it away would be sufficient= . >>>> Can we just move forward with that? >>> >>> Would love to if others are ok with this. >>> >> >> If this doesn't get accepted, then another way forward would to contin= ue >> the ideas above to their logical conclusion, and create a new file sys= tem: >> vma-fs. >=20 > Or: Why can't the library/application that wants a VMA backed by memory > to have some associated name not just >=20 > fd =3D open("/run/named-vmas/foobar#24", O_CLOEXEC|O_RDWR|O_EXCL|O_C= REAT); > unlink("/run/named-vmas/foobar#24"); > ftruncate(fd, ...); > mmap(fd); >=20 > where /run/named-vmas is a tmpfs (probably with some per-user/per-app > subdirs). That requires no changes in the kernel at all. Yes, it lacks > the automatic cleanup of using real anon mmap in case there's a crash > between open and unlink, but in an environment like Android that should > be solvable. I'm going to point out that we already do have names for memfds. "The name supplied in name is used as a filename and will be displayed=20 as the target of the corresponding symbolic link in the=20 directory /proc/self/fd/." It's also displayed in /proc/self/maps. So theoretically, without any kernel changes one might be able to=20 achieve something as proposed in this patch via memfd_create(). There is one issue to be fixed: MAP_PRIVATE on memfd results in a double memory consumption on any=20 access via the mapping last time I checked (one page for pagecache, one=20 page for private mapping). --=20 Thanks, David / dhildenb