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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id D87CCEB64D8 for ; Wed, 14 Jun 2023 15:17:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 682A96B0075; Wed, 14 Jun 2023 11:17:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6325D8E0002; Wed, 14 Jun 2023 11:17:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4D40F8E0001; Wed, 14 Jun 2023 11:17:23 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 399C76B0075 for ; Wed, 14 Jun 2023 11:17:23 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 0257F1A0696 for ; Wed, 14 Jun 2023 15:17:22 +0000 (UTC) X-FDA: 80901707166.11.B2A61E3 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf21.hostedemail.com (Postfix) with ESMTP id 72ED31C0011 for ; Wed, 14 Jun 2023 15:17:20 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b="eD/oy6DU"; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf21.hostedemail.com: domain of david@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=david@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1686755840; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=dJJSEeqK6QXbXzLAxpLoHNxXrX7Cx+/0FsKlU9Zst5Q=; b=jqs7Ta+ug70wf7atZINlMgqSkfyvWoHjwOxH9qgkn3aa1XG3xgaNoDQEKvFjMP/wG8NHqV zMdzSi9cj3JX4yAu2blbodLlg5Hr+rE/N6iKD5QeDkWpMNFdm6nzBv0itbXIfBgkPpguJp fYAw57FarxbC/9qjA8kR530n54rwxAU= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b="eD/oy6DU"; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf21.hostedemail.com: domain of david@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=david@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1686755840; a=rsa-sha256; cv=none; b=J5jONEPK033SSuYaMfJrUbXH+vR9une0ae7X0UBtASNdKfgPQMPb1S4CLFGZNTXbIrC1++ DuUk/4LBzprVT/r2T86J1FW4H6u5+MD4U+BTTNFoZwQYDoFLKapYmiWf1l3Xd5tTE3bnKt Oj39HHr8NxUJGDlJ1XgZofU109KEUpI= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686755839; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=dJJSEeqK6QXbXzLAxpLoHNxXrX7Cx+/0FsKlU9Zst5Q=; b=eD/oy6DUf5Hhqt/9ySqk+Pjfv5ASYRsNVtuWiLkRtvNkXhKQguIX5YwBUKHLElfFvfKVxV 84BweRUcRDOgeyNB9ciVkzt7QrM5vMoIJ341ZSrz/yR6qqdZ644yuuki8uP9fOf3FKM51P j7KzJKLjMRA617lCTjEmaFaRLEh9d44= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-94-eLyQuF7JMLSs0blqx4kaHw-1; Wed, 14 Jun 2023 11:17:17 -0400 X-MC-Unique: eLyQuF7JMLSs0blqx4kaHw-1 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-3f5ec8aac77so5194095e9.3 for ; Wed, 14 Jun 2023 08:17:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686755835; x=1689347835; h=content-transfer-encoding:in-reply-to:organization:from:references :cc:to:content-language:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=dJJSEeqK6QXbXzLAxpLoHNxXrX7Cx+/0FsKlU9Zst5Q=; b=FAnYUYBmZ23i1HpiRvmULxhSbGcq97H2fRiQkNk7CLYEiG4DvBf99pcWsMmUImVhKs Hq4N10SjXM/hK80MCMqfjOCAY3lmu12KqzjJDlN3u40T6hmDOPw9WXdruqre+jpLKBw+ OfrpOMCWl93NqPIrwhCugz8xn+K64Ng2wzYBiyQCg70aeBQAXEXAoIHaDIESviwYxs1g eDQ1iMyYXVNNSI+ERqIXgQChzdeUuqBpKvzCuwt/RXdgytB798bhg5N8z/ZYeZzkG5Mg XrWiPor4ODcZDSwfn/j9EKS5sTMHY/j6Cp38NRvlqKCmTeCULQ7D2z9yNqiuZ8c+TbOT 20Tw== X-Gm-Message-State: AC+VfDwUm/CNZNjkm0yOcpiH1essyeb0wK2mbsSgXAqYPqQFd1wP+JO9 nWtx94vMxRJWMlMOtfyB9K8cTPu41VvpaDNRQBDtScKUggWudIpDwnfzs9rQS59/BTNMMQ5+38c sLwD3Zs5ZVlA= X-Received: by 2002:a05:600c:220d:b0:3f7:e443:c5b3 with SMTP id z13-20020a05600c220d00b003f7e443c5b3mr11985655wml.21.1686755835721; Wed, 14 Jun 2023 08:17:15 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5vgbgSXDfygOhFoX+6Zhq//KxnkS8I2CfIy8ie18zUjYJRAARJd1KYOFZ7bR8rGHX9ZJUSng== X-Received: by 2002:a05:600c:220d:b0:3f7:e443:c5b3 with SMTP id z13-20020a05600c220d00b003f7e443c5b3mr11985636wml.21.1686755835391; Wed, 14 Jun 2023 08:17:15 -0700 (PDT) Received: from ?IPV6:2003:cb:c704:b200:7d03:23db:ad5:2d21? (p200300cbc704b2007d0323db0ad52d21.dip0.t-ipconnect.de. [2003:cb:c704:b200:7d03:23db:ad5:2d21]) by smtp.gmail.com with ESMTPSA id e16-20020adffc50000000b0030fbb834074sm10722810wrs.15.2023.06.14.08.17.14 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 14 Jun 2023 08:17:14 -0700 (PDT) Message-ID: Date: Wed, 14 Jun 2023 17:17:13 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 Subject: Re: [PATCH 4/7] mm/hugetlb: Prepare hugetlb_follow_page_mask() for FOLL_PIN To: Peter Xu Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, Matthew Wilcox , Andrea Arcangeli , John Hubbard , Mike Rapoport , Vlastimil Babka , "Kirill A . Shutemov" , Andrew Morton , Mike Kravetz , James Houghton , Hugh Dickins References: <20230613215346.1022773-1-peterx@redhat.com> <20230613215346.1022773-5-peterx@redhat.com> <533c32cf-9a18-1590-4d29-f076d6bd58c1@redhat.com> From: David Hildenbrand Organization: Red Hat In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 72ED31C0011 X-Stat-Signature: yahi69o4ma64dpjsfraz43z8ndct19ht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YottqipdEAioZ+EXankW4E4l2eM/mPxaLLGnxmbeatM/w5uT75Tt8/ebtRmxRuUVbhPPi9/s/OXnkmnN1Lfa8mCwwjMb21oHhhSM6DayhoxOXh+2uswo7/YJseQ/FoPgEx2psLVle53LolSUvKoujtOCeK6XV6ug7oD5q5YC/vFfx7GmftYoPpe//B1bEmOx2wvHPm11lDYOcHs3O14PsqHZgjBx58VUK2kgmKWE57hwzqbM4vqSMvIt4ep6kVgN+B/nQGH82XDnRbuYEP9UZGaeEjo1zm8jezvmlHHIg+wBYDF986WSjRzzgDi2Zqf2JtWVwycvpr5J9zCCOH3kBoE+ldOFE541aK+o5jw4KhF4W+TEzNO4mcncyqZ5JN2qizUGOBEnwYEPdSi5bJM7Ilmwi+6kIS0V/nJizubE= 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 14.06.23 17:11, Peter Xu wrote: > On Wed, Jun 14, 2023 at 04:57:37PM +0200, David Hildenbrand wrote: >> On 13.06.23 23:53, Peter Xu wrote: >>> It's coming, not yet, but soon. Loose the restriction. >>> >>> Signed-off-by: Peter Xu >>> --- >>> mm/hugetlb.c | 7 ------- >>> 1 file changed, 7 deletions(-) >>> >>> diff --git a/mm/hugetlb.c b/mm/hugetlb.c >>> index f037eaf9d819..31d8f18bc2e4 100644 >>> --- a/mm/hugetlb.c >>> +++ b/mm/hugetlb.c >>> @@ -6467,13 +6467,6 @@ struct page *hugetlb_follow_page_mask(struct vm_area_struct *vma, >>> spinlock_t *ptl; >>> pte_t *pte, entry; >>> - /* >>> - * FOLL_PIN is not supported for follow_page(). Ordinary GUP goes via >>> - * follow_hugetlb_page(). >>> - */ >>> - if (WARN_ON_ONCE(flags & FOLL_PIN)) >>> - return NULL; >>> - >>> hugetlb_vma_lock_read(vma); >>> pte = hugetlb_walk(vma, haddr, huge_page_size(h)); >>> if (!pte) >> Did you fix why the warning was placed there in the first place? (IIRC, at >> least unsharing support needs to be added, maybe more) > > Feel free to have a look at patch 2 - it should be done there, hopefully in > the right way. And IIUC it could be a bug to not do that before (besides > CoR there was also the pgtable permission checks that was missing). More > details in patch 2's commit message. Thanks, Oh, that slipped my eyes (unsharing is not really a permission check) -- and the patch description could have been more explicit about why we can now lift the restrictions. For the records: we don't use CoR terminology upstream. As suggested by John, we use "GUP-triggered unsharing". As unsharing only applies to FOLL_PIN, it doesn't quite fit into patch #2. Either move that to this patch or squash both. -- Cheers, David / dhildenb