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 X-Spam-Level: X-Spam-Status: No, score=-5.1 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A55B1C433E1 for ; Fri, 21 Aug 2020 07:05:59 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 668CA20738 for ; Fri, 21 Aug 2020 07:05:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="rXWNe03r" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 668CA20738 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id D6B0F6B0071; Fri, 21 Aug 2020 03:05:58 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CF4036B0072; Fri, 21 Aug 2020 03:05:58 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B6F9C6B0078; Fri, 21 Aug 2020 03:05:58 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0045.hostedemail.com [216.40.44.45]) by kanga.kvack.org (Postfix) with ESMTP id 9A7D46B0071 for ; Fri, 21 Aug 2020 03:05:58 -0400 (EDT) Received: from smtpin09.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 59D463630 for ; Fri, 21 Aug 2020 07:05:58 +0000 (UTC) X-FDA: 77173691196.09.boats40_0e0bb6927037 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin09.hostedemail.com (Postfix) with ESMTP id 2D586180AD81F for ; Fri, 21 Aug 2020 07:05:58 +0000 (UTC) X-HE-Tag: boats40_0e0bb6927037 X-Filterd-Recvd-Size: 7394 Received: from mail-lf1-f65.google.com (mail-lf1-f65.google.com [209.85.167.65]) by imf32.hostedemail.com (Postfix) with ESMTP for ; Fri, 21 Aug 2020 07:05:57 +0000 (UTC) Received: by mail-lf1-f65.google.com with SMTP id j15so422661lfg.7 for ; Fri, 21 Aug 2020 00:05:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=gYtNy9lnFQBXHeH3XFn+c9fH5C3mI0LiSEP+KDHbaqA=; b=rXWNe03rDfbsv/33tdG+pOhAXnGmw4YXc6RHUuFFhzaj6IfAT6BZHObLim3RSoLqbc S5eGQjNK7HORUipXQK+zWnqj5HL+KLQIGMy09ANXj41gXR/6NQpvfNt7BiiqSLsYyzcF oJUcHCVcFOdIYtfqCQ7ktivLyjLTNPJaTH+4lE888Hem6mjRFMiUxZA0A8i4zIqK/D4h 2F2COfcClt4GEb8OnO+npV0eWGrvl7BDQEsdOoJUpbNGN6t+WVDvHNUeKR5x/aYEe3he f/If41lqNCtU++1SBX2IweWX1yHbpO6e1iEmk1MeNlwqcc3ZYG0lNi6fNIe+xBtvWrK4 s4Xw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=gYtNy9lnFQBXHeH3XFn+c9fH5C3mI0LiSEP+KDHbaqA=; b=jjN/hmYPJ9Ts1mllR1rN1Gv1tWgGUdkBw0oCDRGbQ+UuaUlsHwdPTOUOs8jVoRGpWu mSuZN+aBQOCFpYvnB26Y1w+9BJgRXm4Lgf4d0Lwk/XCR+3MnG6GnA3a1FZQ2Z5EeQrNt 9uNz27Ftf0ZLTfZkZEiR+jchTQYQmO2Lh8uA2mvP6Gf9AEoCFCfsoBsgUU3lvTdzocF1 dpd+lN20pw7MaEaa/U0Ek62ann3+aED+ln9XQjbZefq1OEO0ui3ucS1t6+fjJ9wxnHEq GOElGXfdXXXqbpZ4gFGHikMr8vUcqWfEvuvPxjsH98nLDZ1Nb3xrtPxyPEwhgINDqmuu L7cQ== X-Gm-Message-State: AOAM531XJGTdp6nWeyQc4oShoB9WunonftIjkjWPU/RACulWNcXNuXb8 pCXgOBQCzotft9RE8uRvwyg= X-Google-Smtp-Source: ABdhPJwoH1hqWUNOkPJS6G4yGzse/GwGE3xxqBSNkfu391MUvwudISYswtHwJuSOLZmr6yE0BmPq9w== X-Received: by 2002:ac2:4d4f:: with SMTP id 15mr734722lfp.163.1597993556006; Fri, 21 Aug 2020 00:05:56 -0700 (PDT) Received: from grain.localdomain ([5.18.103.226]) by smtp.gmail.com with ESMTPSA id a16sm197938ljj.108.2020.08.21.00.05.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Aug 2020 00:05:54 -0700 (PDT) Received: by grain.localdomain (Postfix, from userid 1000) id A2E2A1A0078; Fri, 21 Aug 2020 10:05:52 +0300 (MSK) Date: Fri, 21 Aug 2020 10:05:52 +0300 From: Cyrill Gorcunov To: Colin Cross Cc: Sumit Semwal , Andrew Morton , Linux-MM , lkml , Alexey Dobriyan , Jonathan Corbet , Mauro Carvalho Chehab , Kees Cook , Michal Hocko , Alexey Gladkov , Matthew Wilcox , Jason Gunthorpe , "Kirill A . Shutemov" , Michel Lespinasse , Michal =?iso-8859-1?Q?Koutn=FD?= , Song Liu , Huang Ying , Vlastimil Babka , Yang Shi , chenqiwu , Mathieu Desnoyers , John Hubbard , Thomas Hellstrom , Mike Christie , Bart Van Assche , Amit Pundir , Thomas Gleixner , Christian Brauner , Daniel Jordan , Adrian Reber , Nicolas Viennot , Al Viro , Thomas Cedeno , linux-fsdevel@vger.kernel.org, Pekka Enberg , Dave Hansen , Peter Zijlstra , Ingo Molnar , Oleg Nesterov , "Eric W. Biederman" , Jan Glauber , John Stultz , Rob Landley , "Serge E. Hallyn" , David Rientjes , Hugh Dickins , Rik van Riel , Mel Gorman , Tang Chen , Robin Holt , Shaohua Li , Sasha Levin , Johannes Weiner , Minchan Kim Subject: Re: [PATCH v5 2/2] mm: add a field to store names for private anonymous memory Message-ID: <20200821070552.GW2074@grain> References: <20200819141650.7462-1-sumit.semwal@linaro.org> <20200819141650.7462-3-sumit.semwal@linaro.org> <20200820214003.GR2074@grain> <20200820221549.GV2074@grain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.14.6 (2020-07-11) X-Rspamd-Queue-Id: 2D586180AD81F X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam03 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, Aug 20, 2020 at 04:51:57PM -0700, Colin Cross wrote: > > > > Yes, been in this part of code too long ago, managed to forget. You know > > I'm wondering do we really need a human readable names here? Maybe it would > > be more convenient to keep say u64 number instead? This would eliminate > > need to access VM at all. From user space point of view there should be > > no difference how to recognize such VMAs (by name or by some ID). Or there > > some need for string solely? > > Numbers instead of strings would require some central registry to > decode them, which would make it much harder to use. You can see some This is not anyhow different from number constants. You simply need a central registry of strings. enum anon_codes { atexit_handlers = 1, linker_alloc = 2, ... }; ed432000-ed433000 r--p 00000000 00:00 0 [anon:1] ed442000-ed4a6000 r--p 00000000 00:00 0 [anon:2] ... the thing is that the string constants have no meaning outside of the user space application which use it. Moreover a user (while would read it via procfs) must have no assumption about their name meaning at all. > examples of how Android uses it at https://pastebin.com/BQZ1vZnJ for > the cat proces and https://pastebin.com/YNUTvZyz for an ART process. > We label individual stacks with their TIDs (useful since the stack TID > annotation was reverted in 65376df582174ffcec9e6471bf5b0dd79ba05e4a), > the various heaps created by different allocators, and much more. The > data is consumed manually for debugging, as well as by various memory > stats collection and analysis tools. Aha, thanks! I see the labeling. So baically the benefit of string constants is the following: - they are human readable - they are 255 bytes long (for now) While downsides are: - a way more longer procfs output I don't have some strong opinion here. Still thanks a huge for examples.