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=-3.9 required=3.0 tests=BAYES_00,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 46F75C433DF for ; Thu, 27 Aug 2020 17:14:11 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 02F8120737 for ; Thu, 27 Aug 2020 17:14:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="PSw0ZaM0" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 02F8120737 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 559686B0002; Thu, 27 Aug 2020 13:14:10 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4E1C86B0003; Thu, 27 Aug 2020 13:14:10 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 385B86B0006; Thu, 27 Aug 2020 13:14:10 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0213.hostedemail.com [216.40.44.213]) by kanga.kvack.org (Postfix) with ESMTP id 1D5DF6B0002 for ; Thu, 27 Aug 2020 13:14:10 -0400 (EDT) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id CD2813638 for ; Thu, 27 Aug 2020 17:14:09 +0000 (UTC) X-FDA: 77196996618.12.toe12_3911da02706e Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin12.hostedemail.com (Postfix) with ESMTP id 95B43180559ED for ; Thu, 27 Aug 2020 17:14:09 +0000 (UTC) X-HE-Tag: toe12_3911da02706e X-Filterd-Recvd-Size: 4505 Received: from mail-lf1-f68.google.com (mail-lf1-f68.google.com [209.85.167.68]) by imf42.hostedemail.com (Postfix) with ESMTP for ; Thu, 27 Aug 2020 17:14:09 +0000 (UTC) Received: by mail-lf1-f68.google.com with SMTP id q8so938114lfb.6 for ; Thu, 27 Aug 2020 10:14:08 -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=M4prkjP1Ku3b1Mujmm7MQBoZsalaGZICkCWqtSa9I0Q=; b=PSw0ZaM0WvUn6MpwD6It0gaG27/wObSq1kVFCBecFjxl05M3hm/lJJJSvazPfJVOQT cjVnniEJR+1KQCr4oYfPbro+6zzdFrXrfxKFeKe1p1C/CgSLgLHArfWn+EP8lW7qYQ49 w0N1GHWVrfxOkaIDPpbVBPi4jLmvTyf7sMt34= 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=M4prkjP1Ku3b1Mujmm7MQBoZsalaGZICkCWqtSa9I0Q=; b=ATchyDy5VXsyPGIZUCNtKIniJXTizAvhYbyAfW/msAt9jL+2Ozj3mlj0uYpstx5DLc i0uXAgk/FxQDgMa38gAaWNVXnJnY0cBUt6IRhrot5F/XmU8HRn2r6D4gQTXbwKV7L0CG nl80Qba69HO4zGQOW+fqHr5352KAmVtjMagm7o4yf4miuZ71tTMlp8t8lbCDQlHuFFMN kbhIssmzbQShjhk1kmGHxR3um6MGvSNjbxGtEAvYxFC17P+T3D//OCQylUDGD/ydbJkP Ibmp0ZDs574+AsI6LILCjKwy7XGyYOPWLLNW3TbzugCtiteOStb6uvvEj5HVh5ngoxDb dJ5A== X-Gm-Message-State: AOAM531Akm3FP4pRxqyaGsrRpmyp3R2E9Fm9rEiM3aNPSrEzE6sAVijo j0J5fKfgywt8mT4zdqJsGYG+xVz7vAdI/g== X-Google-Smtp-Source: ABdhPJy1dEQRbcaCta/HFXx50gkCcjvZAZyxooXsH2534FKK7BLHc6FM1OmBEBss4ZYLkNVNM4Rwew== X-Received: by 2002:ac2:5dc8:: with SMTP id x8mr3634963lfq.50.1598548446878; Thu, 27 Aug 2020 10:14:06 -0700 (PDT) Received: from mail-lj1-f173.google.com (mail-lj1-f173.google.com. [209.85.208.173]) by smtp.gmail.com with ESMTPSA id b16sm598292ljk.24.2020.08.27.10.14.05 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 27 Aug 2020 10:14:06 -0700 (PDT) Received: by mail-lj1-f173.google.com with SMTP id h19so7274415ljg.13 for ; Thu, 27 Aug 2020 10:14:05 -0700 (PDT) X-Received: by 2002:a05:651c:503:: with SMTP id o3mr10986895ljp.312.1598548445374; Thu, 27 Aug 2020 10:14:05 -0700 (PDT) MIME-Version: 1.0 References: <20200827114932.3572699-1-jannh@google.com> <20200827114932.3572699-7-jannh@google.com> In-Reply-To: <20200827114932.3572699-7-jannh@google.com> From: Linus Torvalds Date: Thu, 27 Aug 2020 10:13:49 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v5 6/7] mm/gup: Take mmap_lock in get_dump_page() To: Jann Horn Cc: Andrew Morton , Christoph Hellwig , Linux Kernel Mailing List , Linux-MM , linux-fsdevel , Alexander Viro , "Eric W . Biederman" , Oleg Nesterov Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 95B43180559ED X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam04 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000181, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Thu, Aug 27, 2020 at 4:50 AM Jann Horn wrote: > > Properly take the mmap_lock before calling into the GUP code from > get_dump_page(); and play nice, allowing the GUP code to drop the mmap_lock > if it has to sleep. Hmm. Of all the patches in the series, this simple one is now the only one I feel makes for ugly code. Certainly not uglier than it used to be, but also not as pretty as it could be.. I think you're pretty much just re-implementing get_user_pages_unlocked(), aren't you? There are differences - you use mmap_read_lock_killable(), for example. But I think get_user_pages_unlocked() should too. The other difference is that you don't set FOLL_TOUCH. So it's not *exactly* the same thing, but it's close enough that I get the feeling that this should be cleaned up to use a common helper between the two. That said, I suspect that falls under the heading of "future cleanup". I don't think there's any need to re-spin this series for this, it's just the only slightly negative reaction I had for the whole series now. Linus