Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp601969pxb; Wed, 6 Oct 2021 11:20:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyx05yUlk70QYi8WpWsVlK5yaL4c4Q/8m6sBfWVzsSC8aTsE1bIe0W+NbhiXJPr3/ZK6b2w X-Received: by 2002:a17:90a:5a86:: with SMTP id n6mr132271pji.3.1633544407510; Wed, 06 Oct 2021 11:20:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633544407; cv=none; d=google.com; s=arc-20160816; b=HqaDLRIHpYrXGTwGJTyyYR2zmwMaFhwOVWVMwI3mZiCfy57nG0Lj5kEpkFQkW7SHWW gagMnytzFSaw8fUuB2lNprRdw16haar6p9Hl1H3dTbA2WFh5eM7WJv6TLQ8zpL8Xsy9r zBtgU4dGTG2+yJrSs2ZfOis7iulETAhaVUvvRvqyKFHKQ0xRINH9j74Wmgk0FwuQCrzy IKiklD3dnwxu7uBtxq0IpiembS+JI2iV0IZPt6B6YzTDQqeOSv4XBKW0wRZCan1g8ji3 FlskPwpRI9jWkngIsQ0RcT83OtPWNsbwPUb811RPx1ziJyb9krLCgzetkW3c6825gONn +Gkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=tS0Q/doPfkgcSn/P1ry79XfUH0i7iJLfycZHaCEByaw=; b=fZ2hspXoUlk8qb0XAenzG9hnyDdvR108KUQ9p7QvZDZ4ePIBb5c5vqxGKSM4MsT69g +NxzajMMeHSmPOpghD82y5Xob98SVjnp2izpp/w+9CykcM59VIhphdjEb/+aFcGic8sf o+W8piav2gVn+/3zIHJySTDuAF3cBBseI2FG6TJAH1pHmrndyM3JFEEW/RPXgyn5Govw 8W3vpsooWFUsmiEVyj6GOD3A242N4H/HkYfHP+2Fv6s69cmD+k40ofXlVuWITE2NkbYH SGYy2ajQaPQCL/ujQ8z33hIpJySRoD6sDtOGksICLHyurNp3oC9GSPqw2m5sJ7sptool hYaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=TYlphAvw; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ng18si1428025pjb.60.2021.10.06.11.19.52; Wed, 06 Oct 2021 11:20:07 -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; dkim=pass header.i=@google.com header.s=20210112 header.b=TYlphAvw; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238119AbhJFSUg (ORCPT + 99 others); Wed, 6 Oct 2021 14:20:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35804 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231633AbhJFSUf (ORCPT ); Wed, 6 Oct 2021 14:20:35 -0400 Received: from mail-yb1-xb35.google.com (mail-yb1-xb35.google.com [IPv6:2607:f8b0:4864:20::b35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 80F89C061753 for ; Wed, 6 Oct 2021 11:18:43 -0700 (PDT) Received: by mail-yb1-xb35.google.com with SMTP id s64so7428939yba.11 for ; Wed, 06 Oct 2021 11:18:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=tS0Q/doPfkgcSn/P1ry79XfUH0i7iJLfycZHaCEByaw=; b=TYlphAvwMJftzt6RU5u9b6mLtXkIqYWFA04tNKYd2B2kJaBNHrvFS+iWcxQyx65O49 VEw0jFjeBxrJigtMkEwMctb8oSbx+fuz5GPExgicIXWNFArloubetA2TV3UEBOxGB59S 4/eOuXBnAvuNH7y8YiILc6KY9YVEnat4qn2XUv33xrzz3GJLMCPCjq1bI/veMmjJStMA mw1RSKpfndHUtx7NSTXL90xYj4QC8EJDHuoNRRjBjJoyYzyw7iirxJ6l/qIOOS8/aEEI zLEZyLx56Nk0A1AScwAL4V61zvIuQvil+E41AYH4QmyoGC+u+esm8H+BU3U5aLJkJiKd +gpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=tS0Q/doPfkgcSn/P1ry79XfUH0i7iJLfycZHaCEByaw=; b=C7vi3WDJd8WmGcavsYgTC3eCOEk7J7nnYHAAHTSBRm6T/uxIB2aMw8peJ4GNjy7TD5 8VzGpRzwAoyiaIu42wh+uYQqZJd6vBsBlfbQLH7kmlviLWXFfD35wCpxXdSfGG8F3igI YtMh98NERpjZtbdKVsKDadSnyzoxK3luxmgMEZBfqY2zD5kdrdqwcPcgNibi/SD8BLlo A/twKKP0xXNQKdnFaYEDQbxAyEHBC3fQjiSAiEzxs1qvRgVJRciU76Pt8p4fizGz4jjd dp4APdt1rkuBjSxwa09okDOOLFMOsgA0UrQkc703zcV0MmPQV18Nw/opmsYw09bIGCa0 Hp2g== X-Gm-Message-State: AOAM530N3CSY7kY5Mokr7jqsVR2yrxUFQ+1tXTqlaHeoa8ThViWRGcuc S+UqIyEhVtlYcGV8Otai/2yJiCRhAl6fKv3tufuMWA== X-Received: by 2002:a25:552:: with SMTP id 79mr29984731ybf.202.1633544322361; Wed, 06 Oct 2021 11:18:42 -0700 (PDT) MIME-Version: 1.0 References: <20211001205657.815551-1-surenb@google.com> <20211001205657.815551-3-surenb@google.com> <20211005184211.GA19804@duo.ucw.cz> <20211005200411.GB19804@duo.ucw.cz> <6b15c682-72eb-724d-bc43-36ae6b79b91a@redhat.com> <20211006175821.GA1941@duo.ucw.cz> In-Reply-To: <20211006175821.GA1941@duo.ucw.cz> From: Suren Baghdasaryan Date: Wed, 6 Oct 2021 11:18:31 -0700 Message-ID: Subject: Re: [PATCH v10 3/3] mm: add anonymous vma name refcounting To: Pavel Machek Cc: David Hildenbrand , Michal Hocko , 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, =?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, Rasmus Villemoes , LKML , linux-fsdevel@vger.kernel.org, linux-doc@vger.kernel.org, linux-mm , kernel-team Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 6, 2021 at 10:58 AM Pavel Machek wrote: > > Hi! > > > > I can understand that having a string can be quite beneficial e.g., when > > > dumping mmaps. If only user space knows the id <-> string mapping, that > > > can be quite tricky. > > > > > > However, I also do wonder if there would be a way to standardize/reserve > > > ids, such that a given id always corresponds to a specific user. If we > > > use an uint64_t for an id, there would be plenty room to reserve ids ... > > > > > > I'd really prefer if we can avoid using strings and instead using ids. > > > > I wish it was that simple and for some names like [anon:.bss] or > > [anon:dalvik-zygote space] reserving a unique id would work, however > > some names like [anon:dalvik-/system/framework/boot-core-icu4j.art] > > are generated dynamically at runtime and include package name. > > I'd be careful; if you allow special characters like that, you will > confuse some kind of parser. That's why I think having a separate config option with default being disabled would be useful here. It can be enabled on the systems which handle [anon:...] correctly without affecting all other systems. > > > Packages are constantly evolving, new ones are developed, names can > > change, etc. So assigning a unique id for these names is not really > > feasible. > > That leaves us with the central facility option, which as I described > > in my previous email would be prohibitive from performance POV (IPC > > every time we have a new name or want to convert id to name). > > That "central facility" option can be as simple as "mkdir > /somewhere/sanitized_id", using inode numbers for example. You don't > really need IPC. 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. This is while we are doing mmap() call, which is often a part of time sensitive operation (for example app is starting and allocating some memory to operate). App startup time is one of the main metrics our users care about and regressing that would not go well with our QA team. > > Plus, I don't really believe the IPC cost would be prohibitive. This option was discussed by the Android performance team and rejected 8 years ago. The problem is that these operations are often happening in performance-sensitive areas of the process lifecycle. > > Or you could simply hash the string and use the hash as id... I don't see how this would help. You still need to register your hash->name association somewhere for that hash to be converted back to the name. Did I misunderstand your suggestion? > > Best regards, > Pavel > -- > http://www.livejournal.com/~pavelmachek