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 lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0B287C87FDB for ; Mon, 11 Aug 2025 11:26:46 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [127.0.0.1]) by lists.ozlabs.org (Postfix) with ESMTP id 4c0sm41PTNz3cfW; Mon, 11 Aug 2025 21:26:44 +1000 (AEST) Authentication-Results: lists.ozlabs.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1754911604; cv=none; b=MYnevGZX23D27zUc8S+dEDkeZgatue07viNt0UxkdHvAFPyQURH1x1+L1SRGzdrpf9uT5L5eMJQu2iVLEarsWe77536Ez00NYxFpQ893ljKJw5CdlgTCtJ1pzVAg/UHX9N0oBbjLnw40selcxyHJmm4PjcLnjeq8/0X9pWWXEJdlwrbAIbdk7m4GCBfmXLczEM4qK0RWYrdhJEbUPqHGu+dp9ZI64x+Qzd0cn5iBTOwvo9jkKnH7Cl0DiIWKfGFGH04VOJP8/mjOiCAcMDjjiJKMOEFc3zwBhQNgVOeIYN8tU30YIzUkYbB+CvnRVPTzjJSEUdET6+ieGnAK/28x/A== ARC-Message-Signature: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1754911604; c=relaxed/relaxed; bh=gjYKWewbFPIH0RV/ky7WxO7hTalH23xVuPMUQKkA/fk=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:content-type; b=QoMHxLdhN12vLyQUTQyd3bXpWOGlcYir4c6NLTEz38NyuGFhUkYAOH/CR1rTOap58aiQReNoYcrWgAYnq0bQPCdN0m9/JHwudY+FRBNR7TJC2lDbWNWpvLlMs1g16pKHxReS47G2Ubw/Ud10EtKygngYiezZHBJO/uUg48zCEmndOTGOAkmj0Jg1hWPd4NXtnwNRYcqeM34zE8VH/wjnjnzEYOg9MFUilprXwOaUwJtc7s/+vjwbw+jpoN1mLeodoHwtwihXlmvZC4TLHzz6QlqhBwqNUH0UVecdTWu7L9k7INK9Pw15hthJu+Pa/0DT3+gS/K60rdyHJBntbPS5HQ== ARC-Authentication-Results: i=1; lists.ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=b9N4yw0q; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=PEwCTQx7; dkim-atps=neutral; spf=pass (client-ip=170.10.129.124; helo=us-smtp-delivery-124.mimecast.com; envelope-from=dhildenb@redhat.com; receiver=lists.ozlabs.org) smtp.mailfrom=redhat.com Authentication-Results: lists.ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=b9N4yw0q; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=PEwCTQx7; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=redhat.com (client-ip=170.10.129.124; helo=us-smtp-delivery-124.mimecast.com; envelope-from=dhildenb@redhat.com; receiver=lists.ozlabs.org) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4c0sm2687kz3ccf for ; Mon, 11 Aug 2025 21:26:40 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1754911597; 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; bh=gjYKWewbFPIH0RV/ky7WxO7hTalH23xVuPMUQKkA/fk=; b=b9N4yw0qMi0C8VmE0T8CzhuELAtoRudiBaBzoe2QxuU0jGyQZeVcsguuEgSKWiNTzYZlmD Qqbex8QzN7gqvjsJMa1MbWNJJr0hHw1MEWUxVgVlR8Fn/+nFpClSj6NhO3CuAgGkWx+0UA FR0tB7Bn/9Vw2hKooJuAhpDPIVgwpUo= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1754911598; 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; bh=gjYKWewbFPIH0RV/ky7WxO7hTalH23xVuPMUQKkA/fk=; b=PEwCTQx7hyfWgz4eVMC/7rABj6YjnEgWXjEDKMSf5uRO97ZlfruCNWa+YNoURQYPvX5Jcf XxPR7yLKCYYZVjAWRTqGpHKqBWaOI1Q7c6ZRMvyl8hotQY9xroa0glc8VL/AzrHVSWNqEV UOjW3d+oFHWzvWdfk9nr3RfbYAsFfbQ= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-259-KaOieIcyP7O3YEzWaPEbqQ-1; Mon, 11 Aug 2025 07:26:36 -0400 X-MC-Unique: KaOieIcyP7O3YEzWaPEbqQ-1 X-Mimecast-MFC-AGG-ID: KaOieIcyP7O3YEzWaPEbqQ_1754911595 Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-3b78aa2a113so2046508f8f.2 for ; Mon, 11 Aug 2025 04:26:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1754911595; x=1755516395; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=gjYKWewbFPIH0RV/ky7WxO7hTalH23xVuPMUQKkA/fk=; b=S/Km17hFfOCTQ5m+cOajs0Teq7C6RJf9Jvh3dp1SiVLV0QHwnKJV5b466yg3DHXbVf +uLQblNc2EsCMKB9DHN7TR3vY98agtS8v395aA/IkJeVKQyRsJaYLUIKgQwzLmN+MPN6 rAuf36d/TFgXRduJdpZeeoOtX02XRy157RWbncYOmLERJ1zgmLyzwuHd9QbWilM6IdpY XYufWcGZMkF8bru/NQWlCmeqNwzULHGT/3RbQa2k2HFp7IaXlj79XHOsIIakdeS+xl0O TThdxiHIVHt0jrsuWkdCxWImxBZ0vNmGUAWzyj0PdJjqi5z3+GYZjkKV/VH+bTzC1iwm RKaQ== X-Forwarded-Encrypted: i=1; AJvYcCUs/iofkU/UgrsEHILcpN+o+ptZvgQXtH3ZSCfh3oFEqldXJ8Jt6v3ex9YHSlZJGW2za1iInv8X4L+//N0=@lists.ozlabs.org X-Gm-Message-State: AOJu0YwnGmR/3QLgUB3mT3EAB1tLDfN9ZV5K1eQ3935lU4rjtq/zvO9V gqKabQq5jXwbaGGPigfjYrxT/VyKkBN5TBMQHJYOhwUKwkPGHmNpPjV2lK0B5NoJzKij2l1qOfI AyVdQGmh6hy+UdEUgkuQDoPOx/G5lVCyoCcVeaoe22mj7gpkrXfxTLsisRSyeN8Snb1U= X-Gm-Gg: ASbGncugie4k9W8robRZkF2r8BhsyJPBbpNC7CeHw4fzU0MH6gXHDzjBCqFefttPPCm 1yTS/NK0LKzkDggwrUjw6RaeZqNt7b+lpTbN1hD44uUGFIsJDStCiMbArhujxw6+R8rWlDKw43w ycRt/P+rTp39SS/3t3EySUHJfbyt2g8evsNexkO/ByCIjnTKeMhOXhT3jjDCnEU1xXC0/nauxhH YN682BFFNmwFebKbMSEY2zEp4LCwmZ7IJQVe0FELxgrEPer5mPmrvMT7YiWYE6z2ZR8DlMRNb6s UWM6FURuoYPu2jyvYgSGNsVxahsfvwzbTvvfmH8P0y0guN9SJIg/WHLiI5gOexAniwCTntuso43 e+0/f7pEEVyOWgWtBLkXf3sPB X-Received: by 2002:a05:6000:2f85:b0:3b7:8d70:e0ad with SMTP id ffacd0b85a97d-3b900b4d8c1mr8490186f8f.32.1754911594910; Mon, 11 Aug 2025 04:26:34 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHdQyxmL2k0hEit4q6ggWaLK63vDyy/XYp/bptTEvLLiDZ4Kssrq6afY7SHtzCWpxX9HX5tXQ== X-Received: by 2002:a05:6000:2f85:b0:3b7:8d70:e0ad with SMTP id ffacd0b85a97d-3b900b4d8c1mr8490151f8f.32.1754911594303; Mon, 11 Aug 2025 04:26:34 -0700 (PDT) Received: from localhost (p200300d82f06a600a397de1d2f8bb66f.dip0.t-ipconnect.de. [2003:d8:2f06:a600:a397:de1d:2f8b:b66f]) by smtp.gmail.com with UTF8SMTPSA id ffacd0b85a97d-3b79c3c4beasm39217323f8f.30.2025.08.11.04.26.32 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 11 Aug 2025 04:26:33 -0700 (PDT) From: David Hildenbrand To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, xen-devel@lists.xenproject.org, linux-fsdevel@vger.kernel.org, nvdimm@lists.linux.dev, linuxppc-dev@lists.ozlabs.org, David Hildenbrand , Andrew Morton , Madhavan Srinivasan , Michael Ellerman , Nicholas Piggin , Christophe Leroy , Juergen Gross , Stefano Stabellini , Oleksandr Tyshchenko , Dan Williams , Matthew Wilcox , Jan Kara , Alexander Viro , Christian Brauner , Lorenzo Stoakes , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Zi Yan , Baolin Wang , Nico Pache , Ryan Roberts , Dev Jain , Barry Song , Jann Horn , Pedro Falcato , Hugh Dickins , Oscar Salvador , Lance Yang Subject: [PATCH v3 00/11] mm: vm_normal_page*() improvements Date: Mon, 11 Aug 2025 13:26:20 +0200 Message-ID: <20250811112631.759341-1-david@redhat.com> X-Mailer: git-send-email 2.50.1 X-Mailing-List: linuxppc-dev@lists.ozlabs.org List-Id: List-Help: List-Owner: List-Post: List-Archive: , List-Subscribe: , , List-Unsubscribe: Precedence: list MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: JG0FnMmAGyM3x__Wr6e5DBsh5xJlUCtMpVK-fValnv0_1754911595 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit content-type: text/plain; charset="US-ASCII"; x-default=true Based on mm/mm-new from today. Cleanup and unify vm_normal_page_*() handling, also marking the huge zerofolio as special in the PMD. Add+use vm_normal_page_pud() and cleanup that XEN vm_ops->find_special_page thingy. There are plans of using vm_normal_page_*() more widely soon. Briefly tested on UML (making sure vm_normal_page() still works as expected without pte_special() support) and on x86-64 with a bunch of tests. Cross-compiled for a variety of weird archs. v2 -> v3: * "mm/huge_memory: mark PMD mappings of the huge zero folio special" -> Extend vm_normal_page_pmd() comment + patch description -> Take care of copy_huge_pmd() checking for pmd_special(). * "powerpc/ptdump: rename "struct pgtable_level" to "struct ptdump_pglevel"" -> Added * "mm/rmap: convert "enum rmap_level" to "enum pgtable_level"" -> Added * "mm/memory: convert print_bad_pte() to print_bad_page_map()" -> Consume level so we can keep the level indication through pgtable_level_to_str(). -> Improve locking comments * "mm/memory: factor out common code from vm_normal_page_*()" -> Factor everything out into __vm_normal_page() and let it consume the special bit + pfn (and the value+level for error reporting purposes) -> Improve function docs -> Improve patch description v1 -> v2: * "mm/memory: convert print_bad_pte() to print_bad_page_map()" -> Don't use pgdp_get(), because it's broken on some arm configs -> Extend patch description -> Don't use pmd_val(pmdp_get()), because that doesn't work on some m68k configs * Added RBs RFC -> v1: * Dropped the highest_memmap_pfn removal stuff and instead added "mm/memory: convert print_bad_pte() to print_bad_page_map()" * Dropped "mm: compare pfns only if the entry is present when inserting pfns/pages" for now, will probably clean that up separately. * Dropped "mm: remove "horrible special case to handle copy-on-write behaviour"", and "mm: drop addr parameter from vm_normal_*_pmd()" will require more thought * "mm/huge_memory: support huge zero folio in vmf_insert_folio_pmd()" -> Extend patch description. * "fs/dax: use vmf_insert_folio_pmd() to insert the huge zero folio" -> Extend patch description. * "mm/huge_memory: mark PMD mappings of the huge zero folio special" -> Remove comment from vm_normal_page_pmd(). * "mm/memory: factor out common code from vm_normal_page_*()" -> Adjust to print_bad_page_map()/highest_memmap_pfn changes. -> Add proper kernel doc to all involved functions * "mm: introduce and use vm_normal_page_pud()" -> Adjust to print_bad_page_map() changes. Cc: Andrew Morton Cc: Madhavan Srinivasan Cc: Michael Ellerman Cc: Nicholas Piggin Cc: Christophe Leroy Cc: Juergen Gross Cc: Stefano Stabellini Cc: Oleksandr Tyshchenko Cc: Dan Williams Cc: Matthew Wilcox Cc: Jan Kara Cc: Alexander Viro Cc: Christian Brauner Cc: Lorenzo Stoakes Cc: "Liam R. Howlett" Cc: Vlastimil Babka Cc: Mike Rapoport Cc: Suren Baghdasaryan Cc: Michal Hocko Cc: Zi Yan Cc: Baolin Wang Cc: Nico Pache Cc: Ryan Roberts Cc: Dev Jain Cc: Barry Song Cc: Jann Horn Cc: Pedro Falcato Cc: Hugh Dickins Cc: Oscar Salvador Cc: Lance Yang David Hildenbrand (11): mm/huge_memory: move more common code into insert_pmd() mm/huge_memory: move more common code into insert_pud() mm/huge_memory: support huge zero folio in vmf_insert_folio_pmd() fs/dax: use vmf_insert_folio_pmd() to insert the huge zero folio mm/huge_memory: mark PMD mappings of the huge zero folio special powerpc/ptdump: rename "struct pgtable_level" to "struct ptdump_pglevel" mm/rmap: convert "enum rmap_level" to "enum pgtable_level" mm/memory: convert print_bad_pte() to print_bad_page_map() mm/memory: factor out common code from vm_normal_page_*() mm: introduce and use vm_normal_page_pud() mm: rename vm_ops->find_special_page() to vm_ops->find_normal_page() arch/powerpc/mm/ptdump/8xx.c | 2 +- arch/powerpc/mm/ptdump/book3s64.c | 2 +- arch/powerpc/mm/ptdump/ptdump.h | 4 +- arch/powerpc/mm/ptdump/shared.c | 2 +- drivers/xen/Kconfig | 1 + drivers/xen/gntdev.c | 5 +- fs/dax.c | 47 +---- include/linux/mm.h | 20 +- include/linux/pgtable.h | 27 +++ include/linux/rmap.h | 60 +++--- mm/Kconfig | 2 + mm/huge_memory.c | 122 +++++------ mm/memory.c | 332 +++++++++++++++++++++--------- mm/pagewalk.c | 20 +- mm/rmap.c | 56 ++--- tools/testing/vma/vma_internal.h | 18 +- 16 files changed, 421 insertions(+), 299 deletions(-) base-commit: 53c448023185717d0ed56b5546dc2be405da92ff -- 2.50.1