Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp6676992iob; Wed, 11 May 2022 02:57:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzV6fAQ0QdEHONuEIGb49Scjpu3pSW+sr0WbLSPBetvqRPrsEoRSeIu7sHllTq0micnpM6K X-Received: by 2002:a17:90b:4f47:b0:1dc:c4c9:cdee with SMTP id pj7-20020a17090b4f4700b001dcc4c9cdeemr4586435pjb.0.1652263078071; Wed, 11 May 2022 02:57:58 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1652263078; cv=pass; d=google.com; s=arc-20160816; b=PMX3afEXFezXrJ9qZBuvwKUui/IADrGloEUyoyZGarR3kDa8dVv+jtolrnjtcYkj8R Cw79XVrADN49I+1uUqElX7vBEW157NaCrZzBUtMepSB8QCFUAChOzrFbrghIKD0gCI8u ROlr6j54wwZ908L5k7m7TZ29SryVX1Mpr7GYMyUg0ghukcrmIJGgVw980VXbROEHss4o WQqYZ2CiVrERJLN94VmAlvqNfZJze+xu8rIfO5vvMNFU7a9S8bwMnzo07Hd2e4n/mKLx J4K+kkqRnx3c+K7P9bphzmxCF8UtiexGvRtvC1oK0wGvnfpSiIor25X8f4qIfv1VO2H3 1bdg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :in-reply-to:from:references:cc:to:content-language:subject :user-agent:date:message-id:dkim-signature; bh=tVOyizssLsyFxzqqu0cqDIZlYhFmV2667/U9pwLg4Lk=; b=UkI68yJD3n63eIY7UTgUH9+mVuO2cFxM5qdagBY36XxvdplqYA+D8pyE6HI/r2FQBH OjHg9yf+Uk2AvG/O+N7t73hvhulOE8qT3cpSWkeE1b4kzfrGHqgdo78JdmhcRtS4x/Ly FQxBYJaQChEm0erHAMSai71nCXPTH5SHxdatuadCrl+8gAaIMUTopVdhyC8mP+2xnVXR xt6SB3aos8ps5dC26BNVAiyNfZTY0TRcEeyppTXEXghysaIhZ72v71xOOFatRNTaSPAv f//I75ZXatw6W8bDO5BlYAJ9zdacB9xrWTKxT/Npw/XVlUxXSxKhVdN9GO6MJuS8GdH5 3VMg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=nh4qcMTI; arc=pass (i=1 spf=pass spfdomain=nvidia.com dkim=pass dkdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); 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=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m28-20020a634c5c000000b003c65dfad4afsi2340061pgl.367.2022.05.11.02.57.46; Wed, 11 May 2022 02:57:58 -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=@Nvidia.com header.s=selector2 header.b=nh4qcMTI; arc=pass (i=1 spf=pass spfdomain=nvidia.com dkim=pass dkdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); 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=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238942AbiEJX7R (ORCPT + 99 others); Tue, 10 May 2022 19:59:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45548 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239062AbiEJX7A (ORCPT ); Tue, 10 May 2022 19:59:00 -0400 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2068.outbound.protection.outlook.com [40.107.220.68]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CD665223862 for ; Tue, 10 May 2022 16:58:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=O67/u7phd5gMPEb1FDPnQMYU2b2oCuAsfh+Ml8Fh4VIXHR1oI92Zw9wg8A9oCmB57Iej628SPFK0ojPmEKmkvVFLaC11006feVZ+bgPln+V+JVzYPllQodhnwOo69VqunGlD8nkkBpqzS87rFWG60uPsB1zo6b97QeXKy8pB+wJWwppyhprhE7+OXTYYLg4iXNLWqkyJ/k4EdxEtHrQ4kxuRKE2uatDtX7FRewOVAwsLMg8PxZfnja/FHLC8hMX053KnsbLJQ9OWw14o4duJ0I4eixTlUQ2QIJiBMlqp12qaHyJfOvndInBAqnkIPy9L4Dl+B1ssE/NdhANiBTsvUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=tVOyizssLsyFxzqqu0cqDIZlYhFmV2667/U9pwLg4Lk=; b=jHfSm6cjsejsIQvNfaOHbMCt2x+RYJJgFN4gI8FvGCuhBDFTxnwNAe1DaOc5d3yQYiAc77SqsI/srorgkAvhybpD0pwaW+uuVdPKRfWSImAC4r/kdHqlUEig3fBeBF9pGEzqtL/1OAD9/WdYVy0LTa1/MJKJsRE1Afz/WklpVIEKIku9443V0XlGx55Oib39RzvyCjEFtoX8g86zi4l/HPsiWiA8fMqqMku2u+1mD/UeKcglrYJgaumvraMWCDEh3wL3bsaoYMNmQPFdxPjsPm/3KB2aja4jhn7JwA8jjS29q0BajfDZPjALA1mk/EfKsLWpm5w770O+icL70WKYyw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tVOyizssLsyFxzqqu0cqDIZlYhFmV2667/U9pwLg4Lk=; b=nh4qcMTInGBwPjWXRCcQBCHEny7AQP9k0aG/zbzWA9UdWGBqQS72rgH7jHBwPyg9COMq9PMs6zTEgcprtkm9r68auBZsnngj5HGDgQt5f3MOahtLZIQQiIcv/DsZQg1ThRT687F+PB6MsgA4o1AyPYl7yP6OkRmi1NMlVG0Fm22U0ESpCquCtScJ9hlVwQXUBIjrPtQbOFjZIt2vmkwJAzc4hDaGJ5YChk9F+axTUtQqWcqLDeOuLH/JhU0b9/pj2Bv5QSSdVUQ93V0954Fo3eVPhm1ClTaFi7nGV2iV6c1dhfmiOHoiqfKw6AcTes3GuPnBdl0HtVK+XwqGnfCcRQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from BY5PR12MB4130.namprd12.prod.outlook.com (2603:10b6:a03:20b::16) by IA1PR12MB6114.namprd12.prod.outlook.com (2603:10b6:208:3ea::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5227.23; Tue, 10 May 2022 23:58:15 +0000 Received: from BY5PR12MB4130.namprd12.prod.outlook.com ([fe80::15e3:d746:57e8:4de0]) by BY5PR12MB4130.namprd12.prod.outlook.com ([fe80::15e3:d746:57e8:4de0%7]) with mapi id 15.20.5227.023; Tue, 10 May 2022 23:58:15 +0000 Message-ID: Date: Tue, 10 May 2022 16:58:13 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 Subject: Re: [PATCH v4] mm: fix is_pinnable_page against on cma page Content-Language: en-US To: Minchan Kim Cc: Andrew Morton , linux-mm , LKML , "Paul E . McKenney" , John Dias , David Hildenbrand References: <20220510211743.95831-1-minchan@kernel.org> <857d21da-5de2-fa3e-b1ce-41cc1cfb0191@nvidia.com> From: John Hubbard In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: SJ0PR13CA0033.namprd13.prod.outlook.com (2603:10b6:a03:2c2::8) To BY5PR12MB4130.namprd12.prod.outlook.com (2603:10b6:a03:20b::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 54ea1d2e-e3a1-43c9-ff45-08da32e0f2fd X-MS-TrafficTypeDiagnostic: IA1PR12MB6114:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: pp4YhLoweVnem4j7TkWeul3TetDLWJZvBYZlUZaMHIUibuFFosvenyvqgaulIqgR0YZUcpjf+kTtbbxvKp5X8M4r2fPlWgHJzqOPrbJK1AIGyQjDl0ME49RlT/BOusJkYLrikZ5JDXt8vICmH5Ee2QKCqFbY7PYpo1RmwYVFG5F4UUsGsm9HzIGs9pKuItxJaUygfAxeggee64FEiw256ZqfFsXmI3zOIOqU4fu3CH0cACkd8RL0B1+ckA8HhKAQANBL4CCiKH+pjulvWXe2F6jIdqiIJ0o8NlVmziKTJyP+TXxUfLXmOyAph+TAxxRmfYuXX+/f8n/5vetsdQPmMuFI1bB7piWZCv9wJ4wKnYB2U/GWa/WkYG2wY9NnmLXNToqIsDnN+zI7m2OaE1KhfpuQPb4L9SSBgkWbxZTJ2fnG0PPtJ6S/pzN3NaQdXdav/dnSRpGEBmKhXGwOu4qGHxPrAsMMxtppNA+CuRXYtsZo5oCpbC3hC1nhYzrwE6oa7NfJi7J2aERjF2f9JWM8xkzjZgV4D6kGo9R58lRDpTVK/k+uLGzAsEvpqVPi7ASUfRT0Iud3a8gmoNYQWQvLIFs2j5BlHiqvccOM3nImuDhvsxI+Yy1s9XfLBwal1bnsQwIscpb07z5UxhLyRipinCKQ02EQfzfwiJ4d6DmO+vp/hxtlmQNULIY10xbFxG+Mt+g6GCHpoSzzbwQCLncyMweKNwyHv51J4q3Sj8BWimqcEfqro0m49GC80Yi2toby X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BY5PR12MB4130.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(6512007)(26005)(2616005)(186003)(66946007)(31686004)(8936002)(66556008)(4326008)(66476007)(8676002)(36756003)(5660300002)(316002)(54906003)(2906002)(6916009)(508600001)(38100700002)(6506007)(6486002)(31696002)(53546011)(86362001)(83380400001)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?OXJzWTQyRVJDNm1hOVVYUDR4K09zNHNJVTJLdjhOcUhYZW03NGlmajNZbDgw?= =?utf-8?B?ZmZVODB3RGVBY2ZaYlI3V1RIZysvendRSDdIQzl1eFo0cGlCY0RSQjIwRnBn?= =?utf-8?B?RU1rSEFxdkZybEVBSzJTZzJPNlpTaU9wRExYdDRaekpXdjc2eWVReXRHSlg0?= =?utf-8?B?U3VnYzhpUkl0STlzeFd4Sm1PeWZUcEh5enRaRitYaE1EK0Z5bUpZUTk1U1VX?= =?utf-8?B?MFdHRDB3VEpQek1hOURleHZJYmVadGdzNlJjUmFWc0pzaWRNd0RSZTEydTFp?= =?utf-8?B?S2t0UFFVWEhNUlAzSWlUNm9IRnFPd3lmbzlPTkNZUzB2RGJUMy81SkQwV1F3?= =?utf-8?B?bGhjQ3VQQ0tjV0FFakpiNmFYNEI0ZDZtT1FaMlI2UXR1TmdIZGZvck9qRkFJ?= =?utf-8?B?eUMvZ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c1ppbXZrZlhr?= =?utf-8?B?R2M0emxmSlUrV3ZzTGh3QW5lTHRCak1FMGE2T1dyR0lUVWhFUUFzYmFlc2Qz?= =?utf-8?B?R3JUbTJ0T0FwWUw4N2NTZHNiNFBuY0FVM1I4aEZxNTFBeS9nUVNiV1NmLzNG?= =?utf-8?Q?1gl6GqNNGZerbLIQ=3D?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 54ea1d2e-e3a1-43c9-ff45-08da32e0f2fd X-MS-Exchange-CrossTenant-AuthSource: BY5PR12MB4130.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 May 2022 23:58:15.8235 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: HR8IyqTJeSkqX7IOlLuFht/DtYn61Ilni9UCSHtRjq8KpVBgwOIrZtUVEIKiwuPMPp9ChNnpEei8145/gZqWuw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB6114 X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, NICE_REPLY_A,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 5/10/22 4:31 PM, Minchan Kim wrote: >>> + int __mt = get_pageblock_migratetype(page); >>> + int mt = __READ_ONCE(__mt); >> >> Although I saw the email discussion about this in v2, that discussion >> didn't go far enough. It started with "don't use volatile", and went >> on to "try __READ_ONCE() instead", but it should have continued on >> to "you don't need this at all". > > That's really what I want to hear from experts so wanted to learn > "Why". How could we prevent refetching of the mt if we don't use > __READ_ONCE or volatile there? > >> >> Because you don't. There is nothing you are racing with, and adding >> __READ_ONCE() in order to avoid a completely not-going-to-happen >> compiler re-invocation of a significant code block is just very wrong. >> >> So let's just let it go entirely. :) > > Yeah, once it's clear for everyone, I am happy to remove the > unnecessary lines. > >> >>> + >>> + if (mt == MIGRATE_CMA || mt == MIGRATE_ISOLATE) >> With or without __READ_ONCE() or volatile or anything else, this code will do what you want. Which is: loosely check for either of the above. What functional problem do you think you are preventing with __READ_ONCE()? Because I don't see one. thanks, -- John Hubbard NVIDIA