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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2BE15C433F5 for ; Wed, 22 Dec 2021 08:30:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239455AbhLVIaL (ORCPT ); Wed, 22 Dec 2021 03:30:11 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:25900 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229652AbhLVIaK (ORCPT ); Wed, 22 Dec 2021 03:30:10 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1640161810; 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=K5R13w0zfTN1gfH0nX3lNZrmWuAI/MqkwgiuEDiE6RY=; b=O93wayn/KU4ZguD4+m6FPB5hcY+5RMEe5G6KE9j87IQFvZkbE0DH5dbuh/ODK6sVhq9Xau TujAwAgWnkN1WEQv5ufmaKF1/pL53rsnVF9UT4I+ibzhWo90+0cNKwRMl4b7YWZTBjm40D yPI4AM4qJ7fSLUirNXFTteFADH++1PQ= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-339-pAXh2lMZNAGfJ9SK-YYiUQ-1; Wed, 22 Dec 2021 03:30:08 -0500 X-MC-Unique: pAXh2lMZNAGfJ9SK-YYiUQ-1 Received: by mail-wm1-f70.google.com with SMTP id m19-20020a05600c4f5300b00345cb6e8dd4so101648wmq.3 for ; Wed, 22 Dec 2021 00:30:08 -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=K5R13w0zfTN1gfH0nX3lNZrmWuAI/MqkwgiuEDiE6RY=; b=ykXsYHpIzl5OYyrw4RT2k/AbMlmgiEDD3ljX5669AhFfpi7WlDY11wR3iimiEal5WT PgziLQaX02M9t2NZniZdk1v9OJXtNlKQMdwxmRCH9xQoKWEJyLlv+admQ2kpNfqo5Kb+ duw1ss7jtDryIrWMS8HBWx4lDxQCx+jfMCqgADm4lnC85BFppAY0JHIFojsAuzQVVcha SQ6S21G9U04KwS++NL1QU3HRVPhAYa04MhRPenJP+ZZtB/dbBK5d681QiY3SMj5jmw9i QWiFdPG3zulEfsKCwGTyYnR9bOzZK+gKZXBHcxzbKo70w7KXXwKqzAdS7enUXDcGhD0L 6zQA== X-Gm-Message-State: AOAM5318gwi14XggXuVzOPnRyGyJqDHRhw4TX9xPUh3EXBqEN5PfqTJb 3WeNcumPR07+TevpFsELXddVTLJ1Z7FsUHbndLAsAk2VRlGFNFfNY6hS6PumbmU12nGrCwc9Nv4 gu9OuhA3PleYj7Ml7vybSxvgzGFe4 X-Received: by 2002:a1c:4d0d:: with SMTP id o13mr119030wmh.70.1640161806601; Wed, 22 Dec 2021 00:30:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJxaZ676bBfkbDM9ipvMcx7Mwzr6YXpVK+BGvG7K1IdqnkI9kzwsmGfVYCo0meG5jwXnlGK2Tw== X-Received: by 2002:a1c:4d0d:: with SMTP id o13mr119007wmh.70.1640161806438; Wed, 22 Dec 2021 00:30:06 -0800 (PST) Received: from [192.168.3.132] (p5b0c646a.dip0.t-ipconnect.de. [91.12.100.106]) by smtp.gmail.com with ESMTPSA id m35sm10660481wms.1.2021.12.22.00.30.04 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 22 Dec 2021 00:30:06 -0800 (PST) Message-ID: Date: Wed, 22 Dec 2021 09:30:04 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.4.0 Subject: Re: [PATCH v1 06/11] mm: support GUP-triggered unsharing via FAULT_FLAG_UNSHARE (!hugetlb) Content-Language: en-US To: Jason Gunthorpe Cc: Linus Torvalds , Nadav Amit , Linux Kernel Mailing List , Andrew Morton , Hugh Dickins , David Rientjes , Shakeel Butt , John Hubbard , Mike Kravetz , Mike Rapoport , Yang Shi , "Kirill A . Shutemov" , Matthew Wilcox , Vlastimil Babka , Jann Horn , Michal Hocko , 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: <4D97206A-3B32-4818-9980-8F24BC57E289@vmware.com> <5A7D771C-FF95-465E-95F6-CD249FE28381@vmware.com> <20211221010312.GC1432915@nvidia.com> <900b7d4a-a5dc-5c7b-a374-c4a8cc149232@redhat.com> <20211221235916.GI1432915@nvidia.com> From: David Hildenbrand Organization: Red Hat In-Reply-To: <20211221235916.GI1432915@nvidia.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org On 22.12.21 00:59, Jason Gunthorpe wrote: > On Tue, Dec 21, 2021 at 06:40:30PM +0100, David Hildenbrand wrote: > >> What adds complexity to correctly maintain the "exclusive" state are at >> least: >> * KSM (might be harder, have to think about it) > > I know little about it, but isn't KSM like fork where it is trying to > WP pages with the intention of copying them? Shouldn't KSM completely > reject WP'ing a page that is under any kind of writable GUP? I think KSM will, similar to fork(), always have to try removing PageAnonExclusive() while synchronizing against concurrent GUP pins. If that fails, the page cannot be converted to KSM and consequently not be shared. That will need some rework of KSM AFAIU, but shouldn't be impossible to do. -- Thanks, David / dhildenb