Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp1333150pxb; Thu, 7 Oct 2021 05:50:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx5wjWtsg/F8VPKnTtDIG+oxl4WESCRzCEPIVINXFVOGj6epjlC8ziIpd8s5z1iExJokWf6 X-Received: by 2002:a17:906:3b44:: with SMTP id h4mr5566264ejf.402.1633611028976; Thu, 07 Oct 2021 05:50:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633611028; cv=none; d=google.com; s=arc-20160816; b=QH/nvRRYjg5+GrBlbKz0RzOuUi3sfq4iVd9ddBt3+G3AjKzgtVvPzxarthygleJZHG fDxC2ZnbgW8pIW450Rdl4/er0HrtKmR0l4XoWh013zrrqkRt+93ZHBblSuRga17TrYO7 2WUeJtx/kMyLvJ2I2KpQ2ds/m9skAaF8hKvTsevhWmsF9/+igy/PpIkAt7wXz5k027La SdNaEvjPsJTeHYXdW/6VxhFjxRmgsI79XaLVuZ30BLyWP9TKkczUjOPMlaFvz1LUvOfb jf68vbQk2hiYvSHtaa2lCrNIGCNMPP3VjDPruowRyyuTFxwMYZ3Bc9AEEgyqxAGcYIFi QExg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=S7iU2wGZFfI+Aa1bJEr2ZbmYg4Q9xVM7AdOmOD0IpYE=; b=BKWZKwovg7uejbeO9stnBSJSrqLCW7jqgXKrByRaKKtroKQSe1KL9t04cGuKsrw+p4 QHI5CU+GD2tEBvduHaS03dSwG3um/dFZhHznW6l8STEXysJk1iIM4kT+7pRp5YCnW9VA OIhOGPN3fBSULAy7bHaCt45x5KCQH+IWZcdqjY8JULwDPQHddoJghhJABg+GHgPk1M0l J5pP/bZFVQ/Wq7UxcldxeebRIiRf4fDLWxEx/qGjOP1v83X9c8trWh+xB5JkihWKxRJZ Y7h5RvkT7lQSt8bD8pA2FFCUb5omv9UOIu3n4p0J7sNZkH7JyMEWbVz/qZ3SKv+LyowB ZZcA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id mp29si29711544ejc.290.2021.10.07.05.49.59; Thu, 07 Oct 2021 05:50:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240688AbhJGKRY (ORCPT + 99 others); Thu, 7 Oct 2021 06:17:24 -0400 Received: from jabberwock.ucw.cz ([46.255.230.98]:53276 "EHLO jabberwock.ucw.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230060AbhJGKRX (ORCPT ); Thu, 7 Oct 2021 06:17:23 -0400 Received: by jabberwock.ucw.cz (Postfix, from userid 1017) id 4515F1C0B87; Thu, 7 Oct 2021 12:15:28 +0200 (CEST) Date: Thu, 7 Oct 2021 12:15:27 +0200 From: Pavel Machek To: Rasmus Villemoes Cc: Michal Hocko , Suren Baghdasaryan , David Hildenbrand , John Hubbard , Andrew Morton , Colin Cross , Sumit Semwal , Dave Hansen , Kees Cook , 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, Chinwen Chang =?utf-8?B?KOW8temMpuaWhyk=?= , 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 Subject: Re: [PATCH v10 3/3] mm: add anonymous vma name refcounting Message-ID: <20211007101527.GA26288@duo.ucw.cz> References: <20211005200411.GB19804@duo.ucw.cz> <6b15c682-72eb-724d-bc43-36ae6b79b91a@redhat.com> <20211006175821.GA1941@duo.ucw.cz> <92cbfe3b-f3d1-a8e1-7eb9-bab735e782f6@rasmusvillemoes.dk> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="DocE+STaALJfprDB" Content-Disposition: inline In-Reply-To: <92cbfe3b-f3d1-a8e1-7eb9-bab735e782f6@rasmusvillemoes.dk> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --DocE+STaALJfprDB Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi! > >> Hmm, so the suggestion is to have some directory which contains files > >> representing IDs, each containing the string name of the associated > >> vma? Then let's say we are creating a new VMA and want to name it. We > >> would have to scan that directory, check all files and see if any of > >> them contain the name we want to reuse the same ID. > >=20 > > I believe Pavel meant something as simple as > > $ YOUR_FILE=3D$YOUR_IDS_DIR/my_string_name > > $ touch $YOUR_FILE > > $ stat -c %i $YOUR_FILE >=20 > So in terms of syscall overhead, that would be open(..., O_CREAT | > O_CLOEXEC), fstat(), close() - or one could optimistically start by You could get to two if you used mkdir instead of open. > > YOUR_IDS_DIR can live on a tmpfs and you can even implement a policy on > > top of that (who can generate new ids, gurantee uniqness etc...). > >=20 > > The above is certainly not for free of course but if you really need a > > system wide consistency when using names then you need some sort of > > central authority. How you implement that is not all that important > > but I do not think we want to handle that in the kernel. >=20 > IDK. If the whole thing could be put behind a CONFIG_ knob, with _zero_ > overhead when not enabled (and I'm a bit worried about all the functions > that grow an extra argument that gets passed around), I don't mind the > string interface. But I don't really have a say either way. If this is ever useful outside of Android, eventually distros will have it enabled. Best regards, Pavel --=20 http://www.livejournal.com/~pavelmachek --DocE+STaALJfprDB Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABECAB0WIQRPfPO7r0eAhk010v0w5/Bqldv68gUCYV7IvwAKCRAw5/Bqldv6 8ij3AKCob2c0ihsUF0OGRBWpcwK/HrL/WwCfUjg8l8NuDcUriv7uo2C8eR0uTy8= =1GxR -----END PGP SIGNATURE----- --DocE+STaALJfprDB--