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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 09CC4C433EF for ; Fri, 17 Dec 2021 20:55:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240925AbhLQUzl (ORCPT ); Fri, 17 Dec 2021 15:55:41 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:49976 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237288AbhLQUzk (ORCPT ); Fri, 17 Dec 2021 15:55:40 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639774539; 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=gt0DtLTTM3E0C5XUm2JmJz4pNU1PDieeF6+dQqYh0XM=; b=fxL/3KU80an27dPD4irGlzchE2t4TBIvi9s7G77nI9Zct+l8TuaSC9+2ftOG6v0GUi1qm/ 3Kbrok7PxhXZfLkVa/j0Mk0DySw6xa7rlY9yqlX4qgUdQwwQpKHDM5P/1cq3G096m4cOoN fpap1bPb0iuWHu4/AHskVfRxERPoRYk= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-524-lq2Ns842N_CWeSrF90ta0A-1; Fri, 17 Dec 2021 15:55:38 -0500 X-MC-Unique: lq2Ns842N_CWeSrF90ta0A-1 Received: by mail-wm1-f71.google.com with SMTP id v23-20020a05600c215700b0034566adb612so1248255wml.0 for ; Fri, 17 Dec 2021 12:55:37 -0800 (PST) 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=gt0DtLTTM3E0C5XUm2JmJz4pNU1PDieeF6+dQqYh0XM=; b=PC1PbEqklTWCe2rLNmdV8eztMa2BC/PBhwN6U1R1kr6mzJq2Fq7OV9Neco4S2HVJ7B c15nbgBxVg6v7EE6/JvnAUKETynBg/Ra2hqtPlKzcGmMmpeVzA1WE55FGSKy7i/f30dE cOX48qu5xDwYC0wtIjxRpKDsPlQlT9bTV8IYsqdUCl3v1W4kZ3a5lTx6UM9pRHhun7MA KQuf3obp0TrQiTfpjMGwRrekbD6FLWna+Y4xv1OLo4B30gForuevgiDA88gOeYNaIVWI akvPXc//ki9zNYp8+jGeMDeO1GqSM/uX5k6xGAPYyiUNJf5S55F24d2XxACkMKFxjQ2K AJCQ== X-Gm-Message-State: AOAM531sZf0l9Bufut2lMyiwrnwCUYokAw23nRKHu2SddyA29bIZ3Elp 6nkARgvzN3JWj395rNseq5aK96UKTVUbqXSJmEKB+iQAq53gnK0XLV+8KsnegsvADmeHAGODpAO 3CCzN1D041yu+f6TPkqeWbtfE X-Received: by 2002:a1c:9d55:: with SMTP id g82mr9035984wme.58.1639774536972; Fri, 17 Dec 2021 12:55:36 -0800 (PST) X-Google-Smtp-Source: ABdhPJy2VIGy81gYhcxxwp937rzdgjfMqRdg6hjw0UIMF9SiLBF1P2rxY4ZqXf8403kKG7hOqOFIcw== X-Received: by 2002:a1c:9d55:: with SMTP id g82mr9035975wme.58.1639774536777; Fri, 17 Dec 2021 12:55:36 -0800 (PST) Received: from [192.168.3.132] (p4ff234b8.dip0.t-ipconnect.de. [79.242.52.184]) by smtp.gmail.com with ESMTPSA id s189sm9283243wme.0.2021.12.17.12.55.34 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 17 Dec 2021 12:55:36 -0800 (PST) Message-ID: Date: Fri, 17 Dec 2021 21:55:33 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.2.0 Subject: Re: [PATCH v1 06/11] mm: support GUP-triggered unsharing via FAULT_FLAG_UNSHARE (!hugetlb) Content-Language: en-US To: Linus Torvalds Cc: Linux Kernel Mailing List , Andrew Morton , Hugh Dickins , David Rientjes , Shakeel Butt , John Hubbard , Jason Gunthorpe , Mike Kravetz , Mike Rapoport , Yang Shi , "Kirill A . Shutemov" , Matthew Wilcox , Vlastimil Babka , Jann Horn , Michal Hocko , Nadav Amit , Rik van Riel , Roman Gushchin , Andrea Arcangeli , Peter Xu , Donald Dutile , Christoph Hellwig , Oleg Nesterov , Jan Kara , Linux-MM , "open list:KERNEL SELFTEST FRAMEWORK" , "open list:DOCUMENTATION" References: <20211217113049.23850-1-david@redhat.com> <20211217113049.23850-7-david@redhat.com> <9c3ba92e-9e36-75a9-9572-a08694048c1d@redhat.com> From: David Hildenbrand Organization: Red Hat In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 17.12.21 21:51, Linus Torvalds wrote: > On Fri, Dec 17, 2021 at 12:45 PM David Hildenbrand wrote: >> >> If a page is mapped exactly once, page_mapcount(page) == 1 and there is >> nothing to do. > > Why? > > You state that, but you stating that doesn't magically make it so. > > What makes "mapcount==1" stable and special? Your "it's an > atomic_read()" argument is nonsense - it implies that the count can be > changing, but you will get _one_ answer. And I explained how it can not increment. And the only way is via fork(), which cannot run concurrently. > > What makes that one answer of a changing count special? > > What if there are other references to that same page, gotten with > vmsplice(), and just about to be mapped into another address space? If we have a shared anonymous page we cannot have GUP references, not even R/O ones. Because GUP would have unshared and copied the page, resulting in a R/O mapped anonymous page. What am I missing? -- Thanks, David / dhildenb