Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp3733451ioo; Wed, 25 May 2022 07:08:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxZobt6/E1vjgWCHiSm4hJ6JHR8e/z1S5Txr6ciBKAP5CWScruF4g2VbfVAeEEPEDvZAhUA X-Received: by 2002:a17:907:62a1:b0:6da:7952:d4d2 with SMTP id nd33-20020a17090762a100b006da7952d4d2mr29257649ejc.260.1653487701959; Wed, 25 May 2022 07:08:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653487701; cv=none; d=google.com; s=arc-20160816; b=d1lC6tZo3nfBoPFHOLFRmdB/iuqQxg6ahUjsE+XKpW/A13h9BgRwxUWlg+FSZm/uPh IOzorebrHelgvHmgqdTFo+h43vSizUyWPoucg71YtVCNYNuy4g40WFTolVKiGfjmDpnB MmxGmeh1LL0+MNDqqATtD4JJ7paLJwioPzxhzzFmm9ez4Rb/K/HlKEae94ktals9V1kY bm+ZJdvC3nPw92iwL+2ooT3XP8joGisGiqfir/qVT2wIChRb1v7x7QbL5FM6mxn4JR83 YGtBJ8BI17O35XwsgMpBH3UIAEQRvI8dImTMeVV6v1aoXxqV3DqIvQgWR5uuEPDnk9Kc aAYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=fynqLgAwzFb6vEaW0H2XVP1Fb90ut8VjSQaOivEe3wM=; b=X1j6sc9qRk3067mbBg9iyg4BhbYc92bK1mIyq1xkpH2MDXJ9cdjL1eb6D6eI1Jgmpy /h69hmHNvxu2B0lzjffEiFWPvoMekBwP9Fgv9tMrnO7d1fp19zFHaJ93JqwSkE6vaF/U 6G5Kq7h9s8KpJWRuri/glQFmfKqyFSLo3nAwWRViS0ZMGREhX26CoyqUYKBPLXqvOmdw iAQD8O1whcvWIXBdXCw55DKabsViZr/s6CmajeMWFbjrvvV35bw2N3nBRzA7nQfNa5JV dGdHWVgtY7GkxiFF5vApitn18YyALtibLS/f+Sw5U22lZrL6cr+aH/DvPxBj+K5o6Hza A86g== ARC-Authentication-Results: i=1; mx.google.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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g13-20020a170906868d00b006f385307f95si4275275ejx.649.2022.05.25.07.07.52; Wed, 25 May 2022 07:08:21 -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; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230183AbiEYIS3 (ORCPT + 99 others); Wed, 25 May 2022 04:18:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52074 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232120AbiEYISR (ORCPT ); Wed, 25 May 2022 04:18:17 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 925FB443F8 for ; Wed, 25 May 2022 01:18:16 -0700 (PDT) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4L7P7b3b4LzjX0b; Wed, 25 May 2022 16:17:31 +0800 (CST) Received: from huawei.com (10.175.124.27) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Wed, 25 May 2022 16:18:13 +0800 From: Miaohe Lin To: , , CC: , , , , , , , , , , Subject: [PATCH v3 2/4] mm/migration: remove unneeded lock page and PageMovable check Date: Wed, 25 May 2022 16:18:20 +0800 Message-ID: <20220525081822.53547-3-linmiaohe@huawei.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20220525081822.53547-1-linmiaohe@huawei.com> References: <20220525081822.53547-1-linmiaohe@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.124.27] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,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 When non-lru movable page was freed from under us, __ClearPageMovable must have been done. So we can remove unneeded lock page and PageMovable check here. Also free_pages_prepare() will clear PG_isolated for us, so we can further remove ClearPageIsolated as suggested by David. Signed-off-by: Miaohe Lin Reviewed-by: Christoph Hellwig --- mm/migrate.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/mm/migrate.c b/mm/migrate.c index e88ebb88fa6f..337336115e43 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -1090,15 +1090,10 @@ static int unmap_and_move(new_page_t get_new_page, return -ENOSYS; if (page_count(page) == 1) { - /* page was freed from under us. So we are done. */ + /* 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); - } + /* free_pages_prepare() will clear PG_isolated. */ goto out; } -- 2.23.0