From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3933A3C060C for ; Mon, 11 May 2026 09:02:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778490138; cv=none; b=XpUmx0eo0F7pIeip7xnB8Mah8Hajb3jE1vqGEoHygcsQeTxPRCMW2OzphLiOGQzpVocEoNWA6UxVFt6O3wVlRo5a9BUoSVsXuGWusuENoLyIiSywlmlcM8q/LdSNXM71sTI57g45Plu6wGiSBh/j5h7J+RU1SbqsWOA54yCqWko= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778490138; c=relaxed/simple; bh=69QG+5KxbknuqowgRzIPAH0Udu09EBE3lvMvWnTXBmg=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Zv7ZNrt0Nz7q1pV4vUHdRm7Zd1Lc/HuReegV6D+ijj7Brz59La2yF1pONeoZGWq9WyeY3L+7DxaPe0Ho9X/c9UwrV89cy3dh8R52UI+/6IgmeVqp+GKKHAfB0TB4s9pUjS5qJMbdK/Njndt6h1rqhXd+MMdixY81WqCoYTBKJfU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=GudVkmr3; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=c4QnHudU; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="GudVkmr3"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="c4QnHudU" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1778490136; 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: in-reply-to:in-reply-to:references:references; bh=6dawd7eS61o9/4A+PK33L87yl5/YoiTuIytB/tOyfis=; b=GudVkmr3UiTWoHuvwI2HONOJeA9VY6yxysofyJ/Xek7tSS9Q533ZG9D3BnOqtAuyNR7MAz lYCN+p0Uq2CeLxCuEjWu2U2/sTUtWCrWe7NcWc6Y+la8Dpb8W0I1ugZRTcp2Pr8n59vT3a bxIigbI7GDQ798Q8YKAJ+9z6TpNr7ds= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-546-UyP8Jy3wN1Cy6zPrDzDS9Q-1; Mon, 11 May 2026 05:02:13 -0400 X-MC-Unique: UyP8Jy3wN1Cy6zPrDzDS9Q-1 X-Mimecast-MFC-AGG-ID: UyP8Jy3wN1Cy6zPrDzDS9Q_1778490132 Received: by mail-wr1-f70.google.com with SMTP id ffacd0b85a97d-449dcfe8005so3841473f8f.3 for ; Mon, 11 May 2026 02:02:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1778490132; x=1779094932; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=6dawd7eS61o9/4A+PK33L87yl5/YoiTuIytB/tOyfis=; b=c4QnHudUFURplqk9s7DuxSRIS/TjmPk8uKeR8dYvDCPYJ7I+N2gPU0SQXo4hpV/+FM CuSHyM7ZHpCKMVAY0PYCIsoUz6cKgM9ocr5u8Ezjl0HeUlAW5gqBRTqu+W/2s0wicsqL +ME9X+L6vqK029/WyXLil9p3tjn6xqn8KwJfEtxAlQ/NeLbJr0jtjp4vAvRsofhmecJp X3RpGdEwY3GJRfdSQguJRi8Kn9313jnncszyuQ6blrAY7r8eovfDX8rab7MJxYYm+G49 WIeLCHqF5snsjnWAh56AX7kVrYEfgLvSwqa7w870rtquhnYhnFohxwSX30v0GXvFML/W AADw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778490132; x=1779094932; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6dawd7eS61o9/4A+PK33L87yl5/YoiTuIytB/tOyfis=; b=SeIw9uwH9ijrReBUvJbJM/+KnsygNKrUFOhb3mlEynaBpQPeCLLNskcpjH/ZUHgymK XNvSk3SHCf2oDIWrQqNaG6BTXbyUz6R8ASZD0ol8mHya4WPAL14nvL3BU5K9zNUvOKhK iQNITOBSpPAs+KlI6GhivXEnv4hDVF0gAJ79bzfSXFqp7b6KFI/nNc63xb85erGUUrAg LlFwqUszJr9zzXLBgqBbFO12sRzXw8ojt12xpLa5A2rKlVb3dYoOYgdG3+/vWTWhZ0hL EzkhfWEdFBJDl4zmShHCl0hSz45dr82xF333PqNxIDLTudbjcuGNmCuYPml1H45O0pN1 xLlA== X-Gm-Message-State: AOJu0Yz95z/wIJfrFLj2SPO1evWLXtmrGwz5Vqdm1BFXRSg1IBLL+qx8 aa8GCcdegOgkQ1LxrVq+YsA/UKdAe//7IVPZtz8JJEX76d/QovNzDO1lcMoZFotxlMkeuUrhWXy n5ZftXHRxJoXeTjjnwERfHVi7IwJbANeKBMLBv1eMpZ9uXTn9kvugp4IMvPpwfNRb8/JDxTdCJN e1FMZEwBPDOYzcPX5JrY3Ya5UHEpYdhO43JNljd2NUPA8= X-Gm-Gg: Acq92OGrli+G3CGqAzlD4c0eXIBKrVLgwQnpaAKm1z07fjHN7GJkP+4vrN84feg1FxW 9DSUDMz4f1w8o/B76kLNvGExV3XASq/VB4skJbjlWZICxJ3u42+SB56+rvs8fsJbANWhwoyORui SGNKXG4Z4Y70qheGne2x3S8hBT9IV+JkiqNl286rlXOwJDHWRrwAOYcgtMDa5GWeNOpbn6Gbmk3 4fAlfoH+yFTFcuGlKy+/dAUCY8u7d2VJVJObIZGYIZ5vVbI0XwXKJNHaWHUG6aZIDcOhlFq/GdD EpLrYKwMhGyL6Ga2cKM+8BP5VwFhn4LUkicSDsVSiCP7j6rSviYQoB8N0iOiRsJP1i1FCzgIRD1 ADMG1Fd6w3siFPNcMkdLQFH4v1O8ev+n03iXEayg2 X-Received: by 2002:a05:600c:4f51:b0:48d:1a94:56c with SMTP id 5b1f17b1804b1-48e51f3054cmr404025475e9.18.1778490131611; Mon, 11 May 2026 02:02:11 -0700 (PDT) X-Received: by 2002:a05:600c:4f51:b0:48d:1a94:56c with SMTP id 5b1f17b1804b1-48e51f3054cmr404019825e9.18.1778490126688; Mon, 11 May 2026 02:02:06 -0700 (PDT) Received: from redhat.com (IGLD-80-230-48-7.inter.net.il. [80.230.48.7]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48e6db1742asm59834415e9.31.2026.05.11.02.02.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 May 2026 02:02:06 -0700 (PDT) Date: Mon, 11 May 2026 05:02:01 -0400 From: "Michael S. Tsirkin" To: linux-kernel@vger.kernel.org Cc: "David Hildenbrand (Arm)" , Jason Wang , Xuan Zhuo , Eugenio =?utf-8?B?UMOpcmV6?= , Muchun Song , Oscar Salvador , Andrew Morton , Lorenzo Stoakes , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Brendan Jackman , Johannes Weiner , Zi Yan , Baolin Wang , Nico Pache , Ryan Roberts , Dev Jain , Barry Song , Lance Yang , Hugh Dickins , Matthew Brost , Joshua Hahn , Rakie Kim , Byungchul Park , Gregory Price , Ying Huang , Alistair Popple , Christoph Lameter , David Rientjes , Roman Gushchin , Harry Yoo , Axel Rasmussen , Yuanchu Xie , Wei Xu , Chris Li , Kairui Song , Kemeng Shi , Nhat Pham , Baoquan He , virtualization@lists.linux.dev, linux-mm@kvack.org, Andrea Arcangeli , "Liam R. Howlett" Subject: [PATCH resend v6 04/30] mm: add folio_zero_user stub for configs without THP/HUGETLBFS Message-ID: <1aaf861301e26121bcbbf549060cb6b3b04e0c06.1778489843.git.mst@redhat.com> References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent folio_zero_user() is defined in mm/memory.c under CONFIG_TRANSPARENT_HUGEPAGE || CONFIG_HUGETLBFS. A subsequent patch will call it from post_alloc_hook() for all user page zeroing, so configs without THP or HUGETLBFS will need a stub. Add a macro in the #else branch that falls back to clear_user_highpages(), which handles cache aliasing correctly on VIPT architectures and is always available via highmem.h. Without THP/HUGETLBFS, only order-0 user pages are allocated, so the locality optimization in the real folio_zero_user() (zero near the faulting address last) is not needed. This also matches what vma_alloc_zeroed_movable_folio currently does. Signed-off-by: Michael S. Tsirkin Assisted-by: Claude:claude-opus-4-6 Assisted-by: cursor-agent:GPT-5.4-xhigh --- include/linux/mm.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/linux/mm.h b/include/linux/mm.h index af23453e9dbd..3b1ca90fd435 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -5070,6 +5070,9 @@ long copy_folio_from_user(struct folio *dst_folio, const void __user *usr_src, bool allow_pagefault); +#else /* !CONFIG_TRANSPARENT_HUGEPAGE && !CONFIG_HUGETLBFS */ +#define folio_zero_user(folio, addr_hint) \ + clear_user_highpages(&(folio)->page, (addr_hint), folio_nr_pages(folio)) #endif /* CONFIG_TRANSPARENT_HUGEPAGE || CONFIG_HUGETLBFS */ #if MAX_NUMNODES > 1 -- MST