Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp151334iob; Wed, 11 May 2022 11:20:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw2zsy2S06+tjt3Zdzl5RwubfSsyW3YtShr1ES+xKGkWgeyCJZcFbcZhUnJ9eVy3snETLiH X-Received: by 2002:a63:88c8:0:b0:3ab:1871:13b4 with SMTP id l191-20020a6388c8000000b003ab187113b4mr22062787pgd.85.1652293230513; Wed, 11 May 2022 11:20:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652293230; cv=none; d=google.com; s=arc-20160816; b=Vctd2LkmRAdEuuycOw0MhNnVAPAM+0xpm2T2SL6H/m7m2o2TvnaAaSFPajvhMeRD2v Om7hOzks3aUwHDDFv+3DbFBo2tSk3Hy9u8yuTj7+D4hmZQ/UcTOj8NOrOm2dQtAr1WeT DgBqvJ6aDUhL1NvUWfncHpqZQFsLeVuHOWZQFs1PDYD9Oip2g3/FLQu48zcysOfsXzjL bvTGKsdwhM/K+SXQehoNB+h58LeDI11a57OXwWgBIpnKt/WMvzgTLv5oAmirJE2DaNOk IKyEz0JAvOyRU2MZAWPoQWkzEWfgpJIfz0dl3AtiVlVaUJXHyLcydKMWV3IaJGthvoR4 b7Bg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:sender:dkim-signature; bh=x2IZWRoSQpbPZs9WYJFMgYc9zvICPs6yFR+KKARA32k=; b=N2yBFcveZRxXZoksILIiW6B8d0ubJpZ3ZJLR/HpeyUr5AMzmCq5GofyDL0bImEjw6o loRGeMJKaRZ9jBbO8ra2XV0+S2SQFhRCQaoHPnoD7r4qxE0fgyLQP+nokWpleRn5Ji4n Ycbz9nltHJ/IgDyHbKTJNyqV/xifMBkfvnmd5CPKUeFaKGtiuJVLvTGeapL3fFRaik/q 5BQLKnTQRwgkgL3y6vF1A931Qsgbe3GHbaTWl6fNj3dZUWZFSXHj6/l7OsG7YnvWYD6g 1cnWFwMfaKCLfJJ5tsLTbJpAzAoy8/G3gV3hjs4yYPVSaK1pClfbHYT28tsq7M2gD6u/ /gvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=mmb751A5; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z11-20020a170903018b00b0015e91bd566esi3978374plg.27.2022.05.11.11.20.13; Wed, 11 May 2022 11:20:30 -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=@gmail.com header.s=20210112 header.b=mmb751A5; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239451AbiEKAKk (ORCPT + 99 others); Tue, 10 May 2022 20:10:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41822 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239820AbiEKAK1 (ORCPT ); Tue, 10 May 2022 20:10:27 -0400 Received: from mail-pl1-x634.google.com (mail-pl1-x634.google.com [IPv6:2607:f8b0:4864:20::634]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED69828B6AD for ; Tue, 10 May 2022 17:09:39 -0700 (PDT) Received: by mail-pl1-x634.google.com with SMTP id n8so314478plh.1 for ; Tue, 10 May 2022 17:09:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=x2IZWRoSQpbPZs9WYJFMgYc9zvICPs6yFR+KKARA32k=; b=mmb751A54mxke2IDtPA5QF+uged9XW0C8/3BSKkc06wfNBGuTfN+qMsJ5HfQtAxy4Z cgL/MUpigI4Sg17QFqLzMtcpW1bKXJrfTh/3RGdddieQF8JKePmkkQwtxB0NfMt7tIXp D9D84CTyuWcx9FOsVb/loqcsibICdTij/kwNy5FyLnnrC6cbPp62nzG1dqelyiGedyap xXh+kQgql65cOLHB2gdbSCqEUYJnVrS05vL4irvkU/LWT8Rzr1E17qPCBED8fOgWd/bt 1YYDQ0MMAEajYWXbkPN5gfiXCL4DUXFjrAtBXUx6j2QtaEig73IQlRzPh7FwXuLR1wvf Ivvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to; bh=x2IZWRoSQpbPZs9WYJFMgYc9zvICPs6yFR+KKARA32k=; b=x3irTVKktSkDQdzAnQhGRDgH3oGKgcGCu/dzVonr2osw6T/zX2IMDuHEIo6wGJ2SuA YWo7EJiPbEMCEYWzaKbETTM+WxaSsP4HUx7QaLR5KE7+ivfrBxuurULiK346myREysFr TLq5Iq88oG9HO4Gz3ZQvNfxJ3HCJ5SW9BrO+v0rbYQXnJj592a7lchSW8V+9aakDOHA6 RgmEzgcBC0z4BJSkuUPqLsNJGWbeu/UEAG+WgSdB/4OpgT/Z3xzZBuynRYw7otH3SpKB FQF6b0ATbgamBchP1CIbfLIDdGW5mXVA/VVHJvndYxrB4l48c3Db7AVyb9c6GxNhrjVA ylew== X-Gm-Message-State: AOAM5337LXvl+cMZC3keby2Mm3vrI5O3zR64uGWuRod5k63/3NK2+Mx+ sjUt6p2abON8AqWX2ZmXwpzHbPAs8ho= X-Received: by 2002:a17:90b:4d11:b0:1dc:ec4f:a19c with SMTP id mw17-20020a17090b4d1100b001dcec4fa19cmr2356348pjb.117.1652227779366; Tue, 10 May 2022 17:09:39 -0700 (PDT) Received: from google.com ([2620:15c:211:201:c98a:65b0:edca:b69a]) by smtp.gmail.com with ESMTPSA id p14-20020a170902b08e00b0015e8da1fb07sm208277plr.127.2022.05.10.17.09.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 May 2022 17:09:38 -0700 (PDT) Sender: Minchan Kim Date: Tue, 10 May 2022 17:09:37 -0700 From: Minchan Kim To: John Hubbard Cc: Andrew Morton , linux-mm , LKML , "Paul E . McKenney" , John Dias , David Hildenbrand Subject: Re: [PATCH v4] mm: fix is_pinnable_page against on cma page Message-ID: References: <20220510211743.95831-1-minchan@kernel.org> <857d21da-5de2-fa3e-b1ce-41cc1cfb0191@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no 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 Tue, May 10, 2022 at 04:58:13PM -0700, John Hubbard wrote: > 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. I discussed the issue at v1 so please take a look. https://lore.kernel.org/all/YnFvmc+eMoXvLCWf@google.com/