Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp8004664rwd; Tue, 20 Jun 2023 08:58:36 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7ildjlpRfXsq02Vv3VF1Nnn7UDlbx2e9AHuI21S3s5Gz7L6pPqjpqQFYQ/2/R4siwr7n4H X-Received: by 2002:a05:6808:2010:b0:39a:a92b:c546 with SMTP id q16-20020a056808201000b0039aa92bc546mr16476872oiw.19.1687276716406; Tue, 20 Jun 2023 08:58:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687276716; cv=none; d=google.com; s=arc-20160816; b=YQ4VAOIVZMgOdexG6LnMoorNV7uRrzzyb1XUU9H1iMo23HTs+bcwcsNgpvW28xDIjJ S6r7/atOZWHhDWRB2Lu+v4/SXymGj+mrYEFgiEB2i6YtXC8Gw/dKqK3BSwClUIul5Gx3 veBs0ZNwIHjfEivQJ+Npt1M2YI/Ef6Q6qcv525ybjiy4qhxGFCE62tVBBT4DveuIwiyW SIR+sM420lIAqz5gfIEXqM1TZ+uATxAS8JDj9+JWb0YdYG1Z6l6J/082YqvuaaqluFNJ N7xeUiPRtyNmTNcvOx4qkoAo6I3yzmwe1fcxlRDFAzATggwe7ahyMSC/OV7snN7aJScb +QSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :organization:from:references:cc:to:content-language:subject :user-agent:mime-version:date:message-id:dkim-signature; bh=eM/7jCZlXs+iYNWQPomo+m+F7tXjtLGkIbkCnuL/RPU=; b=XXLfKgWdt33nJUpjpfMW0rUghWjguL9pbKWqe8QVCt1Eh5kPMqi2P8DYX/PnHF+mv7 oRS0rlILnXPxGx6PQWx3lDNLryfydqqkVKyniJXCn9jgZGzEJa3o50VGpiQsUZqOgGP2 I14BRPoe/0vimgkwgVa+qiQrmm3UlhomxaHS7VrJHD39oo2es200p3qf03xQtutFrD1m T/J8YNwXiT/esnQM/EZpV7WKdHnngqyvuwKL5AHqlaAnI6hvR1GPqkiknPaD2+czKDSo knJwOzMxt/2eCIy9KXN6EU4SvlfySbjiCxuI9o0nycB0H3ckDf7NON6e+Wuwn1WgGMXO SxPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=L4K9jbHJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j7-20020a17090a694700b0025e9d537637si2132634pjm.158.2023.06.20.08.58.24; Tue, 20 Jun 2023 08:58:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=L4K9jbHJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233713AbjFTP3h (ORCPT + 99 others); Tue, 20 Jun 2023 11:29:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54318 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232954AbjFTP3f (ORCPT ); Tue, 20 Jun 2023 11:29:35 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 23AD299 for ; Tue, 20 Jun 2023 08:28:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687274933; 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=eM/7jCZlXs+iYNWQPomo+m+F7tXjtLGkIbkCnuL/RPU=; b=L4K9jbHJ5UAEnH8KX08xlf0vphNA8Qjog8IHraukqG98tNpy947N+/WvKMF94BbEEQOjmv K5/Q1MzDxHlWBgJQ2xRZ3wHzWDV9gRYlJL+7qln8eqhWti9hkr3HUCmfyPFiXTNG8yRNHH J9f2F2h0AGDlWEMQU8HPzQFdKH9FCmI= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-122-UV4B87QQOy6-aJKOWex83A-1; Tue, 20 Jun 2023 11:28:43 -0400 X-MC-Unique: UV4B87QQOy6-aJKOWex83A-1 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-3f7e7cfcae4so26199835e9.1 for ; Tue, 20 Jun 2023 08:28:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687274911; x=1689866911; 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=eM/7jCZlXs+iYNWQPomo+m+F7tXjtLGkIbkCnuL/RPU=; b=MM9VgcYE+JqqXZw0CoZjqsP6QUDwoVWDcQwU08B7W0nsl0alafK7m6Yqp2rjaIpaji Tb6RncZUp+R7wxwvGBcnSaf70U6gpRKbb/3o4PCgh6pZP8GMkVcPBTUZDh/YmYi8ZlYY q+ZDk9W2wcCnbqofJ6aCOG4HHnn1D76Mw5sou2vbv3I5SXIA2skMLj4YI50mfYuuSu1g QNI3z1I1/WPKqfnXgcKvgNcSuwoWRTNYJKu4bVYsJYtVqEAgNQGMHHWaosc2ZOa9G5FY st2wjmA7KEmyLksB8nTl6j2cB6u6gcAQ9ShGmIgnGmtiyJK/6Js12cb1HQ7R+OcnNcJ0 vSJg== X-Gm-Message-State: AC+VfDyWytaJ7aLVzh70DC7u0lXnQiVyRB/MLtu+ASdWpR35VQ4ha0F3 5Pu7Tp6Kb0jX3jx/XobQnTjP3BbfeRxF55H7/0mp7eFRqmdfHPwgtJ39pDSMKDNg79MVozhtSaP KN3zRlGO+QflBYmKGrNE3Cuxa X-Received: by 2002:a1c:cc19:0:b0:3f8:fac0:ad40 with SMTP id h25-20020a1ccc19000000b003f8fac0ad40mr11807596wmb.29.1687274911531; Tue, 20 Jun 2023 08:28:31 -0700 (PDT) X-Received: by 2002:a1c:cc19:0:b0:3f8:fac0:ad40 with SMTP id h25-20020a1ccc19000000b003f8fac0ad40mr11807567wmb.29.1687274911079; Tue, 20 Jun 2023 08:28:31 -0700 (PDT) Received: from [192.168.3.108] (p4ff23bc9.dip0.t-ipconnect.de. [79.242.59.201]) by smtp.gmail.com with ESMTPSA id p25-20020a05600c205900b003f9b1131a90sm2591078wmg.23.2023.06.20.08.28.29 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 20 Jun 2023 08:28:30 -0700 (PDT) Message-ID: <7cd1db3f-9bdf-dc0b-692c-380a2fa14286@redhat.com> Date: Tue, 20 Jun 2023 17:28:28 +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 v2 2/8] mm/hugetlb: Prepare hugetlb_follow_page_mask() for FOLL_PIN Content-Language: en-US To: Peter Xu , linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Andrea Arcangeli , Mike Rapoport , Matthew Wilcox , Vlastimil Babka , John Hubbard , "Kirill A . Shutemov" , James Houghton , Andrew Morton , Lorenzo Stoakes , Hugh Dickins , Mike Kravetz , Jason Gunthorpe References: <20230619231044.112894-1-peterx@redhat.com> <20230619231044.112894-3-peterx@redhat.com> From: David Hildenbrand Organization: Red Hat In-Reply-To: <20230619231044.112894-3-peterx@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 20.06.23 01:10, Peter Xu wrote: > follow_page() doesn't use FOLL_PIN, meanwhile hugetlb seems to not be the > target of FOLL_WRITE either. However add the checks. > > Namely, either the need to CoW due to missing write bit, or proper CoR on > !AnonExclusive pages over R/O pins to reject the follow page. That brings > this function closer to follow_hugetlb_page(). > > So we don't care before, and also for now. But we'll care if we switch > over slow-gup to use hugetlb_follow_page_mask(). We'll also care when to > return -EMLINK properly, as that's the gup internal api to mean "we should > do CoR". Not really needed for follow page path, though. > > When at it, switching the try_grab_page() to use WARN_ON_ONCE(), to be > clear that it just should never fail. Oh, and does this comment really belong into this patch or am I confused? -- Cheers, David / dhildenb