]> git.baikalelectronics.ru Git - kernel.git/commitdiff
mm/migration: remove unneeded lock page and PageMovable check
authorMiaohe Lin <linmiaohe@huawei.com>
Mon, 30 May 2022 11:30:14 +0000 (19:30 +0800)
committerakpm <akpm@linux-foundation.org>
Mon, 4 Jul 2022 01:08:37 +0000 (18:08 -0700)
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.

Link: https://lkml.kernel.org/r/20220530113016.16663-3-linmiaohe@huawei.com
Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Oscar Salvador <osalvador@suse.de>
Reviewed-by: David Hildenbrand <david@redhat.com>
Cc: Alistair Popple <apopple@nvidia.com>
Cc: Christoph Lameter <cl@linux.com>
Cc: David Howells <dhowells@redhat.com>
Cc: Huang Ying <ying.huang@intel.com>
Cc: kernel test robot <lkp@intel.com>
Cc: Mike Kravetz <mike.kravetz@oracle.com>
Cc: Muchun Song <songmuchun@bytedance.com>
Cc: Peter Xu <peterx@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/migrate.c

index 6c1ea61f39d8041046db29e20a06763e68b3d93a..c83b3ae2e285581e5699ca5ee07aaa491174a34f 100644 (file)
@@ -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;
        }