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 X-Spam-Level: X-Spam-Status: No, score=-11.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2430BC433E0 for ; Tue, 5 Jan 2021 21:43:10 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 9A16A22D73 for ; Tue, 5 Jan 2021 21:43:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9A16A22D73 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id E32F56B0101; Tue, 5 Jan 2021 16:43:08 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id DE2B36B0104; Tue, 5 Jan 2021 16:43:08 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CD1986B010A; Tue, 5 Jan 2021 16:43:08 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0127.hostedemail.com [216.40.44.127]) by kanga.kvack.org (Postfix) with ESMTP id B49A86B0101 for ; Tue, 5 Jan 2021 16:43:08 -0500 (EST) Received: from smtpin23.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 7FF58181AEF10 for ; Tue, 5 Jan 2021 21:43:08 +0000 (UTC) X-FDA: 77673047256.23.plot33_4609952274dc Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin23.hostedemail.com (Postfix) with ESMTP id 5DB9C37606 for ; Tue, 5 Jan 2021 21:43:08 +0000 (UTC) X-HE-Tag: plot33_4609952274dc X-Filterd-Recvd-Size: 5794 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by imf26.hostedemail.com (Postfix) with ESMTP for ; Tue, 5 Jan 2021 21:43:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1609882987; 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: in-reply-to:in-reply-to:references:references; bh=45VfqpcohiVmcpJsrhmwiMtIV0TA5yv5gJG2CjfKxSo=; b=Log45AwVsAIGkiTY6VgFtm+2ApCRRh7FpaZufmQwkp0/8Upu4xz799rS7xR0qiqv7soWXP war40/UOH5nRGFERcuFqTcEvDbqcuCI2RLBN8BvCSprh1Msv85d/1XkY9XdS0WA8stbyAH YmhaQgj4GwgBjxwUmCbXchQg1NxglWQ= Received: from mail-qv1-f72.google.com (mail-qv1-f72.google.com [209.85.219.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-413-TaGEt-HePQGG61WVcG55FQ-1; Tue, 05 Jan 2021 16:43:03 -0500 X-MC-Unique: TaGEt-HePQGG61WVcG55FQ-1 Received: by mail-qv1-f72.google.com with SMTP id j5so691838qvu.22 for ; Tue, 05 Jan 2021 13:43:03 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=45VfqpcohiVmcpJsrhmwiMtIV0TA5yv5gJG2CjfKxSo=; b=HnGsrmc/fT6F+eeOWIsaVpjUtvxwYH8G0BC3RfMWZidV86euK0/DtHCzCmb+L0Rdbp ayqDEDGPAnA8YuxP6MR+YbqtjdrE2cqeYFgGDPOG4CNe2JmgBNO5mVBAzD8UXPbvjB99 ScgLECoqIlf7TpPHiP7aVQYW6uY+XkR3eZbCNruSmGQwMzE1pSG3T8ry4KYH2azdnJ1g mUnRZ36SlHB5cJv53ZT73gyT4g1b01ewkMwaqgo8TjHyCWCQYNLJjfvcEHjxseJYKeIl UuZPXu3ETl0bAtfTsTdqUGSp7+X3sLthYwZRc94JAXOhrenxS8K+tAY8rJ6AVLzZx4we JEtQ== X-Gm-Message-State: AOAM532POjClRoEtNTcKDUhH2IbY+lSmR//CMZbdh+JGWkcaQsuSy75q kCWNv9gRHZ3HhnIcYOPT4ynTKEsBZrwFmRNOXQ5mEyUtjAREvB/rMopdTqmvrYGzhklRTwTig8Y 48E7tIHEua1Q= X-Received: by 2002:aed:2183:: with SMTP id l3mr1424511qtc.75.1609882983347; Tue, 05 Jan 2021 13:43:03 -0800 (PST) X-Google-Smtp-Source: ABdhPJxiipSQoGXaCt4060scNPWjbGWYRsUdMzJxQbwaboNuzaTu8Uqm6e3uy3sSB2pDS7Ux7Ed3ww== X-Received: by 2002:aed:2183:: with SMTP id l3mr1424493qtc.75.1609882983088; Tue, 05 Jan 2021 13:43:03 -0800 (PST) Received: from xz-x1 ([142.126.83.202]) by smtp.gmail.com with ESMTPSA id f17sm224790qtv.68.2021.01.05.13.43.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Jan 2021 13:43:02 -0800 (PST) Date: Tue, 5 Jan 2021 16:43:00 -0500 From: Peter Xu To: Andrea Arcangeli Cc: Nadav Amit , Peter Zijlstra , linux-mm , lkml , Yu Zhao , Andy Lutomirski , Pavel Emelyanov , Mike Kravetz , Mike Rapoport , Minchan Kim , Will Deacon , Mel Gorman Subject: Re: [RFC PATCH v2 1/2] mm/userfaultfd: fix memory corruption due to writeprotect Message-ID: <20210105214300.GG149908@xz-x1> References: <73EE9007-65AF-4416-9930-D992C74447A9@vmware.com> <2844ACC1-8908-494C-B411-3C69B27A1730@vmware.com> <91523A61-1AF8-48F9-8650-D313032E550C@vmware.com> MIME-Version: 1.0 In-Reply-To: Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=peterx@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Disposition: inline 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 Tue, Jan 05, 2021 at 04:06:27PM -0500, Andrea Arcangeli wrote: > The postcopy live snapshoitting was the #1 use case so it's hard not > to mention it, but there's still other interesting userland use cases > of uffd-wp with various users already testing it in their apps, that > may ultimately become more prevalent, who knows. That's true. AFAIU umap [1] uses uffd-wp for their computings already. I didn't really measure how far it can go, but currently the library is highly concurrent, for example, there're quite a few macros that can tune the parallelism of the library [2]: UMAP_PAGE_FILLERS This is the number of worker threads that will perform read operations from the backing store (including read-ahead) for a specific umap region. UMAP_PAGE_EVICTORS This is the number of worker threads that will perform evictions of pages. Eviction includes writing to the backing store if the page is dirty and telling the operating system that the page is no longer needed. The write lock means at least all the evictor threads will be serialized, immediately makes UMAP_PAGE_EVICTORS meaningless... not to mention all the rest of read lock takers (filler threads, worker threads, etc.). So if it happens, I bet LLNL will suddenly observe a drastic drop after upgrading the kernel.. I don't know why umap didn't hit the tlb issue already. It seems to me that issues may only trigger with COW right after a stalled tlb so COW is the only one affected (or, is it?) while umap may not use cow that lot by accident. But I could be completely wrong on that. [1] https://github.com/LLNL/umap [2] https://llnl-umap.readthedocs.io/en/develop/environment_variables.html -- Peter Xu