Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp1677844pxb; Thu, 7 Oct 2021 12:41:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx1S+7MJ+ToCFhRUmkAH+Fp1E79ELsBp+L8qnjftK+hZNG6giE9tye8mxa5yvxRejZHeYbW X-Received: by 2002:a63:b214:: with SMTP id x20mr1184597pge.460.1633635663225; Thu, 07 Oct 2021 12:41:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633635663; cv=none; d=google.com; s=arc-20160816; b=WYc0EjfE4Yrvx25QmLXpYqScbRkYY9l2Y7R2Q0Dmz63STw9gawxAhFOkDu1yMD0UU3 8aHXaq4qnOthKpGDwzqIZivlR7K+NUWuTbu7r8bNTbi66n4yGfniEnYX4HJSTgcjxa8W QLi+L0PImtsEK5bWiNWBPBW1A1oSJnF2N7hMnbF7GOe96uWNZ4gG6/vQgcSEqbAzcNuD 9CnQakRvgfsmznN6AdagyVtNG/LmIvgV6EVixutk5RvTE3OFB/xoK3ZIbC4Jn/cviScx WCZdIdg7VBHJ2RP8JxiBf4hb+HHUIzdXPHpmpUehc4lp7ubiiDNseyUTww2bjz4HW6UP AfRg== 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=+Om7LGE3gSjcZBFq77mdFp8GnO5RkVNXV9ISnriMjmM=; b=DBWmVmIgLiyNSCGppqJtMkF29nKQv09fLY2T0y1ZWo79Wq8hDGYA4LC4MPlmYN/T6q d8SPPW0PikNnRpB+xqKuKEfWhvnobUpCPm1Wi433SSisi1z90zrTqrgQM6fzhMEUbkPP NC59FFHJDwZ+nH6CG+4nSqQOQo5A7LJ7Q44IQgDCFfoTwARZfVMm/+4Zc5rSU01Ry3Ak TnF6V6QXNIrgSue/ayPMKcKqP2FEizBipvm2ZNW4BG66VjH2g2VWEOCu2yrD6oogD/Yf 0MdKfwcQfB02jLk+iioy308dAYWHHwoqJQvLXN/j+WV8X6UhafzHNKpajug6oJ3XCCVU nNXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=Hb3t2wEM; 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 i185si11902022pfg.318.2021.10.07.12.40.50; Thu, 07 Oct 2021 12:41:03 -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=Hb3t2wEM; 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 S241818AbhJGPr1 (ORCPT + 99 others); Thu, 7 Oct 2021 11:47:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241351AbhJGPr1 (ORCPT ); Thu, 7 Oct 2021 11:47:27 -0400 Received: from mail-yb1-xb2b.google.com (mail-yb1-xb2b.google.com [IPv6:2607:f8b0:4864:20::b2b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 67F8EC061746 for ; Thu, 7 Oct 2021 08:45:33 -0700 (PDT) Received: by mail-yb1-xb2b.google.com with SMTP id s64so14319890yba.11 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=xnV4W7cy6EXOEvQlObBpq/GG+IfYk4UT2BNRfNuhF3HjMsUCbm8UPmJuP29QNtWnWy TK/5hc7kDTAJJlpo1taidh6tqutPvP7DemnC87NuyF13AmEskVl7BopB3KJJriCG/AU0 M+/xyFoMseoqq7Qpww1jYXJlAixJnkMQQWMnVD+96FOmOk4Pb+NgRAjiWLE6tCHjIbsK LA21h0EceqbI0ip9YfUF3/ZEJD5tnJhc1Aqv25z0gZtyBhRZ20eNQ6ucn8xHcLV6Ljl/ B2l9ilhjNgVEq8/4V63kwuubEnNf+vV8VhGNQzQbhLBuXitBof62hh1R8VyDLAFCJkdO E27Q== X-Gm-Message-State: AOAM531840BVuMZPnNX4ehpmgf0+ZEARmVDe2B2V8VLbZYIFugNamBXr OxTUxW5bnG2D9jW34pgl++o2oc7QqHKLXrr4pl5waw== 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" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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