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 01B6AC433F5 for ; Wed, 11 May 2022 00:09:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 80F716B0071; Tue, 10 May 2022 20:09:41 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7BCC96B0072; Tue, 10 May 2022 20:09:41 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 65DE46B0073; Tue, 10 May 2022 20:09:41 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 57DB26B0071 for ; Tue, 10 May 2022 20:09:41 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 0EADF61E03 for ; Wed, 11 May 2022 00:09:41 +0000 (UTC) X-FDA: 79451528562.25.51E2923 Received: from mail-pj1-f49.google.com (mail-pj1-f49.google.com [209.85.216.49]) by imf20.hostedemail.com (Postfix) with ESMTP id 8ADA01C00AB for ; Wed, 11 May 2022 00:09:31 +0000 (UTC) Received: by mail-pj1-f49.google.com with SMTP id iq2-20020a17090afb4200b001d93cf33ae9so3341926pjb.5 for ; Tue, 10 May 2022 17:09:40 -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=n8Jm8KhbW2ksQO5jOkDNjalgPbes8iYPxld4bHIoHCoJWWMlOQRziJMoGRNZkwCGef 6BpNrFzc5UoZmINgyLdIcH4kcg1udEAGjEb6KA+5dZmje1zY7VWf4YVEGo8WlvJ9M1Iq SdrJMhe8+Xq6Ii+4+2XijcQp4qKCcC8188pNLu6GHXYcYSOrqtGXLAUaYKqeTMT4DpbR dphO5Sw8/7AuFKxjKpIvmodmoxeVPR4uFghiQy/2YtGYEBT7lcMELNlCx7GzrwFiD7Yk 8J8TBObJLXpfWBBIKa2qTmZEVOk8V8mtldRTiDtFa3EnGp/ZoM+Dg8GfCA99V6ibzB5L Ct5w== X-Gm-Message-State: AOAM533Q3MAv4jhC+C+D8KAiDA4pnU+j2M9GzfArGcJVX5DVg3zZWFKp c71OVFVMMa1+ImKdgqH/bW4= X-Google-Smtp-Source: ABdhPJxILPjt7jfDvUr8owmQ1dXgwusrKk9TlWi9cdTNTPsXAEU3YmOCoKZS0acB5FeHZGqbtVdBEQ== 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) 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: Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=mmb751A5; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=kernel.org (policy=none); spf=pass (imf20.hostedemail.com: domain of minchan.kim@gmail.com designates 209.85.216.49 as permitted sender) smtp.mailfrom=minchan.kim@gmail.com X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 8ADA01C00AB X-Rspam-User: X-Stat-Signature: yba7ogpeu6apakiwp639nrrbk3zak7oa X-HE-Tag: 1652227771-692797 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 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/