Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2044183pxb; Mon, 11 Oct 2021 20:01:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwdMBkgDIEWRNofpa0ZO3SKozpUVe8Vvhs2AS+CyxBrTyF3JzlJlbz/T5cAx3g8VjFguqTc X-Received: by 2002:a17:902:8d8b:b0:138:e09d:d901 with SMTP id v11-20020a1709028d8b00b00138e09dd901mr28207054plo.34.1634007719463; Mon, 11 Oct 2021 20:01:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634007719; cv=none; d=google.com; s=arc-20160816; b=MF07ynlqgUoDFhMvySBJrbNFd5TTmG06WJ5lnZWvOXnMlEl1Qj5s9f0G3CUMiZKpac qOT3+qqURSjMEgaa+1V8Ww5XwEwX8JKK9r3X1bvLfSMSzAQzwEyKr8f+QY66xcFqbcNY dWskainNddopUonIb3NP/259hIFD2Gpc1zLpLfpMPYhnI8bW3vr8fJP/K7BlYdc1wcW2 GSl6wKfAHEPZrCjvtY1nwUjZiPfC6Y7J24aUum+v9u9JLdpfW4ngCWQTbAwkQAbH4Rdn ROXwpyhig8SbYJkq5j7obw0PtZQo1lxoG1OtYDmyy4nKBR1a4FGH0345UR7J0WJ3h1zO aQJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=B100TNfxux8MkM53tT5+mvaB4zQgc5l0a51qWAB7oeY=; b=Jaj0z21XWO66KDDjm97iL/s7xtxKYX/oUz9mNU66jt5z4zalxDZ5CL7cWBVr9cG2Qa Jtd/7NmClFySewdtRBYskuiRmcMkT34kx2rmvvu4MyL0Ta3Dkq5tAgJrCmgHkUO0/xHo 7yJAUxBOTolOec/D3giJCjVfjPvKgPuJLpXSaQ+FZMdBRT1EcBShmTXj7JLxvJRQ+MHc 8RkBjW0FKvkWP4KjB5u/mPk59Y/aDxTMOO+YJDJBFfDJ0FbrZ9/TkoPS5yugdts2S86F zNv9owDD/iFJnRpoEEcHvvtUDI51NUOwDy6EiTj2TnrRGz/Qj/mdRM6jOj2ElM4YKgZE QkfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cmpxchg-org.20210112.gappssmtp.com header.s=20210112 header.b="QcUrE/rG"; 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=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b140si12246607pfb.372.2021.10.11.20.01.46; Mon, 11 Oct 2021 20:01:59 -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=@cmpxchg-org.20210112.gappssmtp.com header.s=20210112 header.b="QcUrE/rG"; 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=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231944AbhJLDCV (ORCPT + 99 others); Mon, 11 Oct 2021 23:02:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44450 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232002AbhJLDCU (ORCPT ); Mon, 11 Oct 2021 23:02:20 -0400 Received: from mail-qk1-x72e.google.com (mail-qk1-x72e.google.com [IPv6:2607:f8b0:4864:20::72e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B6605C061745 for ; Mon, 11 Oct 2021 20:00:17 -0700 (PDT) Received: by mail-qk1-x72e.google.com with SMTP id y10so1577969qkp.9 for ; Mon, 11 Oct 2021 20:00:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20210112.gappssmtp.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=B100TNfxux8MkM53tT5+mvaB4zQgc5l0a51qWAB7oeY=; b=QcUrE/rGjmVLgGRtI564GAlFVUpY0c99OGdEyNr1y0rX8/wuU4xUpFvLhvh7ge20YA VjENDJ9PEOv9K8PKAAOKpo8KrEOXAdyFcqMMJ0ochkvA6vqnmy/gcKqb2ZQnKRvvPQvJ T4hoYsaapC11TwiL++jziZS8g9wXYA3tSvryZI0Yve32gs00DWtQ4tEruIL/csN1VEfs /woymrea9zjZQm9NvjuthLP1v82wrZY/WbjveZw6bTW9llxYFVJDV5v5KRP4cZekrk33 o03hHS31unp49DwnOwHbjQ2dIYZx3iK2UDKV3x+lDJwiPpwGdi46I4t78jM4JVKyRVwj Msmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=B100TNfxux8MkM53tT5+mvaB4zQgc5l0a51qWAB7oeY=; b=Y+mTROheIvNUxhf60fKelzKh+mOca90oBFIh3OUbn83YCvMiApdTRTcwF9ddB8xLJw OUfxPPi4DJ+w2bsd6P7J0OLJTH+On//dSd96FwXOy9q2+nXSsfWnzCy1j9vPJHVrIsbe CktMpeb0opfKym0qRYWihn14OmCHCdvIyWxP2t5SOK8WNkflziNBDJ/ioNoUMI+sb8ls nHQhcQHDX2c7OdbwyOQdFB4lYL0j4jxt0TLNg+iHx3aQuPCPpXKM7pLAQHAe9J8dnNh3 JNTKd2VhNikb7A+WUWy8EEsF3chK8Yzjfgp6OLsvKKZBHyl9Lx1iDSEIvWrI5SSRwAwE 6Org== X-Gm-Message-State: AOAM532mXIV2Ys5CJliQaqe61cskTOrnNHhhhC00/3WTiU36vfUkKG6i ja1tEPF+6m/3Ocrbuw8PPtInXQ== X-Received: by 2002:a37:a748:: with SMTP id q69mr17559785qke.178.1634007616296; Mon, 11 Oct 2021 20:00:16 -0700 (PDT) Received: from localhost (cpe-98-15-154-102.hvc.res.rr.com. [98.15.154.102]) by smtp.gmail.com with ESMTPSA id 9sm5174953qkn.84.2021.10.11.20.00.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Oct 2021 20:00:15 -0700 (PDT) Date: Mon, 11 Oct 2021 23:00:14 -0400 From: Johannes Weiner To: Suren Baghdasaryan 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, 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 , Tim Murray Subject: Re: [PATCH v10 3/3] mm: add anonymous vma name refcounting Message-ID: References: <202110071111.DF87B4EE3@keescook> <202110081344.FE6A7A82@keescook> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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?