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 35C3DC433EF for ; Thu, 7 Oct 2021 15:45:35 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id CD66E610EA for ; Thu, 7 Oct 2021 15:45:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org CD66E610EA Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 501696B0071; Thu, 7 Oct 2021 11:45:34 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 48A596B0072; Thu, 7 Oct 2021 11:45:34 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 304E66B0073; Thu, 7 Oct 2021 11:45:34 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0131.hostedemail.com [216.40.44.131]) by kanga.kvack.org (Postfix) with ESMTP id 218106B0071 for ; Thu, 7 Oct 2021 11:45:34 -0400 (EDT) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id D21BB181F6CBE for ; Thu, 7 Oct 2021 15:45:33 +0000 (UTC) X-FDA: 78670066146.27.BF41B5C Received: from mail-yb1-f175.google.com (mail-yb1-f175.google.com [209.85.219.175]) by imf09.hostedemail.com (Postfix) with ESMTP id 6508430008DC for ; Thu, 7 Oct 2021 15:45:33 +0000 (UTC) Received: by mail-yb1-f175.google.com with SMTP id r1so14334232ybo.10 for ; Thu, 07 Oct 2021 08:45:33 -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=+Om7LGE3gSjcZBFq77mdFp8GnO5RkVNXV9ISnriMjmM=; b=Hb3t2wEM1YWKXwISWKF/3EFu46fQs/nDkeJx6X/Fyj/cFzdPKNkig51Yo0x6KJCYqj ErfpBxfWzUR3xyAsPp/qPPWXRAB8Mu3oVRrkEj/d9j53xXqBnDfzuWllwmXuDMu9/E5A 8bjL4tnm4XgwJ2uyh+9hgmME+6VKeRYsr8+6Rou2xI4GPXRk5/NvJm8fiSGkqzKav/MG /Gl4Qvjn0e0r/s0SzHf8lqN+EwkSQYZPWo0nVOzRH5QznfTGTXQYYxMQQx6GvYXgvhW/ spEDlpHT1LfJaFrkYPOZ1oOFdxFdUiP+Hiv3l78GkFj40SwAv9HtNjmpXU6Jo0DI6WRk 7Fiw== 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=+Om7LGE3gSjcZBFq77mdFp8GnO5RkVNXV9ISnriMjmM=; b=MHgJKlAA0uTsePbGFBmEkgQdzv72KMPxx4sG4r0grwcW7+ucv0K8ZHlIEBw8elvzFr o4E9Es/N8jUAAfGYskCbqjxVw2G8LUtSEbYUJGSxW5sHRJJax33rDT6jSmRT4Fjqo7C5 mzrpgHEk5FOotBOuEeJ7bNKL4JisQ/nHvDUMxmcivZ81wC+fcQGD0c4CBdMBJ1nY4y1y gsbPnr/vt1BrbI7IdGKJAHs/WpT9yyALSxoE4AAidgzcKR5t4iOtFSXbc36ja6CpzKjO ZjRgEeJB6WvuhvqM+ZWLfk1fwVIVXZ3nPq7HjP91xFiKD/rxsMS8p45g93aEenxyLOta 22kA== X-Gm-Message-State: AOAM532Shgma9rfXEKaM/HeYlwIOgj+QkrVSY5xnYGxLlf6+fFjgM8iF OIAqrzkZiztywU4d/je7cX9hokbAVTKjYOAfS0pZqQ== X-Google-Smtp-Source: ABdhPJyo+e9PBZc5VFvov456HUHahKkqzXwSnZsVdpk+F6b0N7psDwC6DpujRY04QM5ceyFAdIHfc7qPFdOjW60mNDw= X-Received: by 2002:a05:6902:120e:: with SMTP id s14mr6352655ybu.161.1633621532428; Thu, 07 Oct 2021 08:45:32 -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> In-Reply-To: From: Suren Baghdasaryan Date: Thu, 7 Oct 2021 08:45:21 -0700 Message-ID: Subject: Re: [PATCH v10 3/3] mm: add anonymous vma name refcounting To: Michal Hocko Cc: David Hildenbrand , John Hubbard , Pavel Machek , 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@oracle.com, 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" X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 6508430008DC X-Stat-Signature: 7mth8bp81q345x5jtpteaj3jozhghk83 Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=Hb3t2wEM; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf09.hostedemail.com: domain of surenb@google.com designates 209.85.219.175 as permitted sender) smtp.mailfrom=surenb@google.com X-HE-Tag: 1633621533-412162 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 Thu, Oct 7, 2021 at 12:59 AM Michal Hocko wrote: > > On Wed 06-10-21 08:01:56, Suren Baghdasaryan wrote: > > On Wed, Oct 6, 2021 at 2:27 AM David Hildenbrand wrote: > > > > > > On 06.10.21 10:27, Michal Hocko wrote: > > > > On Tue 05-10-21 23:57:36, John Hubbard wrote: > > > > [...] > > > >> 1) Yes, just leave the strings in the kernel, that's simple and > > > >> it works, and the alternatives don't really help your case nearly > > > >> enough. > > > > > > > > I do not have a strong opinion. Strings are easier to use but they > > > > are more involved and the necessity of kref approach just underlines > > > > that. There are going to be new allocations and that always can lead > > > > to surprising side effects. These are small (80B at maximum) so the > > > > overall footpring shouldn't all that large by default but it can grow > > > > quite large with a very high max_map_count. There are workloads which > > > > really require the default to be set high (e.g. heavy mremap users). So > > > > if anything all those should be __GFP_ACCOUNT and memcg accounted. > > > > > > > > I do agree that numbers are just much more simpler from accounting, > > > > performance and implementation POV. > > > > > > +1 > > > > > > 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. > > Packages are constantly evolving, new ones are developed, names can > > change, etc. So assigning a unique id for these names is not really > > feasible. > > I still do not follow. If you need a globaly consistent naming then > you need clear rules for that, no matter whether that is number or a > file. How do you handle this with strings currently? Some names represent standard categories, some are unique. A simple tool could calculate and report the total for each name, a more advanced tool might recognize some standard names and process them differently. From kernel's POV, it's just a name used by the userspace to categorize anonymous memory areas. > > -- > Michal Hocko > SUSE Labs