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=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable 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 393FDC433E0 for ; Tue, 9 Feb 2021 17:53:42 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 9EF3664EBE for ; Tue, 9 Feb 2021 17:53:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9EF3664EBE Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 2CC216B006C; Tue, 9 Feb 2021 12:53:41 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 27CFA6B006E; Tue, 9 Feb 2021 12:53:41 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 11E086B0070; Tue, 9 Feb 2021 12:53:41 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0252.hostedemail.com [216.40.44.252]) by kanga.kvack.org (Postfix) with ESMTP id F13846B006C for ; Tue, 9 Feb 2021 12:53:40 -0500 (EST) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id BE029C5C6 for ; Tue, 9 Feb 2021 17:53:40 +0000 (UTC) X-FDA: 77799477000.18.rice71_1f0874f27609 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin18.hostedemail.com (Postfix) with ESMTP id 9989010055023 for ; Tue, 9 Feb 2021 17:46:18 +0000 (UTC) X-HE-Tag: rice71_1f0874f27609 X-Filterd-Recvd-Size: 4675 Received: from mail-qt1-f174.google.com (mail-qt1-f174.google.com [209.85.160.174]) by imf09.hostedemail.com (Postfix) with ESMTP for ; Tue, 9 Feb 2021 17:46:17 +0000 (UTC) Received: by mail-qt1-f174.google.com with SMTP id h16so13533132qth.11 for ; Tue, 09 Feb 2021 09:46:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=YJ1H3KkVJ1QsrWVrAqvw/WZDfdncCuLa8Ig/hildsUY=; b=WqO4eKL8/iRHzq2aaqjn55/EXC7y9UobGgQV8WGt8RhG/Jv++aUylXy2MQE6fRRvRt lZdnbY2pW1atiRjmLxUcFG7y2w/5wF1wmFHLlqIw3xXwD0YV47Zx+m/eqwuZT4eYLLHr jqV+lg43fM761qIWRil6I4wVeC9kwyz51DiCNqyQSxQmNoRWXmO6MR+shLBIIvhM9b+x fmh0cnQAvefP8yruP77NwJeZEAeKdW4crhrHJ0GyXXeoTs8BRCf/LXIP+MhdyAHirEYR kW8WJKjdu2z7gVxvFTnw+LM6eo6OoicTFPTJmhQeP/9acct9wqpIHR/3MUb1CAVuvl2S e/hg== 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=YJ1H3KkVJ1QsrWVrAqvw/WZDfdncCuLa8Ig/hildsUY=; b=FzlfuK4eyOYd4RwcmnEhpzjZz4FHk/VALGVpOhYGYaCgpIuJ+jXIY7JvwghiJYoX5w mMfSjU8LKfvL9wOd+CFEfKYSGsbL638lLlJHYaqKhi3r8fPd1zsdxgsCSUOUjWwdRl0Y mGNuoFYntMyw7vlh8KX+VIZqDX5Eu4KxKKeY6hxwktHOQX0Bo3zPGHyXcLyo4ePjhf9D QWKIkgk1m72K1gZqtA+kWXSD8je/vHKBSTd76xEVdluqxj6OezhU7/UuBnuRwFIDSUsA Yl6tM5VyCQyaBlvFoEnmXUSK6/kPAdg742jHLqWTeII7oN2EpIw9ieMIna3h0C9U8KD3 paBQ== X-Gm-Message-State: AOAM533p404a20Lpe0pFUspqLt09ObfeN1lfAgf2wohK0dCR64TB1o4o m+9kKkvNCgvB4XaHiH9SYMeV75HsNX31qRuq X-Google-Smtp-Source: ABdhPJxY8T2nkv01k4Wlrc+xxnILsbVBA/fP6+5/5kg4k0jDQORFznk7eDtahqaLHK1G01s6HBZAlQ== X-Received: by 2002:a37:a346:: with SMTP id m67mr4862589qke.301.1612892424872; Tue, 09 Feb 2021 09:40:24 -0800 (PST) Received: from ziepe.ca (hlfxns017vw-142-162-115-133.dhcp-dynamic.fibreop.ns.bellaliant.net. [142.162.115.133]) by smtp.gmail.com with ESMTPSA id v145sm20045172qka.27.2021.02.09.09.40.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Feb 2021 09:40:24 -0800 (PST) Received: from jgg by mlx with local (Exim 4.94) (envelope-from ) id 1l9Wzv-005XFi-SW; Tue, 09 Feb 2021 13:40:23 -0400 Date: Tue, 9 Feb 2021 13:40:23 -0400 From: Jason Gunthorpe To: Peter Xu Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Matthew Wilcox , Linus Torvalds , Kirill Tkhai , Mike Rapoport , David Gibson , Kirill Shutemov , Christoph Hellwig , Miaohe Lin , Gal Pressman , Jann Horn , Jan Kara , Wei Zhang , Mike Kravetz , Andrea Arcangeli , Andrew Morton Subject: Re: [PATCH v4 3/5] mm: Introduce page_needs_cow_for_dma() for deciding whether cow Message-ID: <20210209174023.GI4718@ziepe.ca> References: <20210209030229.84991-1-peterx@redhat.com> <20210209030229.84991-4-peterx@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210209030229.84991-4-peterx@redhat.com> 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 Mon, Feb 08, 2021 at 10:02:27PM -0500, Peter Xu wrote: > We've got quite a few places (pte, pmd, pud) that explicitly checked against > whether we should break the cow right now during fork(). It's easier to > provide a helper, especially before we work the same thing on hugetlbfs. > > Since we'll reference is_cow_mapping() in mm.h, move it there too. Actually it > suites mm.h more since internal.h is mm/ only, but mm.h is exported to the > whole kernel. With that we should expect another patch to use is_cow_mapping() > whenever we can across the kernel since we do use it quite a lot but it's > always done with raw code against VM_* flags. > > Signed-off-by: Peter Xu > --- > include/linux/mm.h | 21 +++++++++++++++++++++ > mm/huge_memory.c | 8 ++------ > mm/internal.h | 5 ----- > mm/memory.c | 8 +------- > 4 files changed, 24 insertions(+), 18 deletions(-) Reviewed-by: Jason Gunthorpe Jason