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 8F14EC4332F for ; Fri, 22 Apr 2022 14:00:52 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 883DA6B0073; Fri, 22 Apr 2022 10:00:51 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 832F56B0074; Fri, 22 Apr 2022 10:00:51 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6D35D6B0075; Fri, 22 Apr 2022 10:00:51 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.27]) by kanga.kvack.org (Postfix) with ESMTP id 5EAF06B0073 for ; Fri, 22 Apr 2022 10:00:51 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 33DE8243A9 for ; Fri, 22 Apr 2022 14:00:51 +0000 (UTC) X-FDA: 79384675902.19.07C9BAF Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf20.hostedemail.com (Postfix) with ESMTP id 502801C002E for ; Fri, 22 Apr 2022 14:00:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1650636050; 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=9x3v/ioYU2PkbStJSHQW4pdUX8pdnAHng9fSZRsv8Nk=; b=atvTQxHiF+PzDSkaTN0WiW6opZJ4g5ZkoHhd5vFE9SvibA50QKiSq/dFnCVPpD4bKKNdRY VQyuf8zog+yNyzTQwZhg34x7uBuZm1z9knKk5AS+ckAoIH855TORR1sHowiIbEbpRA1fEB YnBD9HF4blj0fnIm1EzRqwyelDX5/sE= Received: from mail-oi1-f199.google.com (mail-oi1-f199.google.com [209.85.167.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-625-E9d0iBs6Ng6Xl4E1Th0EOg-1; Fri, 22 Apr 2022 10:00:44 -0400 X-MC-Unique: E9d0iBs6Ng6Xl4E1Th0EOg-1 Received: by mail-oi1-f199.google.com with SMTP id s3-20020aca5e03000000b0032297c4e2a5so3574671oib.22 for ; Fri, 22 Apr 2022 07:00:44 -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:in-reply-to :content-transfer-encoding; bh=9x3v/ioYU2PkbStJSHQW4pdUX8pdnAHng9fSZRsv8Nk=; b=3ssBSmOooqxkuCX4wrFGaY2jms7ZN2CEtPmrfdzJnbMW6aIC/GHHOdET+hHHwdBxby G8guP3KVs1o+3NyctorQJOE3lo+bpX1fgfw+Qrj6nZOufPXV5+Ak4+9YuFzVAPygP65w 5xDutZcQPe+aFlCJ0jyN6gDTAK+3fo7Lz615IIgniDOhxbVSpBj6yj3mzuKRUHS3Noe+ a9vTE4Eb46DzINIS3wL3l9kYpY+KgwK5/HCPCouP/ClfRNKUXgQCWgON8QLWwlE8DAsd lzol+gy/UQ+fbqkARN0EeeH7YBZgz/0Yc1esgwIKIkC74a52VZHxWdSKlk5/a60b2BDQ w34A== X-Gm-Message-State: AOAM532B/vv71v8Qwj/Vyl0M+nN8P4F6JYfOwdvBJDucCkFldwtts0TI 0Cipw3bnwUi8mfGVh89LkQVlhn93kia5g+SRy1P0D9nm7kU+3cyEoPcviYVzJzDrOUMEVFyhDE5 F6bo/7BMbqk0= X-Received: by 2002:a05:6870:6196:b0:e1:e1a2:5c65 with SMTP id a22-20020a056870619600b000e1e1a25c65mr2038390oah.190.1650636043810; Fri, 22 Apr 2022 07:00:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzaAvrG4ahVI6peqDBkgAZ6DW/cDwXzRY7tyv0DEpwTfCyPnW3MVghH/9LDprI3Zcm7alLlHA== X-Received: by 2002:a05:6870:6196:b0:e1:e1a2:5c65 with SMTP id a22-20020a056870619600b000e1e1a25c65mr2038370oah.190.1650636043541; Fri, 22 Apr 2022 07:00:43 -0700 (PDT) Received: from ?IPV6:2600:1700:5610:6e80::41? ([2600:1700:5610:6e80::41]) by smtp.gmail.com with ESMTPSA id y11-20020a4ad64b000000b00333c9ad6eb8sm815835oos.21.2022.04.22.07.00.42 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 22 Apr 2022 07:00:43 -0700 (PDT) Message-ID: <1f0f3254-31bd-5d09-6520-1897b3c5755b@redhat.com> Date: Fri, 22 Apr 2022 10:00:41 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: [RFC 1/3] mm: change vma_is_anonymous to vma_is_private_anon To: 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> From: Nico Pache In-Reply-To: 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-Rspam-User: X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: 502801C002E X-Stat-Signature: e4zke8zsd8yxc4hk91wjmpxmho8qg4er Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=atvTQxHi; spf=none (imf20.hostedemail.com: domain of npache@redhat.com has no SPF policy when checking 170.10.129.124) smtp.mailfrom=npache@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-HE-Tag: 1650636049-394333 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 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 :) There could be some aspect of COW that I dont fully understand. It is not something I've looked into much. Cheers, -- Nico