Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3186752pxk; Mon, 28 Sep 2020 10:25:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyHd4cT0CPbj6kqOUcseolZSFRd4RXXONemyws7rSIXMmh+L12alnmtgZUKuzjH5Av1rwSa X-Received: by 2002:a17:906:2681:: with SMTP id t1mr2783317ejc.474.1601313912581; Mon, 28 Sep 2020 10:25:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601313912; cv=none; d=google.com; s=arc-20160816; b=lDkVwFY6OMGScgyGhMld1lfy8W611/ewR0qQACG4ay1FOdh/qj8x6ooUKYn+fveKA4 2hJn8UR8H0bYWTBiSFQXlf7MKKARmMTAN7fuY0Nk8bOfv49V7yxr4ZmXWvY1ONrr1na4 B6k8m2PnzME5UK9+Y1KWV0sV1Ec0FDm45GfciHNauobTWRs57nyEl47+VMUBr8aUn8PK WM0t7rmNZ2q5tmzT0i8Hj5Hhhfe0hcFYi93ugzNKAsN4HVllJRb7oqr0fKkiXb7bW3Uw u5IGubd7XJbU5Rogc4y0vKqa5QkPDFBUOmqhQF8uQO+pQTgBOCJrxJfi1ERDgPQo2lfx x0cw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=1LTS8PVfmK/f/9X7OPUUAt2g8tDoLOrDZ8lScUVnhFM=; b=aNMFM2uZdUKha5GC7MB76cCMsny28AaM7JnRR3qYO80TdxLd7ckjdozq7Urv/WZ547 0AZxGmu254CPOoAJrXLmvPc2P5sSjn4W/kHrMcwH05XNHfxYOvbb6SAkfpFn0VigpPM0 YPLQpiaeYNGXno7Tz2mYUmsdxnuWX0AsLdtvVPk4G16tMXkSZ4JL1XRTGjpcECcMd14P cd64XS2ljDBjm5mD8BpRFz2U7KJHU2lwK9JHQc+6dAMKfwn+tHo/5hYMHdS5EGvwukHY SML5/1FohsinJpz6kuBaTiWjaHyNcycsjTqAYhcQSB8/16fRMBzq4vp9SLCwhxBwFczK Fnlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=iFnW1dOi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z9si1082527ede.431.2020.09.28.10.24.49; Mon, 28 Sep 2020 10:25:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=iFnW1dOi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726617AbgI1RXD (ORCPT + 99 others); Mon, 28 Sep 2020 13:23:03 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:60251 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726409AbgI1RXC (ORCPT ); Mon, 28 Sep 2020 13:23:02 -0400 Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601313780; 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=1LTS8PVfmK/f/9X7OPUUAt2g8tDoLOrDZ8lScUVnhFM=; b=iFnW1dOi+plTG7B2wmhHx3OK/GBln+I/rSNRzTic0N5amtRTeptJAgFz+oVjO/7ooPhxX/ F9VWg0PwWImTMT1mwlbzpgV8LtSY4wRkTAXi/K3ORgBOeP18O7HikvKkFgDcgtJVH3DYC9 TGHBQiTVr2W5mMY1cykVZz7tjes3Ltc= Received: from mail-qv1-f71.google.com (mail-qv1-f71.google.com [209.85.219.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-542-bj9tSHNTNDy0mO8U3kDU_w-1; Mon, 28 Sep 2020 13:22:59 -0400 X-MC-Unique: bj9tSHNTNDy0mO8U3kDU_w-1 Received: by mail-qv1-f71.google.com with SMTP id t7so1033293qvz.5 for ; Mon, 28 Sep 2020 10:22:59 -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=1LTS8PVfmK/f/9X7OPUUAt2g8tDoLOrDZ8lScUVnhFM=; b=mH7hfEOWX4nNCBfRDvZFbsg1/2voixslw0lXOsxUXcioKE+tbQy/cXitwsCrsBN8fi UlqsJwHXYD1zDDQD8T1Jp4ez0mP2dTC6ZjZnv9TTipA12ThERDksh6gzyR46FG7e8g3I dZsAjY8h6Ab8e6RVG9JNE+uQDQL/FE1K1K15buae0u6jGbWUsZqvIi/23uH0WNFOxB4a JqWtkpckhTg+zzpOaeJXPOkAbChInC4ol/XUDtF7ZeZ8Ql8RvpKHSpK2paCxmBY4/tTa Nk1a4v7XskXxXdoSCBkj2JmjMdDlTYNLWiLGL7JyfeM2D4LoI1iI6C9pZZUdmN4eoaId gSXw== X-Gm-Message-State: AOAM531nIVKHNXKgdta5D5wOhC7nwJ52Em1646mXIDxgJwQ+5yufSn0G ch1rgictwYnEKE6XtEPG5RLfvS3w1hMTkY2OltjEt547xmkSOMZuCVWOMQF8Jqw8hDipKOA1LAM 9gn7zEdPs6k5SvYLKpPw32c0R X-Received: by 2002:a37:7687:: with SMTP id r129mr515675qkc.264.1601313778682; Mon, 28 Sep 2020 10:22:58 -0700 (PDT) X-Received: by 2002:a37:7687:: with SMTP id r129mr515652qkc.264.1601313778371; Mon, 28 Sep 2020 10:22:58 -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 e7sm2028873qtk.17.2020.09.28.10.22.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Sep 2020 10:22:57 -0700 (PDT) Date: Mon, 28 Sep 2020 13:22:56 -0400 From: Peter Xu To: Linus Torvalds Cc: Jason Gunthorpe , Leon Romanovsky , 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 , Jann Horn Subject: Re: [PATCH 1/5] mm: Introduce mm_struct.has_pinned Message-ID: <20200928172256.GB59869@xz-x1> References: <20200926004136.GJ9916@ziepe.ca> <20200927062337.GE2280698@unreal> <20200928124937.GN9916@ziepe.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Sep 28, 2020 at 09:17:09AM -0700, Linus Torvalds wrote: > On Mon, Sep 28, 2020 at 5:49 AM Jason Gunthorpe wrote: > > > > Not seeing an obvious option besides adding a smp_mb() before > > page_maybe_dma_pinned() as Peter once suggested. > > That is going to be prohibitively expensive - needing it for each pte > whether it's pinned or not. > > I really think the better option is a "don't do that then". This has > _never_ worked before either except by pure luck. Yes... Actually I am also thinking about the complete solution to cover read-only fast-gups too, but now I start to doubt this, at least for the fork() path. E.g. if we'd finally like to use pte_protnone() to replace the current pte_wrprotect(), we'll be able to also block the read gups, but we'll suffer the same degradation on normal fork()s, or even more. Seems unacceptable. The other question is, whether we should emphasize and document somewhere that MADV_DONTFORK is still (and should always be) the preferred way, because changes like this series can potentially encourage the other way. -- Peter Xu