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=-0.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, HTML_MESSAGE,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no 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 125E5C433DF for ; Fri, 21 Aug 2020 02:34:45 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C5969207DE for ; Fri, 21 Aug 2020 02:34:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="cBqkZt3H" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C5969207DE 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 6CE6E6B0083; Thu, 20 Aug 2020 22:34:43 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 680068D002F; Thu, 20 Aug 2020 22:34:43 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 546D26B0087; Thu, 20 Aug 2020 22:34:43 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0232.hostedemail.com [216.40.44.232]) by kanga.kvack.org (Postfix) with ESMTP id 3D76B6B0083 for ; Thu, 20 Aug 2020 22:34:43 -0400 (EDT) Received: from smtpin04.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id F28061F10 for ; Fri, 21 Aug 2020 02:34:42 +0000 (UTC) X-FDA: 77173007604.04.wine59_220087f27035 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin04.hostedemail.com (Postfix) with ESMTP id C3BCF80104EF for ; Fri, 21 Aug 2020 02:34:42 +0000 (UTC) X-HE-Tag: wine59_220087f27035 X-Filterd-Recvd-Size: 6740 Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by imf49.hostedemail.com (Postfix) with ESMTP for ; Fri, 21 Aug 2020 02:34:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1597977281; 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=hk20+wSbZXL0cvU8MHTTVjZjd6j7iSMtHnOD4c8iMyo=; b=cBqkZt3HiA4wRD2vPEQrtGYhsVtmWwrqNt7Jl7+slGAIIq7Z86LNahIVyfpuEwZ+E335A+ andMWgrBw2SeQ4e66gl/4Pz6QWdBj+ErEWN82exrMYdUEDHu+xGA9qxtozGglVYIPEa9Er 6fyQZ7RtKIN5IeyngXWhcpCuU8poPhE= Received: from mail-lj1-f198.google.com (mail-lj1-f198.google.com [209.85.208.198]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-163-MW5wHMd7PAe7FbLU5bc6zQ-1; Thu, 20 Aug 2020 22:34:38 -0400 X-MC-Unique: MW5wHMd7PAe7FbLU5bc6zQ-1 Received: by mail-lj1-f198.google.com with SMTP id y22so166545ljn.1 for ; Thu, 20 Aug 2020 19:34:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=hk20+wSbZXL0cvU8MHTTVjZjd6j7iSMtHnOD4c8iMyo=; b=A67fNbIJbMqngEwL60icqoQFSLDWOaxnQYBWC2b1r/jmF9hF7C6mmwPIARuWeOj975 1dRkQVDFgR/38Q6APi4yH1Rd03uNRN0CvSOjyfwRsSZwAG/5/lx1CHEuMU1hzkKGStrO cGFY/d2FB7EwxAYAJpz1MecsjUpR9c+BP3gk2vaf/eOYUCxdlHzmIkTmksIQUdfZQ18l 8PdDDYYfQtY2St6RqTDjyUs7UASaIkmQwV1EkPwF/xvfqQ5CNf4+puo8G4YyReLWVxO7 FXnemUWCEqe6LYB5MBufxysW3WxPvsWh5+mjFTjUYaWGbE+iUBGnCzNo3KMP24+RuEnU 5Kug== X-Gm-Message-State: AOAM532r1FMfvsrz11wJQO9vJXo97AM+vL3Zd0lyvxUdtuA99U/Mfp1F rFTF8fokBQMYwMpD18r4N4K7gew6d1udBQReKsM3ABibIH8TEMPoW65jGBCqkpmTQ1wX488uMDL 0Ompnx42q56GoqXti70TjpajYVqU= X-Received: by 2002:a05:651c:1390:: with SMTP id k16mr386902ljb.176.1597977277419; Thu, 20 Aug 2020 19:34:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyMpD+2m1L128bCVoJlpEgLP1nzPg15+VXFxmwcGBOFLICzDVPwLrgaPlxDPDsLxUEKX0153UWM/GXcYp5UzZk= X-Received: by 2002:a05:651c:1390:: with SMTP id k16mr386879ljb.176.1597977277063; Thu, 20 Aug 2020 19:34:37 -0700 (PDT) MIME-Version: 1.0 References: <20200811183950.10603-1-peterx@redhat.com> <20200811214255.GE6353@xz-x1> <20200820215449.GB358043@xz-x1> In-Reply-To: From: Peter Xu Date: Thu, 20 Aug 2020 22:34:25 -0400 Message-ID: Subject: Re: [PATCH v3] mm/gup: Allow real explicit breaking of COW To: Linus Torvalds Cc: Andrea Arcangeli , Linux-MM , Linux Kernel Mailing List , Andrew Morton , Marty Mcfadden , "Maya B . Gokhale" , Jann Horn , Christoph Hellwig , Oleg Nesterov , Kirill Shutemov , Jan Kara Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=zhexu@redhat.com X-Mimecast-Spam-Score: 0.001 X-Mimecast-Originator: redhat.com Content-Type: multipart/alternative; boundary="000000000000f5ba5b05ad5a131c" X-Rspamd-Queue-Id: C3BCF80104EF X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam04 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: --000000000000f5ba5b05ad5a131c Content-Type: text/plain; charset="UTF-8" Yep. I'll run some test and update soon. Thanks, Peter On Thu., Aug. 20, 2020, 18:01 Linus Torvalds wrote: > On Thu, Aug 20, 2020 at 2:54 PM Peter Xu wrote: > > > > I kind of prefer the new suggestion to remove code rather than adding new > > codes. I definitely don't know enough on the side effect of it, > especially > > performance-wise on either ksm or swap, but... IIUC the worst case is > we'll get > > some perf report later on, and it seems also not hard to revert the > patch later > > if we want. > > Well, would you be willing to try this patch out? > > After you apply that patch, you should be able to remove the > should_force_cow_break() games entirely, because a write to the page > should always break cow towards the writer if there are any GUP users > around (put another way: away from the GUP). > > However, to make the test meaningful, it really should do some swap > testing too. > > Linus > --000000000000f5ba5b05ad5a131c Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Yep.=C2=A0 I'll run some test and update soon.=C2=A0<= div dir=3D"auto">
Thanks,=C2=A0
Peter

On Thu., Aug. 20, 2020, 18:01 Linus Torvalds <torvalds@linux-foundation.org= > wrote:
On Thu, Aug 20, 2020 at= 2:54 PM Peter Xu <peterx@redhat.com> wrote:
>
> I kind of prefer the new suggestion to remove code rather than adding = new
> codes.=C2=A0 I definitely don't know enough on the side effect of = it, especially
> performance-wise on either ksm or swap, but... IIUC the worst case is = we'll get
> some perf report later on, and it seems also not hard to revert the pa= tch later
> if we want.

Well, would you be willing to try this patch out?

After you apply that patch, you should be able to remove the
should_force_cow_break() games entirely, because a write to the page
should always break cow towards the writer if there are any GUP users
around (put another way: away from the GUP).

However, to make the test meaningful, it really should do some swap testing= too.

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Linus
--000000000000f5ba5b05ad5a131c--