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=-13.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL 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 9B939C433FE for ; Mon, 6 Sep 2021 15:52:36 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3CAD760E52 for ; Mon, 6 Sep 2021 15:52:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 3CAD760E52 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id C65726B0071; Mon, 6 Sep 2021 11:52:35 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C14686B0072; Mon, 6 Sep 2021 11:52:35 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B02E6900002; Mon, 6 Sep 2021 11:52:35 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0058.hostedemail.com [216.40.44.58]) by kanga.kvack.org (Postfix) with ESMTP id A53E96B0071 for ; Mon, 6 Sep 2021 11:52:35 -0400 (EDT) Received: from smtpin02.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 64243180ACC34 for ; Mon, 6 Sep 2021 15:52:35 +0000 (UTC) X-FDA: 78557591070.02.D765EDD Received: from mail-yb1-f180.google.com (mail-yb1-f180.google.com [209.85.219.180]) by imf16.hostedemail.com (Postfix) with ESMTP id 1FF88F00009A for ; Mon, 6 Sep 2021 15:52:35 +0000 (UTC) Received: by mail-yb1-f180.google.com with SMTP id q70so14310725ybg.11 for ; Mon, 06 Sep 2021 08:52:34 -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=/bgcmHKDn3LorkuSVcyCAc/MMYfBn+zOMCmk2ZUB6aM=; b=olm2PhGCTEx8jQKQDPim0F/G0tBroK7mfgYdUepqc+UelRqSX/GROVmY2M3UCa0lob Vljs4WXF/BrdWjVIYgzg4cHFZ5N3sLEb4jPJ8VHqmMqO0WIJ7jMdOvI7xve98ywgsEmk EJ+yoAt2Mwy2iuR9zQuXuWrMK5753BkiByyq7AqIO9hK2DPVV1IeUeZNeZ9AZ4W3GdHt Ys+bDqqEUpRXHYUH2HmtmAv4xb0GKy4kmP1/5emiSbc9kHoTUoanAAe7XrLQRbhDn5CA 8xhWkM+3BdIWs3T0IY3LbfaCLto0Jy/FxqN+q+PyMvj7bDJY5Gr7MuaL3DwjC39N8BLS h9Ew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=/bgcmHKDn3LorkuSVcyCAc/MMYfBn+zOMCmk2ZUB6aM=; b=mIIAMz2hZPQQbwKoXcm9UT+kZAO5aYuFGjfa6huWgb6EIFcdNhjv1G9mE7JI7emkyz AI3JVpK8sYMTdSQVGZ2xP1rDhItK3O8YKPXUpc6t5ZmouRH+jCy13YbaNkmytGu+bNCb 1NZJOs+4vYeYydanf8MSH8Ix4vmzAsuOmxS9DK0FE5huRewdWfAednpLz8RLE5Ozt67a pzGVZX9GAptLRJHZ5ZDLMpMaBVUIbvpWTpKCS3zR9c3IkGPPq3lYMxW8tiQenjYa8/5q 61uJycWI7udTmbavj5IkPVpArJBtrgcnytq5se6Ro+uqLFqkWypQSHLvcYqwbijyDFqT s/xA== X-Gm-Message-State: AOAM530jdy7/I1taCPZRXqDSeWh4F1aopdi+PVrSfSrLPn9uK7iGCJIU /3FC7My/RrXXu8cEmWiI2dYLH8jumZvO9jFXKlYhAw== X-Google-Smtp-Source: ABdhPJxgYWk6hy+mdeQO4de4+4PREXPTlKpeaHpkquia6aZN9siSokaYw+RKTlqY3cv1THELavVZ+hiDZKAMXGk9cW0= X-Received: by 2002:a25:b9c8:: with SMTP id y8mr18444413ybj.487.1630943554077; Mon, 06 Sep 2021 08:52:34 -0700 (PDT) MIME-Version: 1.0 References: <20210902231813.3597709-1-surenb@google.com> <20210902231813.3597709-2-surenb@google.com> <202109031420.2F17A2C9@keescook> <20210905130418.GA7117@localhost> In-Reply-To: <20210905130418.GA7117@localhost> From: Suren Baghdasaryan Date: Mon, 6 Sep 2021 08:52:23 -0700 Message-ID: Subject: Re: [PATCH v9 2/3] mm: add a field to store names for private anonymous memory To: Pavel Machek Cc: Kees Cook , Andrew Morton , Colin Cross , Sumit Semwal , Michal Hocko , Dave Hansen , 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" Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=olm2PhGC; spf=pass (imf16.hostedemail.com: domain of surenb@google.com designates 209.85.219.180 as permitted sender) smtp.mailfrom=surenb@google.com; dmarc=pass (policy=reject) header.from=google.com X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 1FF88F00009A X-Stat-Signature: 6ufy787hc6ts5fw3zdcmzdz9p78hdeqt X-HE-Tag: 1630943555-999807 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 Sun, Sep 5, 2021 at 6:04 AM Pavel Machek wrote: > > Hi! > > > > the process is still running, so it has to have some sort of > > > synchronization with every layer of userspace. Efficiently tracking > > > the ranges requires reimplementing something like the kernel vma > > > trees, and linking to it from every layer of userspace. It requires > > > more memory, more syscalls, more runtime cost, and more complexity to > > > separately track regions that the kernel is already tracking. > > Ok so far. > > > > This patch adds a field to /proc/pid/maps and /proc/pid/smaps to show a > > > userspace-provided name for anonymous vmas. The names of named anonymous > > > vmas are shown in /proc/pid/maps and /proc/pid/smaps as [anon:]. > > > > > > Userspace can set the name for a region of memory by calling > > > prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, start, len, (unsigned > > > long)name); > > Would setting a 64-bit integer instead of name be enough? Even if > each party would set it randomly, risk of collisions would be very > low... and we'd not have to deal with strings in kernel. Thanks for the question, Pavel. I believe this was discussed in this thread before and Colin provided the explanation with usage examples: https://lore.kernel.org/linux-mm/20200821070552.GW2074@grain/. Thanks, Suren. > > Pavel > > > -- > > -- > To unsubscribe from this group and stop receiving emails from it, send an email to kernel-team+unsubscribe@android.com. >