Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp4912142pxb; Tue, 5 Oct 2021 13:09:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyitattA7w2cLAUfKOS8B5eim9mRuQ+pWd1ny+uBDcgOny13/EbWwPUPcsc5QlcK+NbhN/x X-Received: by 2002:a17:906:8a98:: with SMTP id mu24mr2797084ejc.438.1633464552446; Tue, 05 Oct 2021 13:09:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633464552; cv=none; d=google.com; s=arc-20160816; b=vht9JbgigCLv+Qdl0vRcTlZRcknZuD7B2H2yk9EGQmNpa9N0q0N1mx/iggWNqFZT7I 4MIeP+2WWDAnFRVrIsq4UMinifwfyM+absNss0sz10eguYF3sYjnz6WGdGHrVNlENLmv hly3UZgEHdZ4O6uMfRRnHVA26AEGi/KgmNzJ6y0G8VSBtr8T+gnNUTYAqXYyHV5lfrAz 2ZnN80ri73VN5um+zE+XZtOjsVsS9bWm1aYo5hoW2Cn6KrpDH76ekcxBRhA5JyjOWyNC u/Qdx322WTHTXu/RwdsqCMFz2cWZbq533cXzv6Qrt5IGJJGCesN4OR3zurhROLXvCdnX mZww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=cJ1nyd5BaWgF/UDvIWW/MXgRmKSbdohQzh4Go860fMA=; b=Xc++CYunej0yezvstnjW1ymlnWnNltULtPxvWQmYMnfD/xVCvim5OE68XzaSLlqSx9 DIJ5b9Uv0kI04Gi/9EmrVwWkMAp9gR+6F2hAoXTu6T+55VfO95XXINJBlJTLnk+vn7gd yk3ba21KsH5OEEAkT5wG4qPvcbT9LXlomX90EVjlZkSXGq6ivVpqrHx/XaCygnGbmmkc BuJhnJLAhRwHGgRwRqTHTldiwwDoGRuVDpQ0iyt+NTv1VbBVkiZDXWNKNPFm9tVm0NdL W7YixG/9Aq0UDuRgJtrcU+peI0xqcOoqrNc+3qnm0IyElSNI0eSKphuNDXaRm+sjfaic Zy+A== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a11si1262086edf.98.2021.10.05.13.08.43; Tue, 05 Oct 2021 13:09:12 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235675AbhJEUGF (ORCPT + 99 others); Tue, 5 Oct 2021 16:06:05 -0400 Received: from jabberwock.ucw.cz ([46.255.230.98]:50782 "EHLO jabberwock.ucw.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231266AbhJEUGE (ORCPT ); Tue, 5 Oct 2021 16:06:04 -0400 Received: by jabberwock.ucw.cz (Postfix, from userid 1017) id 10CBD1C0B80; Tue, 5 Oct 2021 22:04:12 +0200 (CEST) Date: Tue, 5 Oct 2021 22:04:11 +0200 From: Pavel Machek To: Suren Baghdasaryan Cc: Andrew Morton , Colin Cross , Sumit Semwal , Michal Hocko , 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, John Hubbard , 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 Subject: Re: [PATCH v10 3/3] mm: add anonymous vma name refcounting Message-ID: <20211005200411.GB19804@duo.ucw.cz> References: <20211001205657.815551-1-surenb@google.com> <20211001205657.815551-3-surenb@google.com> <20211005184211.GA19804@duo.ucw.cz> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="E39vaYmALEf/7YXx" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --E39vaYmALEf/7YXx Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi! > > On Fri 2021-10-01 13:56:57, Suren Baghdasaryan wrote: > > > While forking a process with high number (64K) of named anonymous vma= s the > > > overhead caused by strdup() is noticeable. Experiments with ARM64 > > Android > > > > I still believe you should simply use numbers and do the > > numbers->strings mapping in userspace. We should not need to optimize > > strdups in kernel... >=20 > Here are complications with mapping numbers to strings in the userspace: > Approach 1: hardcode number->string in some header file and let all > tools use that mapping. The issue is that whenever that mapping > changes all the tools that are using it (including 3rd party ones) > have to be rebuilt. This is not really maintainable since we don't > control 3rd party tools and even for the ones we control, it will be a > maintenance issue figuring out which version of the tool used which > header file. 1a) Just put it into a file in /etc... Similar to header file but easier... > Approach 2: have a centralized facility (a process or a DB) > maintaining number->string mapping. This would require an additional > request to this facility whenever we want to make a number->string > conversion. Moreover, when we want to name a VMA, we would have to I see it complicates userspace. But that's better than complicating kernel, and I don't know what limits on strings you plan, but considering you'll be outputing the strings in /proc... someone is going to get confused with parsing. Pavel --=20 http://www.livejournal.com/~pavelmachek --E39vaYmALEf/7YXx Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABECAB0WIQRPfPO7r0eAhk010v0w5/Bqldv68gUCYVyvuwAKCRAw5/Bqldv6 8lGrAJ0V28fWGvxGtBp2Sl4G3ljoIC0PJwCffbxs6/Xqs9vpl5ve9tLrqDxFsX4= =H8Zl -----END PGP SIGNATURE----- --E39vaYmALEf/7YXx--