Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp1679081pxb; Thu, 7 Oct 2021 12:42:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwXwM4zZodLsR4mJKnQLmy/T8EmcpnJV35AoGjmhAaUxKgqIgv+u2um5svKNNanhqZ0fMFK X-Received: by 2002:a63:b20c:: with SMTP id x12mr1236424pge.10.1633635758634; Thu, 07 Oct 2021 12:42:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633635758; cv=none; d=google.com; s=arc-20160816; b=cRXDPTwqttL8xQSG/lrT961EMUGWVCn03a7fN33PUlTB+qze5lmQ7Gpc0Rbs6A37xI /A5eWLTFJ/BetUr3M9tzTdZ5Z0bu+bIPy46OzZmmg2N+YN9Jq1FoTjDO5fOn6EIv8hr0 HUcolT5Mp+0wIYNx8bE3OG/81Dt01Ik8a49SLEaMLbL3kGgRWezxpyhsInJIS41G4W9K hJNkdKTD2QzMQN15OsJKJeV96OpUUnP4ODew4Qq+MwJwenD6MRX4nLUg/UCoQzwCZ+ov SlbYxr1UsEZdsvbHaCAuXiA0AiTir5sS8l2d7p2/zooDLlYVUfy/SKHh3HtaibavKhli a9tA== 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=iFXDHIdmFx9kOd99BpBZhPs9QL1kZsGk7ICGKgi5oo4=; b=UOlQWZuLgOohi4Jj3eXg3p4tkU4Wo4g+kKaoyoM9wKQcyMCsbN2phqr0m+DTSvJ7f+ XzRLFGknT//Cib483wXhtw7CpOFr+r9+izD8PvYbVHrc98BmfnK3SvdJJuiSklvLsSY8 6YT0+uA956QqmmT7t46pvPwI3TJRmoNmc71eoGJ1GdJwl8Am5z6H6xSSziWCbhm1lPCI W4wCTPhDPTIzpSsXKduOkmAk1zDDYtuT8wddc4adIE/XWiv9+5tIWy28CY3J6BSzkSJW Q9pWqWClyN16AmFdPC0JLS9OldqM720bB8sVWWEi6s8t4/UBsXxvoLjOHoWEvcoS1/iC H6BQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=P8Xk1Z59; 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=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n15si346479plf.452.2021.10.07.12.42.25; Thu, 07 Oct 2021 12:42:38 -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=@suse.com header.s=susede1 header.b=P8Xk1Z59; 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=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242760AbhJGQmf (ORCPT + 99 others); Thu, 7 Oct 2021 12:42:35 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:33294 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242297AbhJGQmf (ORCPT ); Thu, 7 Oct 2021 12:42:35 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 7ADFF21CB4; Thu, 7 Oct 2021 16:40:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1633624840; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=iFXDHIdmFx9kOd99BpBZhPs9QL1kZsGk7ICGKgi5oo4=; b=P8Xk1Z595yZrs6BKXhkLSy617Pk/28mCV4RpLMtibIaiNBrHMQjdjq0pPiqN1cZqnfxQ+A s/Nq4zSXnAnqCKum77vSyiENDBnG1Yl5fVHJkcIxh7EDiUOYbNmUQt6iVeDnmcCv8tbDeN MHIzTFOhfoWhKJfWRACGPgInluA2SH0= Received: from suse.cz (unknown [10.100.201.86]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 168ADA3B84; Thu, 7 Oct 2021 16:40:40 +0000 (UTC) Date: Thu, 7 Oct 2021 18:40:39 +0200 From: Michal Hocko To: Suren Baghdasaryan Cc: Pavel Machek , Rasmus Villemoes , David Hildenbrand , John Hubbard , 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, 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 Subject: Re: [PATCH v10 3/3] mm: add anonymous vma name refcounting Message-ID: References: <6b15c682-72eb-724d-bc43-36ae6b79b91a@redhat.com> <20211006175821.GA1941@duo.ucw.cz> <92cbfe3b-f3d1-a8e1-7eb9-bab735e782f6@rasmusvillemoes.dk> <20211007101527.GA26288@duo.ucw.cz> 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 Thu 07-10-21 09:04:09, Suren Baghdasaryan wrote: > On Thu, Oct 7, 2021 at 3:15 AM Pavel Machek wrote: > > > > Hi! > > > > > >> Hmm, so the suggestion is to have some directory which contains files > > > >> representing IDs, each containing the string name of the associated > > > >> vma? Then let's say we are creating a new VMA and want to name it. We > > > >> would have to scan that directory, check all files and see if any of > > > >> them contain the name we want to reuse the same ID. > > > > > > > > I believe Pavel meant something as simple as > > > > $ YOUR_FILE=$YOUR_IDS_DIR/my_string_name > > > > $ touch $YOUR_FILE > > > > $ stat -c %i $YOUR_FILE > > Ah, ok, now I understand the proposal. Thanks for the clarification! > So, this would use filesystem as a directory for inode->name mappings. > One rough edge for me is that the consumer would still need to parse > /proc/$pid/maps and convert [anon:inode] into [anon:name] instead of > just dumping the content for the user. Would it be acceptable if we > require the ID provided by prctl() to always be a valid inode and > show_map_vma() would do the inode-to-filename conversion when > generating maps/smaps files? I know that inode->dentry is not > one-to-one mapping but we can simply output the first dentry name. > WDYT? No. You do not want to dictate any particular way of the mapping. The above is just one way to do that without developing any actual mapping yourself. You just use a filesystem for that. Kernel doesn't and shouldn't understand the meaning of those numbers. It has no business in that. In a way this would be pushing policy into the kernel. -- Michal Hocko SUSE Labs