Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1256943pxk; Thu, 10 Sep 2020 10:47:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzUC+77v3AVEnw9Bza62fXqRzVsyeOM7wZMbE0YN/Gw2ws2dJGbTvc/Bf4OKwPIKaasjSLP X-Received: by 2002:a50:c182:: with SMTP id m2mr10285209edf.70.1599760048827; Thu, 10 Sep 2020 10:47:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599760048; cv=none; d=google.com; s=arc-20160816; b=DYt3+Bl1jBijNN5/WzSSdLgpFWOtzpCxra54jHzqtRhUOjvXBVKhyAdCPe4gHfzfKh pHhM5mmQsQ+fHJO9FF90cXzqI2qw74cpX7/4lc4oTeutMOfMqK6d2p1PL4xdG2fE3XId 7NBwXq5JpKFknW9vtUgUusgcd/A8O28l66EeBnaFexlZb8e9kxh41tzUECBxsYFKlsjY lzD+mqs36J9L75F4BclAmkFlu6WTKOnn70Zc/mFGif+tKBPdoOzpzuWz0fgWQXEYCOkc cMkj694rPUx54w6yYEKntgZPok8XWR4ZPGJbD9l8J5ld1b/4ohDuyZE0WFgEG2j0aHm/ 3ZJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=tV9NvYryEbzez94zd9hdsCWt3FfBuGGawTOfDap0eBk=; b=RSk1XxC8nM83F4OI3nIPTK6m/vHgcyLNkL4e4EkTL8JuX7/v3s4q/Q+YAdOq8AsQj7 lKO8VkAph0BW4T48VmzwxIOgvdHK7RQHWUjd7lV+lLOIlTR0+O3cLViYlhFy2YsSldkI efN0GucSvSAiM1jiDrBfaFGSaDVXtDJDed5aKGw+b7zoPhHoaPxmd4ywQFN9MdfB96pf sc1bLijcmKKeEG9qM4gw/VkifXpRnpBfbtyxUeU6JnYYKlYpz7nBBJipFPnaSuPO/1vc 5abWM42ahP9+ENGPDDTv2hUbjnSf/7DnnQbN9IIc/a5IQtNctRpooiZm+jFfjN6dEYE7 IsXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=CyoQUM+S; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u17si3829101edx.501.2020.09.10.10.47.05; Thu, 10 Sep 2020 10:47:28 -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=@linux-foundation.org header.s=google header.b=CyoQUM+S; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726918AbgIJRph (ORCPT + 99 others); Thu, 10 Sep 2020 13:45:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58266 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727023AbgIJRm6 (ORCPT ); Thu, 10 Sep 2020 13:42:58 -0400 Received: from mail-lj1-x244.google.com (mail-lj1-x244.google.com [IPv6:2a00:1450:4864:20::244]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 148E6C061573 for ; Thu, 10 Sep 2020 10:42:41 -0700 (PDT) Received: by mail-lj1-x244.google.com with SMTP id c2so9258943ljj.12 for ; Thu, 10 Sep 2020 10:42:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=tV9NvYryEbzez94zd9hdsCWt3FfBuGGawTOfDap0eBk=; b=CyoQUM+SKXH6085O6WtByg3nDuki2CTSBORvYvwm25BqShZutFnNs6mSZACayZwSEH qcd6gDs3XmrAOcCBysWWLpsCbEXmLRDCQnQxo0ENK46fWC+ppV/l5rSOr47qH79HuDsY BAC6cJAHl7u65bYmrM5WLZPBZBfoI7ltEXEKA= 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=tV9NvYryEbzez94zd9hdsCWt3FfBuGGawTOfDap0eBk=; b=gaxeIL1UgV6zoe7GWetUE3JjPlgTm/X5pVQ00k/OZDKQrq6c5PRLIVhi8kAemoy5ps 0x86BFP2GZaLbIvFrB7LlPc1ObX6yWnx7PjT6Kl+uRgBQ7SYnH+WNNTKQVSOdoDLPSQ/ KELD2jAX7P5H7vhpHm32HcMM5lphNrh3gM7ZRY6f4+Kfpz0x7La22mX54LTh68Fw3YDm PHFUyslCe3K/LjZuZ7dMMw4lMryBkx7FGOpaEjOP0rmiq97zsG1GHZpMdw1KaXz18CZk VH8ryN95hNffSAl1SoyHo7DAJnAST4ls4agqZyEZKVqVs7w8Tqhbu1F/ZVu1LwM32Sss goJw== X-Gm-Message-State: AOAM531slHtsCwgFPVs39pmhW7QgBOfxIzDwG8u8VG9ExhEJkJywikrz 27PB+TS+/Y0relb78Y0rP8T9ra/1bV4cCA== X-Received: by 2002:a2e:6a04:: with SMTP id f4mr4611377ljc.119.1599759759148; Thu, 10 Sep 2020 10:42:39 -0700 (PDT) Received: from mail-lj1-f178.google.com (mail-lj1-f178.google.com. [209.85.208.178]) by smtp.gmail.com with ESMTPSA id u18sm1489111lfg.86.2020.09.10.10.42.38 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 10 Sep 2020 10:42:38 -0700 (PDT) Received: by mail-lj1-f178.google.com with SMTP id b19so9256106lji.11 for ; Thu, 10 Sep 2020 10:42:38 -0700 (PDT) X-Received: by 2002:a19:7d8b:: with SMTP id y133mr4765702lfc.152.1599759354367; Thu, 10 Sep 2020 10:35:54 -0700 (PDT) MIME-Version: 1.0 References: <20200907180058.64880-1-gerald.schaefer@linux.ibm.com> <20200907180058.64880-2-gerald.schaefer@linux.ibm.com> <0dbc6ec8-45ea-0853-4856-2bc1e661a5a5@intel.com> <20200909142904.00b72921@thinkpad> <20200909192534.442f8984@thinkpad> <20200909180324.GI87483@ziepe.ca> <20200910093925.GB29166@oc3871087118.ibm.com> In-Reply-To: <20200910093925.GB29166@oc3871087118.ibm.com> From: Linus Torvalds Date: Thu, 10 Sep 2020 10:35:38 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFC PATCH v2 1/3] mm/gup: fix gup_fast with dynamic page table folding To: Alexander Gordeev Cc: Jason Gunthorpe , Gerald Schaefer , Dave Hansen , John Hubbard , LKML , linux-mm , linux-arch , Andrew Morton , Russell King , Mike Rapoport , Catalin Marinas , Will Deacon , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Jeff Dike , Richard Weinberger , Dave Hansen , Andy Lutomirski , Peter Zijlstra , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Arnd Bergmann , Andrey Ryabinin , linux-x86 , linux-arm , linux-power , linux-sparc , linux-um , linux-s390 , Vasily Gorbik , Heiko Carstens , Christian Borntraeger , Claudio Imbrenda Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 10, 2020 at 2:40 AM Alexander Gordeev wrote: > > It is only gup_fast case that exposes the issue. It hits because > pointers to stack copies are passed to gup_pXd_range iterators, not > pointers to real page tables itself. Can we possibly change fast-gup to not do the stack copies? I'd actually rather do something like that, than the "addr_end" thing. As you say, none of the other page table walking code does what the GUP code does, and I don't think it's required. The GUP code is kind of strange, I'm not quite sure why. Some of it unusually came from the powerpc code that handled their special odd hugepage model, and that may be why it's so different. How painful would it be to just pass the pmd (etc) _pointers_ around, rather than do the odd "take the address of local copies"? Linus