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 CF061C433EF for ; Fri, 29 Apr 2022 10:07:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5323D6B0071; Fri, 29 Apr 2022 06:07:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4E1DF6B0073; Fri, 29 Apr 2022 06:07:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3D1986B0074; Fri, 29 Apr 2022 06:07:23 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.25]) by kanga.kvack.org (Postfix) with ESMTP id 2E32D6B0071 for ; Fri, 29 Apr 2022 06:07:23 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay12.hostedemail.com (Postfix) with ESMTP id E8C9E12194E for ; Fri, 29 Apr 2022 10:07:22 +0000 (UTC) X-FDA: 79409489124.05.7C0C8DD Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf25.hostedemail.com (Postfix) with ESMTP id 3E9AEA0070 for ; Fri, 29 Apr 2022 10:07:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1651226841; 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=fpr0txJA455XWxPJoeYia7uJlW7TBpvXJ9nc6LJTAiI=; b=KbPqva8OZ0s7ajkp5M+J+ZR8arD2k3LWouiDvyua/f0kZQPEp9hQM1PBFia1oVlHd1py76 1UgJKiCLwcEvlxmKdKOb4xoL4+8tmwaZ2u0A+NRaAIJoSjupXXZR3sCHiU/0ldUQ6kb6MI IoCar0ckHJfroZWaq9bgAcLy37hcx00= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-491-9M651i92PjWeTUbFLb9kyA-1; Fri, 29 Apr 2022 06:07:20 -0400 X-MC-Unique: 9M651i92PjWeTUbFLb9kyA-1 Received: by mail-wm1-f70.google.com with SMTP id n26-20020a1c721a000000b003941ea1ced7so385994wmc.7 for ; Fri, 29 Apr 2022 03:07:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent :content-language:to:cc:references:from:organization:subject :in-reply-to:content-transfer-encoding; bh=fpr0txJA455XWxPJoeYia7uJlW7TBpvXJ9nc6LJTAiI=; b=irOqzmsySIVocR+tfH4Uqi+oCGN8LTGNEQ/7FuMbM6IqbRZjH5aPH5qESKfjuM8GjN 2Bzz17YtfexlqNcEe/5q+dQtLpoSaU5028fXEPOwrprIg16n0bvqV7nPJp2N/VDAbRvi R/nOGF96ok+JFRY0ISVC9H2VCNAfcBmteN3aA3qmiKr4M7a2w2zud7uHQd41lNejVhhX pOdLhY7c35e5hGM/PbaRvqhkKPjTGH/mBV/SFCewf60LSTI1tlFDieHIKJtoUxrG7MF8 684rmhe6s/55vrkHN5D+TLCwSHjfliOIiAv0j9dqo4/x9wpgJGxq0NXcvB3tcbcSY/+g Op8w== X-Gm-Message-State: AOAM5311sCIYjbSSok1d2sG5zAlKzeBifzlqQ8cY9NoI+zNDT1KzLfc5 l9wDiRcpl6W+nVv58jBBupQlYh+3vWnijzDmkQdm3M0rqmkOnDiQ8DwL85aNBMymTkKjCmk5KMj nOaJXC9TNBUE= X-Received: by 2002:a5d:53c1:0:b0:20a:db5d:2590 with SMTP id a1-20020a5d53c1000000b0020adb5d2590mr19565970wrw.411.1651226839164; Fri, 29 Apr 2022 03:07:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw/ncLi8P4tmLVekHMk9A2dzXZx8miO5UnaC9FxNq2yFv1PruoWKbaEGVCiHLmNtNf3I6G0lg== X-Received: by 2002:a5d:53c1:0:b0:20a:db5d:2590 with SMTP id a1-20020a5d53c1000000b0020adb5d2590mr19565948wrw.411.1651226838856; Fri, 29 Apr 2022 03:07:18 -0700 (PDT) Received: from ?IPV6:2003:cb:c707:fe00:bbeb:98e6:617a:dea1? (p200300cbc707fe00bbeb98e6617adea1.dip0.t-ipconnect.de. [2003:cb:c707:fe00:bbeb:98e6:617a:dea1]) by smtp.gmail.com with ESMTPSA id o21-20020adfa115000000b0020adea2767csm2109058wro.83.2022.04.29.03.07.17 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 29 Apr 2022 03:07:18 -0700 (PDT) Message-ID: <525298ad-5e6a-2f8d-366d-4dcb7eebd093@redhat.com> Date: Fri, 29 Apr 2022 12:07:17 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.6.2 To: Miaohe Lin , akpm@linux-foundation.org, mike.kravetz@oracle.com, naoya.horiguchi@nec.com Cc: ying.huang@intel.com, hch@lst.de, dhowells@redhat.com, cl@linux.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <20220425132723.34824-1-linmiaohe@huawei.com> <20220425132723.34824-3-linmiaohe@huawei.com> From: David Hildenbrand Organization: Red Hat Subject: Re: [PATCH v2 2/4] mm/migration: remove unneeded lock page and PageMovable check In-Reply-To: <20220425132723.34824-3-linmiaohe@huawei.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 3E9AEA0070 X-Stat-Signature: 95p861aqnm6mcxp8nt765dkekze5ombc X-Rspam-User: Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=KbPqva8O; spf=none (imf25.hostedemail.com: domain of david@redhat.com has no SPF policy when checking 170.10.129.124) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-Rspamd-Server: rspam09 X-HE-Tag: 1651226833-380378 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 25.04.22 15:27, Miaohe Lin wrote: > When non-lru movable page was freed from under us, __ClearPageMovable must > have been done. Even if it's not done, ClearPageIsolated here won't hurt > as page will be freed anyway. So we can thus remove unneeded lock page and > PageMovable check here. > > Signed-off-by: Miaohe Lin > Reviewed-by: Christoph Hellwig > --- > mm/migrate.c | 8 ++------ > 1 file changed, 2 insertions(+), 6 deletions(-) > > diff --git a/mm/migrate.c b/mm/migrate.c > index b779646665fe..0fc4651b3e39 100644 > --- a/mm/migrate.c > +++ b/mm/migrate.c > @@ -1093,12 +1093,8 @@ static int unmap_and_move(new_page_t get_new_page, > /* page was freed from under us. So we are done. */ > ClearPageActive(page); > ClearPageUnevictable(page); > - if (unlikely(__PageMovable(page))) { > - lock_page(page); > - if (!PageMovable(page)) > - ClearPageIsolated(page); > - unlock_page(page); > - } > + if (unlikely(__PageMovable(page))) > + ClearPageIsolated(page); > goto out; > } Hm, that code+change raises a couple of questions. We're doing here the same as in putback_movable_pages(). So I guess the difference here is that the caller did release the reference while the page was isolated, while we don't assume the same in putback_movable_pages(). Shouldn't whoever owned the page have cleared that? IOW, is it even valid that we see a movable or isolated page here (WARN/BUG?)? At least for balloon compaction, I remember that __PageMovable() is properly cleared before freeing it via balloon_page_delete(). Also, I am not sure how reliable that page count check is here: if we'd have another speculative reference to the page, we might see "page_count(page) > 1" and not take that path, although the previous owner released the last reference. -- Thanks, David / dhildenb