Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp4938918pxb; Tue, 5 Oct 2021 13:46:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxi6G0zzg+cs4Kbe4EiJUMg3lagAUpWNTMgrZUqH0xDqWhI4qnZd561TZVU2awzhjkUw1Ma X-Received: by 2002:a05:6402:3587:: with SMTP id y7mr9484633edc.182.1633466770656; Tue, 05 Oct 2021 13:46:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633466770; cv=none; d=google.com; s=arc-20160816; b=dsPNCzsN5diLuYXZSLU0QQtTzxVaKmNTscvlg6wZJ+OHh2MAlnwdojOuVlshfU96b4 vBZAP8PqDAF06nmqDYGgnM3HgEwLbFjPvKm3LqH1Jibo1aVo7Cuu8IC7zZWhqjOczncy r3icKK9ukEhfUBlk3W1ZBXkxCjh0hAnaEyKxNQkZr1dNpb3Xj2txqZB9o88ba8FVbaNt XmfJz5Jj4tL8KOPzHt7GzpTE/QYCnf+tpf4F7wDigugePdDiMajMLrTTq3vDCWthRUXW 1acXJbC8WxdccZQcgpfF1DCJn+a8CDH0jPGIBIqZCfwjNRP+byxWSxOuDPjfSsHfZDEx R3+g== 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=vqE21VBUis5F7P2tyfYlDOrpKr4yHrwWmAyRNmJWM3s=; b=f/9TtR/K1J1RBi5RdfToDMgE9LoT5WtOC/Z53KCnkSvlDIq5gLxC+9RMeL/035L8fV GnyrKFk0fnK7xhqf8pcZHVoRCTnUPA9eH22j+U7va5V9SxfmlMibMdPX2V9eEMOIAalK Fm78Y0yfhfpsAvlnYiHXfG8twq0IY3OkuZT2G6FfV9vCSyKwmSh1pFT5PsYDSnXOcRWU fO0d6iVsQ2fhKttiRe+Pj9GNu+XV+dl+1Tb4dSqbTLvE3L2GGUPV7QKXhBe7Gf9RjwNZ Swv4KbuENzx8PDDVljOSKkRbGILVd20q3k//MOsWGWnaahi8W6L2Qt2LHEfH0yN0G8CP Y6NA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=cLdugDTm; 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 i2si19509239ejw.120.2021.10.05.13.45.47; Tue, 05 Oct 2021 13:46:10 -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=cLdugDTm; 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 S236093AbhJEUpr (ORCPT + 99 others); Tue, 5 Oct 2021 16:45:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235648AbhJEUpq (ORCPT ); Tue, 5 Oct 2021 16:45:46 -0400 Received: from mail-yb1-xb36.google.com (mail-yb1-xb36.google.com [IPv6:2607:f8b0:4864:20::b36]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 65863C061749 for ; Tue, 5 Oct 2021 13:43:55 -0700 (PDT) Received: by mail-yb1-xb36.google.com with SMTP id z5so598303ybj.2 for ; Tue, 05 Oct 2021 13:43:55 -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=vqE21VBUis5F7P2tyfYlDOrpKr4yHrwWmAyRNmJWM3s=; b=cLdugDTmr/j2oBSHl6ozvoJ0MUztT02mdFP1wViGsj6Es2vUDXH3ZKf0dgAvBRswBG 4nw7Ii4GeXo/fAzUaTjYOPt6JRHTe8t5Q40Sq/JAY1c2+zHmKNfHZtRuHtrubosUCXjj tNczBaDQ4bhQN0nlecEG5Y8I63K7PrxdUlrLmKmNAxtRSqnjPWgjkdwDPuwh0kUI9rBA m47INqgwtWh1ybXdUOTGhlDh007hgptN9+4uMEw/1iYHGtiI67rUFYFfsxg7a7ih3WLt rVQnsO/wS4iN+N3TONQfPsl0EcuNPmrWUSAnVcHAf52OQoxar1CxZFfZj6r0eJPQ5e1X pD3g== 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=vqE21VBUis5F7P2tyfYlDOrpKr4yHrwWmAyRNmJWM3s=; b=B233BPWTzv5qfPJTWYiojwYxtATXmSJZIz3r7PSavIxUrVYkW+wwIZCa64iEaX9S86 FTThiX1G3SbfLTvpfuWdeOLaFu4LrxEnCqLTBY9DOX2hSghOrnruGNWGKNU1NCysnUeT c2i6GDqHzPcT+waWzSDdiCKupE1UamZ9Keop/ChZyIb8xw3lFgH/qkmAJiaTaUGiLYlR 8w6IBtudqY7dv/VLPKC6+BmOgSLiVUR0yuk37ZXSd2PP7FQRkZe2kLTA1na7yQFiSNEd gp4dHiq5/X73Q2SXq8GN6tQMBt972mPE+5aHd+qtwpswKM/hCp54F5UOruL8IR6eyiQb 4DHQ== X-Gm-Message-State: AOAM530G8KzKTLAiP2+E5VA6s5jfV68kVAIj9yLfmP8Mw8//4R+j5juc qRdj95L5iahyo0SiF1+Uycw/z5OA+1yZQiFjel+A2A== X-Received: by 2002:a25:3:: with SMTP id 3mr24647134yba.418.1633466634369; Tue, 05 Oct 2021 13:43:54 -0700 (PDT) MIME-Version: 1.0 References: <20211001205657.815551-1-surenb@google.com> <20211001205657.815551-3-surenb@google.com> <20211005184211.GA19804@duo.ucw.cz> <20211005200411.GB19804@duo.ucw.cz> In-Reply-To: <20211005200411.GB19804@duo.ucw.cz> From: Suren Baghdasaryan Date: Tue, 5 Oct 2021 13:43:43 -0700 Message-ID: Subject: Re: [PATCH v10 3/3] mm: add anonymous vma name refcounting To: Pavel Machek 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, =?UTF-8?B?Q2hpbndlbiBDaGFuZyAo5by16Yym5paHKQ==?= , 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 Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 5, 2021 at 1:04 PM Pavel Machek wrote: > > Hi! > > > > On Fri 2021-10-01 13:56:57, Suren Baghdasaryan wrote: > > > > While forking a process with high number (64K) of named anonymous vmas 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... > > > > 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. I'm not a fan of complicating kernel but the proposed approach seems simple enough to me. Again this is subjective, so I can't really have a good argument here. Maybe, as Andrew suggested, I should keep it under a separate config so that whoever does not care about this feature pays no price for it? On the topic of confusing the parsers, if the parser is written so that it can't ignore new [anon:...] entry then it does not matter whether we use strings or numbers, it will get confused either way. Again, if we are concerned about confusing existing parsers I think having a separate config option set to 'n' would help. This would prevent some userspace process from naming an anonymous VMA and causing parser confusion. OTOH on systems where parsers can handle anon VMA names (Android) we will set that config and use the feature. Would that address your concerns? > > Pavel > -- > http://www.livejournal.com/~pavelmachek