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 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 3E861C433DB for ; Tue, 19 Jan 2021 20:14:44 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 6F68D23107 for ; Tue, 19 Jan 2021 20:14:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6F68D23107 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=soleen.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id BBE7A6B0005; Tue, 19 Jan 2021 15:14:42 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B47376B0006; Tue, 19 Jan 2021 15:14:42 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9E8DE6B0007; Tue, 19 Jan 2021 15:14:42 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0110.hostedemail.com [216.40.44.110]) by kanga.kvack.org (Postfix) with ESMTP id 84FC86B0005 for ; Tue, 19 Jan 2021 15:14:42 -0500 (EST) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 53D248249980 for ; Tue, 19 Jan 2021 20:14:42 +0000 (UTC) X-FDA: 77723627604.16.feet65_550019f27554 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin16.hostedemail.com (Postfix) with ESMTP id 3433D100E6903 for ; Tue, 19 Jan 2021 20:14:42 +0000 (UTC) X-HE-Tag: feet65_550019f27554 X-Filterd-Recvd-Size: 5220 Received: from mail-ed1-f42.google.com (mail-ed1-f42.google.com [209.85.208.42]) by imf08.hostedemail.com (Postfix) with ESMTP for ; Tue, 19 Jan 2021 20:14:41 +0000 (UTC) Received: by mail-ed1-f42.google.com with SMTP id c6so15960924ede.0 for ; Tue, 19 Jan 2021 12:14:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=soleen.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=byRyQq0Zgtt5NgbHeIaYNBYUmY4ZzoHZBsdIAqa6syw=; b=Gvl+pXMIcc2co0RDWG1pUGT2dp42EWP1Oa9B+3sOC1fEXqHYY0TNyn4mV/ProTlP1F 6ThCzCQJMElcNtFlKMxBEDs+M43Z3iur8b+I/VPtsNTEn3DRGKXGgQHDLK6dELHcR2if ZHLG94pSN934JR9GRWS8HNj4barzLvHkGaTA708e9PQrN8RNfCZyVobjym7lfLJlenUa 8IEjgp2B1w5yyZccOskcIDNMCgMkjpWDivGrzGl9WjZsYw/oYhe93GkKRG6KmcDUeVkr FO7Dk3NxbIwrPknVjZlUQmuSVKP4tIXyPHDJ5WnwBVugDNbaE5g4vXhLCKObLd+RZ6D0 6rxQ== 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=byRyQq0Zgtt5NgbHeIaYNBYUmY4ZzoHZBsdIAqa6syw=; b=jSKH4m6P5emlPl4pWbuX7QxmV+wK1J9UcWz/s83lyjtbN2+bBnS3LUhMhJVE301EHh LX0Mka6C8EdTS5m9Wnjzmvv7ojskVnIjyX0M3NNrSsYZAzuJ4HaxG+MbzK13nrXA5389 oyvyDc+0A0Ein/xAmUXmu5t8QaYuVKWJOBzKFqol8jrj6CeW0+18HoElCsKZC066n91O kFRgwMw/IrC0hKv8EUN5fWACdKHXVf+vqNUuBkJlRjeKkgjwbmMW/fD/A/lX6JeqzC8B ZEs9PjG7tFl4N1MmT5C0XdGV2kdW8OVkHhVqLPdHuHmWUt1LwKB82tzIlZbqIuX0p+F6 OELg== X-Gm-Message-State: AOAM531qLwKTXrRSfniUGVPSKF0Ou+V+WIXBb1Ll6Imy2mGMVDCeeoaL u4JD6R4Xs2n0gcO4PvWFlQpfIrnkjYzDb9otICBDGQ== X-Google-Smtp-Source: ABdhPJz8pqr0iEoSJaOvD5DC/VO5AZGkgHQio8PjFJuSvIBVP2GzlgXm4FTOWjvYilIQV8nA55C/YRhAG3ldeAxU44U= X-Received: by 2002:a05:6402:304e:: with SMTP id bu14mr4545815edb.60.1611087280334; Tue, 19 Jan 2021 12:14:40 -0800 (PST) MIME-Version: 1.0 References: <20210119043920.155044-1-pasha.tatashin@soleen.com> <20210119043920.155044-9-pasha.tatashin@soleen.com> <20210119183013.GB4605@ziepe.ca> <20210119184751.GD4605@ziepe.ca> In-Reply-To: <20210119184751.GD4605@ziepe.ca> From: Pavel Tatashin Date: Tue, 19 Jan 2021 15:14:04 -0500 Message-ID: Subject: Re: [PATCH v5 08/14] mm/gup: do not allow zero page for pinned pages To: Jason Gunthorpe Cc: LKML , linux-mm , Andrew Morton , Vlastimil Babka , Michal Hocko , David Hildenbrand , Oscar Salvador , Dan Williams , Sasha Levin , Tyler Hicks , Joonsoo Kim , mike.kravetz@oracle.com, Steven Rostedt , Ingo Molnar , Peter Zijlstra , Mel Gorman , Matthew Wilcox , David Rientjes , John Hubbard , Linux Doc Mailing List , Ira Weiny , linux-kselftest@vger.kernel.org Content-Type: text/plain; charset="UTF-8" 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 19, 2021 at 1:47 PM Jason Gunthorpe wrote: > > On Tue, Jan 19, 2021 at 01:34:26PM -0500, Pavel Tatashin wrote: > > On Tue, Jan 19, 2021 at 1:30 PM Jason Gunthorpe wrote: > > > > > > On Mon, Jan 18, 2021 at 11:39:14PM -0500, Pavel Tatashin wrote: > > > > Zero page should not be used for long term pinned pages. Once pages > > > > are pinned their physical addresses cannot changed until they are unpinned. > > > > > > > > Guarantee to always return real pages when they are pinned by adding > > > > FOLL_WRITE. > > > > > > > > Signed-off-by: Pavel Tatashin > > > > mm/gup.c | 10 +++++++++- > > > > 1 file changed, 9 insertions(+), 1 deletion(-) > > > > > > No, this will definitely break things > > > > What will break > > Things assuming GUP doesn't break COW, making all GUP WRITE was > already tried and revered for some other reason > > > > Why does the zero page have to be movable? > > > > It is not even about being movable, we can't cow pinned pages returned > > by GUP call, how can we use zero page for that? > > The zero page is always zero, it is never written to. What does cow > matter? Hi Jason, I was thinking about a use case where userland would pin an address without FOLL_WRITE, because the PTE for that address is not going to be writable, but some device via DMA will write to it. Now, if we got a zero page we have a problem... If this usecase is not valid then the fix for movable zero page is make the zero page always come from a non-movable zone so we do not need to isolate it during migration, and so the memory can be offlined later. Pasha > > Jason