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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id DBC64C433F5 for ; Thu, 28 Apr 2022 16:14:20 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5FB326B00BF; Thu, 28 Apr 2022 12:14:20 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5AA1C6B00C0; Thu, 28 Apr 2022 12:14:20 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 44A978D0002; Thu, 28 Apr 2022 12:14:20 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.25]) by kanga.kvack.org (Postfix) with ESMTP id 354F66B00BF for ; Thu, 28 Apr 2022 12:14:20 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id D76CB29B1 for ; Thu, 28 Apr 2022 16:14:19 +0000 (UTC) X-FDA: 79406785038.30.92E9859 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf27.hostedemail.com (Postfix) with ESMTP id B6A244005D for ; Thu, 28 Apr 2022 16:14:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1651162458; 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=dGBrnOhdj0Ms1xTSGzmkeoSPGVLRW+Ni49nUm3bjdfI=; b=jLrOcioWTRxll6gWuYO/v1VTA32NF/yzgPn3uA+SmDuitHPNHqJWt5rbCjkeZxDOZPy1Lt 1vsZe0B3U5H5x6d6R0MirnYcYU3D4pGfGu7+KC6y12tAU5G9rU0VxChNLLrbkNpei39ZN2 2ca8SbjeCZMTNRqeEZ+lqbMPGjl7bRE= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-194-eAsLjD3bMAiZTTewxQ1r5Q-1; Thu, 28 Apr 2022 12:14:15 -0400 X-MC-Unique: eAsLjD3bMAiZTTewxQ1r5Q-1 Received: by mail-wr1-f71.google.com with SMTP id t15-20020adfdc0f000000b001ef93643476so2094646wri.2 for ; Thu, 28 Apr 2022 09:14:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:organization:in-reply-to :content-transfer-encoding; bh=dGBrnOhdj0Ms1xTSGzmkeoSPGVLRW+Ni49nUm3bjdfI=; b=wmNul3VB65yIfszKNfUGCRRibmA2+b4qoOUggNA/2YUHhaRLAoL9soxabd5t3SSRfe fE8gtmDQQWjJ4mgL8ar8h1lroQHyNx+D/o5deqWT9U9kDcgqfU6rJDNJNW6YYtzOo0hp 8fFdSQg3xfzEswwppHN4/p09qfp/bkVq2ab0m5ce3WXkyeSO3La10TYCNVfwX5nFdaO9 jHOz4dr6w7QN5bMDIToHKNrvzh/zbx1pH/fkkDELs1wQ7OWwfPTxthXKzKwhGljYO+rT cIXqArc5d0wuZx6D7QW9GlcB1v1bBWXDXit8ahZT0wRdY1YhfNVA3Udx0ij/d7G4AQF8 LgvA== X-Gm-Message-State: AOAM533ClS2nmz+jkALwVtjpTHV67qNcwe1SD35YEKvZhjAimE/H1yWx xp0ZRvSonMpBqa7L7ZOfIHlSb08TpT3g9u/tOo2Vqbjga9wPXn5v7HmC7LgVaG0Qp56mRtZVKln u/jrMm/YJPxw= X-Received: by 2002:a05:600c:1c17:b0:393:e6ee:1e1c with SMTP id j23-20020a05600c1c1700b00393e6ee1e1cmr24294410wms.85.1651162454039; Thu, 28 Apr 2022 09:14:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwoeQ+QCpA3TNwQQ/y/ZymUkfPUtA0Or9PN6nAykWJhle/CVQxQ84s8seyzRGeMQGbwpLAWTA== X-Received: by 2002:a05:600c:1c17:b0:393:e6ee:1e1c with SMTP id j23-20020a05600c1c1700b00393e6ee1e1cmr24294382wms.85.1651162453733; Thu, 28 Apr 2022 09:14:13 -0700 (PDT) Received: from ?IPV6:2003:cb:c708:ef00:7443:a23c:26b8:b96? (p200300cbc708ef007443a23c26b80b96.dip0.t-ipconnect.de. [2003:cb:c708:ef00:7443:a23c:26b8:b96]) by smtp.gmail.com with ESMTPSA id u22-20020adfa196000000b0020ad517ce4bsm217625wru.52.2022.04.28.09.14.11 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 28 Apr 2022 09:14:12 -0700 (PDT) Message-ID: <34000b9d-1fc3-fef5-d048-3cb3f8a36f1d@redhat.com> Date: Thu, 28 Apr 2022 18:14:11 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.6.2 Subject: Re: [RFC 1/3] mm: change vma_is_anonymous to vma_is_private_anon To: Nico Pache , Matthew Wilcox Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Alexander Viro , Andrew Morton , Nicholas Piggin , Logan Gunthorpe , Hari Bathini , "Aneesh Kumar K.V" , Yang Shi , Miaohe Lin , William Kucharski , Hugh Dickins References: <20220421190533.1601879-1-npache@redhat.com> <20220421190533.1601879-2-npache@redhat.com> <1f0f3254-31bd-5d09-6520-1897b3c5755b@redhat.com> From: David Hildenbrand Organization: Red Hat In-Reply-To: <1f0f3254-31bd-5d09-6520-1897b3c5755b@redhat.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Stat-Signature: 7p6cux4qwwhggoubzuowrrk51ceaz1i6 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: B6A244005D X-Rspam-User: Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=jLrOcioW; dmarc=pass (policy=none) header.from=redhat.com; spf=none (imf27.hostedemail.com: domain of david@redhat.com has no SPF policy when checking 170.10.133.124) smtp.mailfrom=david@redhat.com X-HE-Tag: 1651162457-840644 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 22.04.22 16:00, Nico Pache wrote: > > > On 4/21/22 15:28, Matthew Wilcox wrote: >> On Thu, Apr 21, 2022 at 03:05:31PM -0400, Nico Pache wrote: >>> The vma_is_anonymous function isn't fully indicative of what it checks. >>> >>> Without having full knowledge of the mmap process, one may incorrectly >>> assume this covers all types of anonymous memory; which is not the case. >> >> Is your complaint that anonymous memory can also be found in file VMAs >> that were mapped with MAP_PRIVATE? ie COWed pages? > I should have been more descriptive in my commit msg about how I came to this > conclusion. > > From my understanding of the mmap process, a vma->vm_ops field is only NULL when > mmapped as !file and !shared: > > if (file){ > ... > } else if (vm_flags & VM_SHARED) { //ANON SHARED > error = shmem_zero_setup(vma); > if (error) > goto free_vma; > } else { //ANON PRIVATE > vma_set_anonymous(vma); //set vma->vm_ops= NULL > } > > To me this means that the VMA is PRIVATE ANON memory. The vma_is_anonymous > function returns true when vm_ops == NULL. So my intentions were to more > accurately describe what we are checking for. I could be wrong though thats why > I started with an RFC :) Shared anon in the kernel is really just shmem. The user space notion is MAP_ANON|MAP_SHARED, but that really just maps to shmem and the kernel doesn't really call that thing anonymous memory. So I agree, renaming this is not appropriate. -- Thanks, David / dhildenb