Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2117235pxb; Mon, 11 Oct 2021 22:38:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJya1VnKIlY1c5sT3E1mx4HGoO9uSEa4MGIDVr/talGjIb9KhFmcXnGPcYDDZzxRFEeLn14w X-Received: by 2002:a05:6a00:ac1:b0:44c:4dc6:b897 with SMTP id c1-20020a056a000ac100b0044c4dc6b897mr30083804pfl.25.1634017122713; Mon, 11 Oct 2021 22:38:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634017122; cv=none; d=google.com; s=arc-20160816; b=wtu+UE81OuqxSrTJGXtP2asI03LOPrIhVTOMR2pGgGDIrTMZsO/jyct72p+5WNjgx3 1B2cqxlkjy8wkpbvwtA0wUjW16d2WKUr4/YAX4NBF4Og2/s/eo4rargDll16OnC56Wi0 yRMKbv6f0WTJ52NaS2zOHTHA9JPCGu9/+VFARPrsa7PjpFdVdEUc+7hUozgOB/rFKG1Q j7HtP02vKxVwgRVKtS/q/xgLHUvZkDpSk9kYRf5jop+uOqpq2HkCh4hhwHldlTCOYkvT xhUB5rZk1HLXpEhFzTPTaHpihRJNYwlFAMsWwK2Ye2TTkWAyb5y4SxruPquVH3aLI7QG wP0Q== 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=7XL2OhH3/JP2d1n5i0NoQYVBLyR5b6ih9F8rC7fPaw8=; b=GjdMnf13TbSbDss3DkLtwpwQQUli+oAYTFqn1CDgJTf18STKdCjTFcVX+khOT75ZfL e/u2LWn13dEZVNZ/A3zMTCkCKXn7o0qPyhbW1C+VbfscNGPMw1EsKimwgf6a9RiDiSvV Iy0kJpxpXGTsgewU9LS8aJZT/7VcPrQXyEgQkjJh5fx4P6uY96Ijqpkg84vk90TzVHD8 nSMzJ7PUFMNqOJOEzX/uckPlJ9cW9Ou+LiM+tY+Q8cXPftQhc2+No1qmpXcskvOqkFaM O1GocoPwigD6kqB3xOWEPNFgsMvgv8sV2opyGuQ6kZuo3KGpYoMD4MwCvA0BM1Yv06Cd 8LWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=YIz7schr; 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 q18si18136886plh.236.2021.10.11.22.38.30; Mon, 11 Oct 2021 22:38:42 -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=YIz7schr; 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 S230449AbhJLFij (ORCPT + 99 others); Tue, 12 Oct 2021 01:38:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50400 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232254AbhJLFii (ORCPT ); Tue, 12 Oct 2021 01:38:38 -0400 Received: from mail-yb1-xb32.google.com (mail-yb1-xb32.google.com [IPv6:2607:f8b0:4864:20::b32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 212D1C061745 for ; Mon, 11 Oct 2021 22:36:37 -0700 (PDT) Received: by mail-yb1-xb32.google.com with SMTP id g6so44087069ybb.3 for ; Mon, 11 Oct 2021 22:36:37 -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=7XL2OhH3/JP2d1n5i0NoQYVBLyR5b6ih9F8rC7fPaw8=; b=YIz7schr62o25Kk8g7+lX0aqEsOX9ha4KRCurs5t8nYWe3ybb0BGYRyTNxOMDQOt4L gRMaIvi1d5c020EPGi2iB+KhmmRlH0d6ErcqsmawK4hViPXWSHB8THppCf0yRlDWQsbS 1eMwwPcHGB5y/XIJhsmmdMZc+YTZntrOYcrGKVIusunJdjDqMyhxNosruNdKybo6Ghla I5rPA1ih4GOrBL5FL9LswuwUgRYkdHRsI22iY+KhbSsZxVkOzruQfuAcp6IixjL8uPKU 4dC/+SScw5mAcuOp40squ2No5UFu3JEoaMnizIyl/RoGHsoQwZwD7NU0S2kEc+cOqUZh a1wQ== 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=7XL2OhH3/JP2d1n5i0NoQYVBLyR5b6ih9F8rC7fPaw8=; b=KDwKYZCF96e4XClIC7K4Ov//5QC3tnFkIQpVWAJ75yeXPAyi1stn3aFPs3usudNjxv zthCXTsZKWrzSkIx1cOc6CWytyXnBRPKKPKDUQVLYeyTn9dOC2J8fJSXbMl3lt+KRoQA rAFDC6kgPZGat6jEnCpYDxV48Xjh9SwbUigBv9bwDUfUPEWVvmmXOxT/aCMKQp6vlPlh +FLc3YNwBiTZrfkpDHm8J1tQFYM01sJlTbkXu0kxe2QRMAexj+OfKhW3QGEiV+d+INdw m1Ojpq0c9fS2q2hXKptyiMdlkom4MU5fDQN1keigmamRrUH9YkluTj/bviNgWG8V1jeN QmYA== X-Gm-Message-State: AOAM533Ze4VutHtAiB6VCfx6+WXrwUD1c47nffBQ2D6XFPnGQGwjfPUo 7CjRG1qOWcnD3bZZjGhdUSj7qCKlzL3ehtXJxO20tA== X-Received: by 2002:a25:3:: with SMTP id 3mr27812738yba.418.1634016995938; Mon, 11 Oct 2021 22:36:35 -0700 (PDT) MIME-Version: 1.0 References: <202110071111.DF87B4EE3@keescook> <202110081344.FE6A7A82@keescook> In-Reply-To: From: Suren Baghdasaryan Date: Mon, 11 Oct 2021 22:36:24 -0700 Message-ID: Subject: Re: [PATCH v10 3/3] mm: add anonymous vma name refcounting To: Johannes Weiner Cc: Michal Hocko , Kees Cook , Pavel Machek , Rasmus Villemoes , David Hildenbrand , John Hubbard , Andrew Morton , Colin Cross , Sumit Semwal , Dave Hansen , Matthew Wilcox , "Kirill A . Shutemov" , Vlastimil Babka , 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 , Tim Murray Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Oct 11, 2021 at 8:00 PM Johannes Weiner wrote: > > On Mon, Oct 11, 2021 at 06:20:25PM -0700, Suren Baghdasaryan wrote: > > On Mon, Oct 11, 2021 at 6:18 PM Suren Baghdasaryan wrote: > > > > > > On Mon, Oct 11, 2021 at 1:36 AM Michal Hocko wrote: > > > > > > > > On Fri 08-10-21 13:58:01, Kees Cook wrote: > > > > > - Strings for "anon" specifically have no required format (this is good) > > > > > it's informational like the task_struct::comm and can (roughly) > > > > > anything. There's no naming convention for memfds, AF_UNIX, etc. Why > > > > > is one needed here? That seems like a completely unreasonable > > > > > requirement. > > > > > > > > I might be misreading the justification for the feature. Patch 2 is > > > > talking about tools that need to understand memeory usage to make > > > > further actions. Also Suren was suggesting "numbering convetion" as an > > > > argument against. > > > > > > > > So can we get a clear example how is this being used actually? If this > > > > is just to be used to debug by humans than I can see an argument for > > > > human readable form. If this is, however, meant to be used by tools to > > > > make some actions then the argument for strings is much weaker. > > > > > > The simplest usecase is when we notice that a process consumes more > > > memory than usual and we do "cat /proc/$(pidof my_process)/maps" to > > > check which area is contributing to this growth. The names we assign > > > to anonymous areas are descriptive enough for a developer to get an > > > idea where the increased consumption is coming from and how to proceed > > > with their investigation. > > > There are of course cases when tools are involved, but the end-user is > > > always a human and the final report should contain easily > > > understandable data. > > > > > > IIUC, the main argument here is whether the userspace can provide > > > tools to perform the translations between ids and names, with the > > > kernel accepting and reporting ids instead of strings. Technically > > > it's possible, but to be practical that conversion should be fast > > > because we will need to make name->id conversion potentially for each > > > mmap. On the consumer side the performance is not as critical, but the > > > fact that instead of dumping /proc/$pid/maps we will have to parse the > > > file, do id->name conversion and replace all [anon:id] with > > > [anon:name] would be an issue when we do that in bulk, for example > > > when collecting system-wide data for a bugreport. > > Is that something you need to do client-side? Or could the bug tool > upload the userspace-maintained name:ids database alongside the > /proc/pid/maps dump for external processing? You can generate a bugreport and analyze it locally or submit it as an attachment to a bug for further analyzes. Sure, we can attach the id->name conversion table to the bugreport but either way, some tool would have to post-process it to resolve the ids. If we are not analyzing the results immediately then that step can be postponed and I think that's what you mean? If so, then yes, that is correct.