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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5BB98C433FE for ; Tue, 10 May 2022 04:12:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236015AbiEJEQn (ORCPT ); Tue, 10 May 2022 00:16:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45084 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236067AbiEJEPs (ORCPT ); Tue, 10 May 2022 00:15:48 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A7A6AEAD38 for ; Mon, 9 May 2022 21:11:33 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 88AC261734 for ; Tue, 10 May 2022 04:11:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DBA85C385C7; Tue, 10 May 2022 04:11:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1652155892; bh=8fMTNkoBGWEPpRJdmc6TF9BJVA1YqtyAM4NdBFRzkaE=; h=Date:To:From:Subject:From; b=WsjqWogFuPlMjJf7qWlaIDDyqEK7/aW8ia5qD7+ErzaUatENw79oONdtYTxQPsnbu ft7wsJW4RDh6ETMUp9ZgWangZKJXkwF6WDvnyReEAU1SYTlDPT8nvzat5zOHCMiKmP V6GseaOWYOz1InJFOZjJqWYfiWr3DXal4iwz0P4w= Date: Mon, 09 May 2022 21:11:32 -0700 To: mm-commits@vger.kernel.org, ziy@nvidia.com, ying.huang@intel.com, songmuchun@bytedance.com, baolin.wang@linux.alibaba.com, apopple@nvidia.com, linmiaohe@huawei.com, akpm@linux-foundation.org From: Andrew Morton Subject: [merged mm-stable] mm-migration-fix-possible-do_pages_stat_array-racing-with-memory-offline.patch removed from -mm tree Message-Id: <20220510041132.DBA85C385C7@smtp.kernel.org> Precedence: bulk Reply-To: linux-kernel@vger.kernel.org List-ID: X-Mailing-List: mm-commits@vger.kernel.org The quilt patch titled Subject: mm/migration: fix possible do_pages_stat_array racing with memory offline has been removed from the -mm tree. Its filename was mm-migration-fix-possible-do_pages_stat_array-racing-with-memory-offline.patch This patch was dropped because it was merged into mm-stable ------------------------------------------------------ From: Miaohe Lin Subject: mm/migration: fix possible do_pages_stat_array racing with memory offline When follow_page peeks a page, the page could be migrated and then be offlined while it's still being used by the do_pages_stat_array(). Use FOLL_GET to hold the page refcnt to fix this potential race. Link: https://lkml.kernel.org/r/20220318111709.60311-12-linmiaohe@huawei.com Signed-off-by: Miaohe Lin Acked-by: "Huang, Ying" Reviewed-by: Muchun Song Cc: Alistair Popple Cc: Baolin Wang Cc: Zi Yan Signed-off-by: Andrew Morton --- mm/migrate.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) --- a/mm/migrate.c~mm-migration-fix-possible-do_pages_stat_array-racing-with-memory-offline +++ a/mm/migrate.c @@ -1796,13 +1796,18 @@ static void do_pages_stat_array(struct m goto set_status; /* FOLL_DUMP to ignore special (like zero) pages */ - page = follow_page(vma, addr, FOLL_DUMP); + page = follow_page(vma, addr, FOLL_GET | FOLL_DUMP); err = PTR_ERR(page); if (IS_ERR(page)) goto set_status; - err = page ? page_to_nid(page) : -ENOENT; + if (page) { + err = page_to_nid(page); + put_page(page); + } else { + err = -ENOENT; + } set_status: *status = err; _ Patches currently in -mm which might be from linmiaohe@huawei.com are mm-swapfile-unuse_pte-can-map-random-data-if-swap-read-fails.patch mm-swapfile-fix-lost-swap-bits-in-unuse_pte.patch mm-migration-reduce-the-rcu-lock-duration.patch mm-migration-remove-unneeded-lock-page-and-pagemovable-check.patch mm-migration-return-errno-when-isolate_huge_page-failed.patch mm-migration-fix-potential-pte_unmap-on-an-not-mapped-pte.patch mm-vmscan-take-min_slab_pages-into-account-when-try-to-call-shrink_node.patch mm-vmscan-add-a-comment-about-madv_free-pages-check-in-folio_check_dirty_writeback.patch mm-vmscan-introduce-helper-function-reclaim_page_list.patch mm-vmscan-take-all-base-pages-of-thp-into-account-when-race-with-speculative-reference.patch mm-vmscan-remove-obsolete-comment-in-kswapd_run.patch mm-vmscan-use-helper-folio_is_file_lru.patch mm-vmscan-use-helper-folio_is_file_lru-fix.patch mm-z3fold-fix-sheduling-while-atomic.patch mm-z3fold-fix-possible-null-pointer-dereferencing.patch mm-z3fold-remove-buggy-use-of-stale-list-for-allocation.patch mm-z3fold-throw-warning-on-failure-of-trylock_page-in-z3fold_alloc.patch revert-mm-z3foldc-allow-__gfp_highmem-in-z3fold_alloc.patch mm-z3fold-put-z3fold-page-back-into-unbuddied-list-when-reclaim-or-migration-fails.patch mm-z3fold-always-clear-page_claimed-under-z3fold-page-lock.patch mm-z3fold-fix-z3fold_reclaim_page-races-with-z3fold_free.patch mm-z3fold-fix-z3fold_page_migrate-races-with-z3fold_map.patch mm-swap-use-helper-is_swap_pte-in-swap_vma_readahead.patch mm-swap-use-helper-macro-__attr_rw.patch mm-swap-fold-__swap_info_get-into-its-sole-caller.patch mm-swap-remove-unneeded-return-value-of-free_swap_slot.patch mm-swap-print-bad-swap-offset-entry-in-get_swap_device.patch mm-swap-remove-buggy-cache-nr-check-in-refill_swap_slots_cache.patch mm-swap-remove-unneeded-p-=-null-check-in-__swap_duplicate.patch mm-swap-make-page_swapcount-and-__lru_add_drain_all.patch mm-swap-avoid-calling-swp_swap_info-when-try-to-check-swp_stable_writes.patch mm-swap-add-helper-swap_offset_available.patch mm-swap-fix-the-obsolete-comment-for-swp_type_shift.patch mm-swap-clean-up-the-comment-of-find_next_to_unuse.patch mm-swap-fix-the-comment-of-get_kernel_pages.patch mm-swap-fix-comment-about-swap-extent.patch