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 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 62754C4332F for ; Thu, 30 Sep 2021 23:25:08 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E5A2A619F5 for ; Thu, 30 Sep 2021 23:25:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org E5A2A619F5 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 32B609400E8; Thu, 30 Sep 2021 19:25:07 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2DAD09400E4; Thu, 30 Sep 2021 19:25:07 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 12F2A9400E8; Thu, 30 Sep 2021 19:25:07 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0044.hostedemail.com [216.40.44.44]) by kanga.kvack.org (Postfix) with ESMTP id 03A619400E4 for ; Thu, 30 Sep 2021 19:25:07 -0400 (EDT) Received: from smtpin10.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id B459A8249980 for ; Thu, 30 Sep 2021 23:25:06 +0000 (UTC) X-FDA: 78645822612.10.40D28D0 Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) by imf09.hostedemail.com (Postfix) with ESMTP id 7612E300012C for ; Thu, 30 Sep 2021 23:25:06 +0000 (UTC) Received: by mail-pl1-f181.google.com with SMTP id b22so5120711pls.1 for ; Thu, 30 Sep 2021 16:25:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=eh34nKlBtcXIhSkXFiXgZHHEXy1pUVrM2m/QPvjGZhs=; b=Hs3DNk4Z5KQlgSeNyHreuKuvEU3//1qlQHAU6a7/5w5PaGkR53udvoJVoOdC9VYM+4 oclqUS4GaVHxlcKo64+K6oVPlWjJLs2LIrFdjEdhbknM3o0FBpyNLGRmyykcmR2LSMoz 9dsuPdW3grv3wXZx7jpKUG0rnO+B3L23iItAo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=eh34nKlBtcXIhSkXFiXgZHHEXy1pUVrM2m/QPvjGZhs=; b=gcwqOBn7KI2nXFdzLhqNbhOHkOyWeobA/cacTTwUMvnCgDzARtn3E577Htnx+rtgkO 2zqyWsap2md9hvcCJeFKB56ducmK6vvhBKsF8MONrfqGEw1XZ1T8azO1BMegglv8uY0u cN5q8hH8kZiJGGufOsso1flsDwJNz55hZcvIuv5gF4rc+LBFIRqtpAWLICcCtD6n0M1w MufLT4TfLBqLd4OEgAwCCtVBQXc2Z16OuUN4X9rr+6Tm6RzWp+lUePjr7EMcViF86z5C 8Gs6ZdOWUz2XvrDN/pY8KidEw7wZ5fRJw8j3bO6sXMAt3/eR4cWe8jWNeyBO2ASMK6hW 5+pw== X-Gm-Message-State: AOAM533HtRGo2k6owzTq5erNcmEVh5qh+tMcRfPOYGkZsoJdBTyqtAb/ WR8h9nOxhqiLiZhwVIZfyzBZpQ== X-Google-Smtp-Source: ABdhPJylqjkv4pN89l4jFNBRqBmfAjaekWIwj3On6XS7U+IYWAgJXHbj5PZrkmGMBxnVbJZPind/Dg== X-Received: by 2002:a17:902:b205:b0:13d:b0a1:da90 with SMTP id t5-20020a170902b20500b0013db0a1da90mr6640971plr.26.1633044304955; Thu, 30 Sep 2021 16:25:04 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id 23sm4600716pfw.97.2021.09.30.16.25.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Sep 2021 16:25:03 -0700 (PDT) Date: Thu, 30 Sep 2021 16:25:02 -0700 From: Kees Cook To: Suren Baghdasaryan Cc: Matthew Wilcox , Andrew Morton , Colin Cross , Sumit Semwal , Michal Hocko , Dave Hansen , "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 v9 2/3] mm: add a field to store names for private anonymous memory Message-ID: <202109301621.3E03AE14F@keescook> References: <20210902231813.3597709-1-surenb@google.com> <20210902231813.3597709-2-surenb@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 7612E300012C X-Stat-Signature: c7u3ijodq6zyzn5qoy8buniz5bhs5wdj Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=Hs3DNk4Z; spf=pass (imf09.hostedemail.com: domain of keescook@chromium.org designates 209.85.214.181 as permitted sender) smtp.mailfrom=keescook@chromium.org; dmarc=pass (policy=none) header.from=chromium.org X-HE-Tag: 1633044306-373692 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, Sep 30, 2021 at 11:56:12AM -0700, Suren Baghdasaryan wrote: > I thought more about these alternative suggestions for userspace to > record allocations but that would introduce considerable complexity > into userspace. Userspace would have to collect and consolidate this > data by some daemon, all users would have to query it for the data > (IPC or something similar), in case this daemon crashes the data would > need to be somehow recovered. So, in short, it's possible but makes > things much more complex compared to proposed in-kernel > implementation. Agreed: this is something for the kernel to manage. > OTOH, the only downside of the current implementation is the > additional memory required to store anon vma names. I checked the > memory consumption on the latest Android with these patches and > because we share vma names during fork, the actual memory required to > store vma names is no more than 600kB. Even on older phones like Pixel > 3 with 4GB RAM, this is less than 0.015% of total memory. IMHO, this > is an acceptable price to pay. I think that's entirely fine. We don't end up with any GUP games, and everything is refcounted. I think a v10 with the various nits fixed would be a good next step here. What do you think Matthew? -- Kees Cook