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 2E66CC433EF for ; Wed, 6 Oct 2021 15:08:04 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C20B9611AE for ; Wed, 6 Oct 2021 15:08:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org C20B9611AE Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 39105900002; Wed, 6 Oct 2021 11:08:03 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 340026B0071; Wed, 6 Oct 2021 11:08:03 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1E089900002; Wed, 6 Oct 2021 11:08:03 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0155.hostedemail.com [216.40.44.155]) by kanga.kvack.org (Postfix) with ESMTP id 0FE8D6B006C for ; Wed, 6 Oct 2021 11:08:03 -0400 (EDT) Received: from smtpin04.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 8A8A11803A111 for ; Wed, 6 Oct 2021 15:08:02 +0000 (UTC) X-FDA: 78666342804.04.D55AB9D Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by imf14.hostedemail.com (Postfix) with ESMTP id 09B176002B84 for ; Wed, 6 Oct 2021 15:08:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633532881; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iml3pNlbn9tn2FywzhER1zlHgKoPS0AbJRacW4jzMgU=; b=bnZ2Xf8IzHzUMUfVGfDKFmThTqPqgcnjNvsQFpK6WajhlSlqVmRoIbFAa8hs3aqw6aVMZi P+KGmVXlUYE5iwIjtLFFyOjQALy+r9uMbD/bfH/ndaZDB5pQT96C7BFITeEvesukeWy7WD ddjGUlvXPzIcM0NvRDCsLTQYLe7i5LY= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-89-G01yUMLfMwaejAHC59SaWw-1; Wed, 06 Oct 2021 11:08:00 -0400 X-MC-Unique: G01yUMLfMwaejAHC59SaWw-1 Received: by mail-wr1-f70.google.com with SMTP id r21-20020adfa155000000b001608162e16dso2295500wrr.15 for ; Wed, 06 Oct 2021 08:08:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:to:cc:references:from:organization:subject :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=iml3pNlbn9tn2FywzhER1zlHgKoPS0AbJRacW4jzMgU=; b=CW98LqNHV71mevwYZ2NMOGQ+St4RcHG//tDoKRQAl1zM152+mClNXfzSaObczR+EOc pPJ7vSXfNwRbqCEmmAkJpZJ5Ox/roBP6T1n2DTzD28TztQDWX8B7MTbZZWRkjhcOpx2h LEfktA5OBQkK831WuD5tMFwzFqH/bIDSPK9mcuo4+gdzVb6mzjJ9f5asSxuOg4HFLOvE i0K3iE2RmffVF9TPHCtT2O+U8ve97ckJE6/mST9hh5NYg448wWtsO+d+gsEIRGLoG6n+ nhgRu9w+g7nevZDcFGTDtm9pAEKmx+MpH3C3pM0TYSwa05hPwZtOR7+jmq079HzZsCnS NhbQ== X-Gm-Message-State: AOAM5307a/KTsRwU9n0cEyTL+4QHYATXaQKEzo5erZWRsEzxNL0nMoS4 ebk0Nv/Vyc1p2IlDSU/5yVKdr5nwvCdo+Eec7pK86zjvO3aqHm7W3XS7mVNEV2YWCD1mRrvnb0T 9dyQT3nHZgms= X-Received: by 2002:a05:600c:4fc6:: with SMTP id o6mr10488660wmq.147.1633532878767; Wed, 06 Oct 2021 08:07:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzIy7edjiF6tYBwyhRpW4cHms5SJrrTE90lW3+gTLtxOFwCuTMHSR1zVPnDBv3OjX9leQiDZw== X-Received: by 2002:a05:600c:4fc6:: with SMTP id o6mr10488572wmq.147.1633532878499; Wed, 06 Oct 2021 08:07:58 -0700 (PDT) Received: from [192.168.3.132] (p5b0c6529.dip0.t-ipconnect.de. [91.12.101.41]) by smtp.gmail.com with ESMTPSA id w11sm2259159wmc.44.2021.10.06.08.07.55 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 06 Oct 2021 08:07:58 -0700 (PDT) To: Suren Baghdasaryan Cc: Michal Hocko , John Hubbard , Pavel Machek , 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, =?UTF-8?B?Q2hpbndlbiBDaGFuZyAo5by16Yym5paHKQ==?= , 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@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 References: <20211001205657.815551-1-surenb@google.com> <20211001205657.815551-3-surenb@google.com> <20211005184211.GA19804@duo.ucw.cz> <20211005200411.GB19804@duo.ucw.cz> <6b15c682-72eb-724d-bc43-36ae6b79b91a@redhat.com> From: David Hildenbrand Organization: Red Hat Subject: Re: [PATCH v10 3/3] mm: add anonymous vma name refcounting Message-ID: <192438ab-a095-d441-6843-432fbbb8e38a@redhat.com> Date: Wed, 6 Oct 2021 17:07:55 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 09B176002B84 X-Stat-Signature: kqae6zt4yts3oazg9zhkdkk534wu6jtz Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=bnZ2Xf8I; spf=none (imf14.hostedemail.com: domain of david@redhat.com has no SPF policy when checking 216.205.24.124) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-HE-Tag: 1633532881-314925 Content-Transfer-Encoding: quoted-printable 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 06.10.21 17:01, Suren Baghdasaryan wrote: > On Wed, Oct 6, 2021 at 2:27 AM David Hildenbrand wro= te: >> >> On 06.10.21 10:27, Michal Hocko wrote: >>> On Tue 05-10-21 23:57:36, John Hubbard wrote: >>> [...] >>>> 1) Yes, just leave the strings in the kernel, that's simple and >>>> it works, and the alternatives don't really help your case nearly >>>> enough. >>> >>> I do not have a strong opinion. Strings are easier to use but they >>> are more involved and the necessity of kref approach just underlines >>> that. There are going to be new allocations and that always can lead >>> to surprising side effects. These are small (80B at maximum) so the >>> overall footpring shouldn't all that large by default but it can grow >>> quite large with a very high max_map_count. There are workloads which >>> really require the default to be set high (e.g. heavy mremap users). = So >>> if anything all those should be __GFP_ACCOUNT and memcg accounted. >>> >>> I do agree that numbers are just much more simpler from accounting, >>> performance and implementation POV. >> >> +1 >> >> I can understand that having a string can be quite beneficial e.g., wh= en >> dumping mmaps. If only user space knows the id <-> string mapping, tha= t >> can be quite tricky. >> >> However, I also do wonder if there would be a way to standardize/reser= ve >> ids, such that a given id always corresponds to a specific user. If we >> use an uint64_t for an id, there would be plenty room to reserve ids .= .. >> >> I'd really prefer if we can avoid using strings and instead using ids. >=20 > I wish it was that simple and for some names like [anon:.bss] or > [anon:dalvik-zygote space] reserving a unique id would work, however > some names like [anon:dalvik-/system/framework/boot-core-icu4j.art] > are generated dynamically at runtime and include package name. Valuable information > Packages are constantly evolving, new ones are developed, names can > change, etc. So assigning a unique id for these names is not really > feasible. So, you'd actually want to generate/reserve an id for a given string at=20 runtime, assign that id to the VMA, and have a way to match id <->=20 string somehow? That reservation service could be inside the kernel or even (better?) in=20 user space. The service could for example de-duplicates strings. My question would be, if we really have to expose these strings to the=20 kernel, or if an id is sufficient. Sure, it would move complexity to=20 user space, but keeping complexity out of the kernel is usually a good id= ea. --=20 Thanks, David / dhildenb