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=-5.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, 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 7144DC4727E for ; Fri, 25 Sep 2020 21:13:29 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 093F621D42 for ; Fri, 25 Sep 2020 21:13:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="LGRP+Bqo" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 093F621D42 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 83AA66B0062; Fri, 25 Sep 2020 17:13:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8119A6B006C; Fri, 25 Sep 2020 17:13:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7006F6B006E; Fri, 25 Sep 2020 17:13:28 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0183.hostedemail.com [216.40.44.183]) by kanga.kvack.org (Postfix) with ESMTP id 5BACA6B0062 for ; Fri, 25 Sep 2020 17:13:28 -0400 (EDT) Received: from smtpin13.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 1D3668249980 for ; Fri, 25 Sep 2020 21:13:28 +0000 (UTC) X-FDA: 77302834896.13.rifle34_081198f2716a Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin13.hostedemail.com (Postfix) with ESMTP id EB140181415A0 for ; Fri, 25 Sep 2020 21:13:27 +0000 (UTC) X-HE-Tag: rifle34_081198f2716a X-Filterd-Recvd-Size: 5316 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by imf04.hostedemail.com (Postfix) with ESMTP for ; Fri, 25 Sep 2020 21:13:27 +0000 (UTC) Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601068406; 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=WHhAL9v3zJJ52AUThnEeMCqgRo1b0NgEd5SnfGp+7Wo=; b=LGRP+BqoPJe3Zh+Xe8bhkCzZq/7qzkGGxc8Fp5JUj8Ov/xVUBYvNG15aOnKv1Y+JFnya92 1gHQWlyPllQPhgFEMXDJvuBHceE7ZZ4BV9UbskM5m+0qBws12ZIPmFdo05nzC2g0MKkLmj a6KnVkkfG3XylI6bygJzg2XrYSC2LVo= Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-179-Jfc8qEBIOdmKSn_vbau39w-1; Fri, 25 Sep 2020 17:13:24 -0400 X-MC-Unique: Jfc8qEBIOdmKSn_vbau39w-1 Received: by mail-qk1-f199.google.com with SMTP id q131so2998646qke.22 for ; Fri, 25 Sep 2020 14:13:24 -0700 (PDT) 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=WHhAL9v3zJJ52AUThnEeMCqgRo1b0NgEd5SnfGp+7Wo=; b=p43zQWQrfXlGljddPp41oRLTMNHRAYpX7CTITnppehtHhT/utEiyUeoYtFBMdAKzvj 4DduNkNeKduWgyGQNHxKEuXo07zXikALK+6cgMvo7agD/U63ijqhHbBodi3kDE9eIcvW mhVVX/a1MgZqNZ6aBSfXXEcjz+/NhN4oAFJeQtNdye28pJtCrLXdR+2b5ioC7LOI8M9w hhukPZxLQaspr4mTmRaItYhU9XEJfTUrRD9F7G84AJSc87V1TFLynK73YVq9qQtZZa58 JKNIVIpWpU++HWdyLj2lCdxaqUmvmwbQMArKbYNUXSoDK2MDmteYRrM6JHkaQYS0s6RF fmTw== X-Gm-Message-State: AOAM532/qpznrd7EXrhM87BWjaGTRZq67CRKi3Gwq8rIpud7voNjjdIc zbxP4uRY9TtM0P7us11O22qxWgKC/TkW7FXNNVUL6K7REeM0SvK2rRWXmCKEzu8UE0QR7rdWvBu s4xddCGfbAv0= X-Received: by 2002:a37:314:: with SMTP id 20mr2005157qkd.274.1601068404296; Fri, 25 Sep 2020 14:13:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwHqVj5aglcCns/5Ku4LvgGYnYT271ptwF9LRzLwzk1xcpHU7WkQOIihfzK4WTIQGToHllv4Q== X-Received: by 2002:a37:314:: with SMTP id 20mr2005137qkd.274.1601068404044; Fri, 25 Sep 2020 14:13:24 -0700 (PDT) Received: from xz-x1 (bras-vprn-toroon474qw-lp130-11-70-53-122-15.dsl.bell.ca. [70.53.122.15]) by smtp.gmail.com with ESMTPSA id 76sm2498044qkl.127.2020.09.25.14.13.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Sep 2020 14:13:23 -0700 (PDT) Date: Fri, 25 Sep 2020 17:13:21 -0400 From: Peter Xu To: Linus Torvalds Cc: Jason Gunthorpe , John Hubbard , Linux-MM , Linux Kernel Mailing List , Andrew Morton , Jan Kara , Michal Hocko , Kirill Tkhai , Kirill Shutemov , Hugh Dickins , Christoph Hellwig , Andrea Arcangeli , Oleg Nesterov , Leon Romanovsky , Jann Horn Subject: Re: [PATCH 1/5] mm: Introduce mm_struct.has_pinned Message-ID: <20200925211321.GC188812@xz-x1> References: <20200923002735.GN19098@xz-x1> <20200923170759.GA9916@ziepe.ca> <20200924143517.GD79898@xz-x1> <20200924165152.GE9916@ziepe.ca> <20200924175531.GH79898@xz-x1> <20200924181501.GF9916@ziepe.ca> <20200924183418.GJ79898@xz-x1> <20200924183953.GG9916@ziepe.ca> <20200924213010.GL79898@xz-x1> 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 Fri, Sep 25, 2020 at 12:56:05PM -0700, Linus Torvalds wrote: > So I think we can simply add a > > if (page_mapcount(page) != 1) > return false; > > to page_maybe_dma_pinned(), and that very naturally protects against > the "is the page count perhaps elevated due to a lot of forking?" How about the MAP_SHARED case where the page is pinned by some process but also shared (so mapcount can be >1)? > And honestly, since this is all getting fairly late in the rc, and it > took longer than I thought, I think we should do the GFP_ATOMIC > approach for now - not great, but since it only triggers for this case > that really should never happen anyway, I think it's probably the best > thing for 5.9, and we can improve on things later. Sorry for that. Maybe I should have moved even faster. Would the ATOMIC version always work? I mean, I thought it could fail anytime, so any fork() can start to fail for the tests too. PS. I do plan to post a GFP_KERNEL version soon today, no matter for this release or the next one. -- Peter Xu