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 B7896C433EF for ; Mon, 7 Mar 2022 23:45:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241914AbiCGXqH (ORCPT ); Mon, 7 Mar 2022 18:46:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52694 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234760AbiCGXqG (ORCPT ); Mon, 7 Mar 2022 18:46:06 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3835A2A2 for ; Mon, 7 Mar 2022 15:45:10 -0800 (PST) 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 F2A4D61186 for ; Mon, 7 Mar 2022 23:45:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4EFF3C340E9; Mon, 7 Mar 2022 23:45:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1646696709; bh=WVxIYl78Hpytks9F9N5GfEpgdhIth9RK221+f4HiDPw=; h=Date:To:From:Subject:From; b=18PaYQJSOxnUA4lKtzRYbMavkmjO6iOmnrMeJeDSnoW1sQ/iEJ73hn2NGqvIu+aXk dRYre7GiLZtMByr4KbG5KHvoFhYUZFGSeS/Rzezvbpa+1WV+idxx9vM8Ejj9rfIkjJ xbhhFqzfNbd62478BAWL94w0PBOMWaRSscTlDdFM= Date: Mon, 07 Mar 2022 15:45:08 -0800 To: mm-commits@vger.kernel.org, zhangliang5@huawei.com, willy@infradead.org, vbabka@suse.cz, shy828301@gmail.com, shakeelb@google.com, rppt@linux.ibm.com, roman.gushchin@linux.dev, rientjes@google.com, riel@surriel.com, peterx@redhat.com, oleg@redhat.com, nadav.amit@gmail.com, mike.kravetz@oracle.com, mhocko@kernel.org, kirill.shutemov@linux.intel.com, jhubbard@nvidia.com, jgg@nvidia.com, jannh@google.com, jack@suse.cz, hughd@google.com, hch@lst.de, ddutile@redhat.com, aarcange@redhat.com, david@redhat.com, akpm@linux-foundation.org From: Andrew Morton Subject: + mm-huge_memory-remove-stale-locking-logic-from-__split_huge_pmd.patch added to -mm tree Message-Id: <20220307234509.4EFF3C340E9@smtp.kernel.org> Precedence: bulk Reply-To: linux-kernel@vger.kernel.org List-ID: X-Mailing-List: mm-commits@vger.kernel.org The patch titled Subject: mm/huge_memory: remove stale locking logic from __split_huge_pmd() has been added to the -mm tree. Its filename is mm-huge_memory-remove-stale-locking-logic-from-__split_huge_pmd.patch This patch should soon appear at https://ozlabs.org/~akpm/mmots/broken-out/mm-huge_memory-remove-stale-locking-logic-from-__split_huge_pmd.patch and later at https://ozlabs.org/~akpm/mmotm/broken-out/mm-huge_memory-remove-stale-locking-logic-from-__split_huge_pmd.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: David Hildenbrand Subject: mm/huge_memory: remove stale locking logic from __split_huge_pmd() Let's remove the stale logic that was required for reuse_swap_page(). Link: https://lkml.kernel.org/r/20220131162940.210846-10-david@redhat.com Signed-off-by: David Hildenbrand Cc: Andrea Arcangeli Cc: Christoph Hellwig Cc: David Rientjes Cc: Don Dutile Cc: Hugh Dickins Cc: Jan Kara Cc: Jann Horn Cc: Jason Gunthorpe Cc: John Hubbard Cc: Kirill A. Shutemov Cc: Liang Zhang Cc: Matthew Wilcox (Oracle) Cc: Michal Hocko Cc: Mike Kravetz Cc: Mike Rapoport Cc: Nadav Amit Cc: Oleg Nesterov Cc: Peter Xu Cc: Rik van Riel Cc: Roman Gushchin Cc: Shakeel Butt Cc: Vlastimil Babka Cc: Yang Shi Signed-off-by: Andrew Morton --- mm/huge_memory.c | 32 +------------------------------- 1 file changed, 1 insertion(+), 31 deletions(-) --- a/mm/huge_memory.c~mm-huge_memory-remove-stale-locking-logic-from-__split_huge_pmd +++ a/mm/huge_memory.c @@ -2133,8 +2133,6 @@ void __split_huge_pmd(struct vm_area_str { spinlock_t *ptl; struct mmu_notifier_range range; - bool do_unlock_folio = false; - pmd_t _pmd; mmu_notifier_range_init(&range, MMU_NOTIFY_CLEAR, 0, vma, vma->vm_mm, address & HPAGE_PMD_MASK, @@ -2153,42 +2151,14 @@ void __split_huge_pmd(struct vm_area_str goto out; } -repeat: if (pmd_trans_huge(*pmd)) { - if (!folio) { + if (!folio) folio = page_folio(pmd_page(*pmd)); - /* - * An anonymous page must be locked, to ensure that a - * concurrent reuse_swap_page() sees stable mapcount; - * but reuse_swap_page() is not used on shmem or file, - * and page lock must not be taken when zap_pmd_range() - * calls __split_huge_pmd() while i_mmap_lock is held. - */ - if (folio_test_anon(folio)) { - if (unlikely(!folio_trylock(folio))) { - folio_get(folio); - _pmd = *pmd; - spin_unlock(ptl); - folio_lock(folio); - spin_lock(ptl); - if (unlikely(!pmd_same(*pmd, _pmd))) { - folio_unlock(folio); - folio_put(folio); - folio = NULL; - goto repeat; - } - folio_put(folio); - } - do_unlock_folio = true; - } - } } else if (!(pmd_devmap(*pmd) || is_pmd_migration_entry(*pmd))) goto out; __split_huge_pmd_locked(vma, pmd, range.start, freeze); out: spin_unlock(ptl); - if (do_unlock_folio) - folio_unlock(folio); /* * No need to double call mmu_notifier->invalidate_range() callback. * They are 3 cases to consider inside __split_huge_pmd_locked(): _ Patches currently in -mm which might be from david@redhat.com are cma-factor-out-minimum-alignment-requirement.patch mm-enforce-pageblock_order-max_order.patch drivers-base-memory-add-memory-block-to-memory-group-after-registration-succeeded.patch drivers-base-node-consolidate-node-device-subsystem-initialization-in-node_dev_init.patch drivers-base-node-rename-link_mem_sections-to-register_memory_block_under_node.patch drivers-base-memory-determine-and-store-zone-for-single-zone-memory-blocks.patch drivers-base-memory-clarify-adding-and-removing-of-memory-blocks.patch proc-vmcore-fix-possible-deadlock-on-concurrent-mmap-and-read.patch mm-optimize-do_wp_page-for-exclusive-pages-in-the-swapcache.patch mm-optimize-do_wp_page-for-fresh-pages-in-local-lru-pagevecs.patch mm-slightly-clarify-ksm-logic-in-do_swap_page.patch mm-streamline-cow-logic-in-do_swap_page.patch mm-huge_memory-streamline-cow-logic-in-do_huge_pmd_wp_page.patch mm-khugepaged-remove-reuse_swap_page-usage.patch mm-swapfile-remove-stale-reuse_swap_page.patch mm-huge_memory-remove-stale-page_trans_huge_mapcount.patch mm-huge_memory-remove-stale-locking-logic-from-__split_huge_pmd.patch