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.129.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 616F22505B2 for ; Sun, 26 Apr 2026 21:47:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777240071; cv=none; b=E8k1vhXDqeETHtJSrJ0JoGao7jSRt/T2+v4CsX3aJUri1VY5pIPde9z46Q+5ox6hYcuLQls7OsS20hZSfKU55k4qcv65xgOtSVFG7LRcYRfz2A66tUlQSHdvMEe7nMOFvW2icz+VUAsTmsefSffbunZ04uKXotv9+IPd3StDalg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777240071; c=relaxed/simple; bh=+zNBlTlQkFqQMbEC4hj3ywqszA8Y1ImDjehUW9ILJAs=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=hQMYkVK2qe8NGDZ22mRk1351vLoCycOfMFIT7SD2YlTJgxpgguy4nj9DwgA6E7H6azLWH38KPJMegkYPfVrHazLtQoZcTBb6pBHtx0mu4gVRYWhccMOiFWKgiOy94WxbyFrX1dLcHFJwH0GY0vOQipXj+93XlKzF8r/QnoE2Y68= 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=UvKDtvnL; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=Bw8AeJPs; arc=none smtp.client-ip=170.10.129.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="UvKDtvnL"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="Bw8AeJPs" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1777240069; 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=Dn5xupL5V4qF15edJs01tgV6QOrsZ1JWzK8CN9u8yrs=; b=UvKDtvnL11JLzEMFQC6f0LRovIRu69QMmhq5he1lU410lFA9LUt0TquPfG1C+Cno8Mt6Ma d5SVTzXdP3ZnFbQBCHNlH3cid9FCLvhQdNwRBD/Bcc1EdxHzygftaOyT5VTyhLL5fPxTOk WSbp1t3sZ30nkC8EgNwIKJcjE46nmvQ= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-549-iQGdzugeNaqqKsiOsjrcyQ-1; Sun, 26 Apr 2026 17:47:48 -0400 X-MC-Unique: iQGdzugeNaqqKsiOsjrcyQ-1 X-Mimecast-MFC-AGG-ID: iQGdzugeNaqqKsiOsjrcyQ_1777240067 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-488ba2f4094so57572025e9.1 for ; Sun, 26 Apr 2026 14:47:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1777240067; x=1777844867; 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=Dn5xupL5V4qF15edJs01tgV6QOrsZ1JWzK8CN9u8yrs=; b=Bw8AeJPs/EXO/UdUp24JnkPfo101ccz+UThZIuQim1PT/zOYgRSup1emJFrgbQCrAH YGtrZQ5QQewnmwHNyhHSuVYjM6441gWMEliCkzuMl5YzvR+CGxMNeCO/ukpVug3yKko6 O9aS5RuE0rW1u9qi5w1MacpRfDs2dXofHc7Ou7tCD/OSZ9G5a5F7JxmL92IlCuY2dvOy 14RcVTmGHV4a7C1N9Y5ytlvtFzG+GIxWZRh5VpwiUvVMgCmxctyy2sI7yzbs7qYJno+F v19+JzH7l08Q6UjPV1dsH+4vxaf6FOp8eFtDUXMh3+EI2fL8WwViZawNMLvM8tq8p9MT obpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777240067; x=1777844867; 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=Dn5xupL5V4qF15edJs01tgV6QOrsZ1JWzK8CN9u8yrs=; b=VAqN0o9gBQdp8lgjJ7YDoKGbppwspqjhDgWSWVOwDKYlPHyuygEU4CcRPg5pc8X2l1 m0tf8q4iJtU4PwWZi4FCTFMN/qHKSJoVoJ/4fLYfkwTC3Pu84P7AZ0stNdygwabybiMv NRiRu8hEIWaXomFXLsVEEqkPCWpzmAUOIMsB1Y5rlHWMtsgm/eR6NoBcaP2m7Z/i1I3M 4lByJbBx+lXl/QrobYtJA/502IgvTHBszRvHQedShWM9j9/tslKJ2y23e8o8JbwFeADw wA8+t0FVHuaJwvbpyFaspHlbWiyU7j1x0FotfX4B3FYKNKS5VdWsGIQD2rBiko6ljfN2 58ww== X-Gm-Message-State: AOJu0YwXoeqKdQ+CsJN03gQSioElDwbXSAeRWXEPwMnNZaHzfezVTLlJ sLIYBqBHp0I3oh9mrYCRWvDElDJx8ZlqDL0MUDojv2pyCuZTeykcjVYNzvi7ZKGogPk+vq+fMEn YOJk4ErZmn1XNS1bIItNckfebvtNaxgnV2MSD574F5uzrfYSP3toGYeTttcO1oZKB6Zpxj/IyOd 8KLw80gK/OvOuy98S6U/HdRLN+A4AcAAbp+rySeC6Etzs= X-Gm-Gg: AeBDiesh2MFoptXs0+4f3naHYGKCudA/EaD23cpQa8dsY11q6pqPpYrQD/xjVHb2m2U 56bW99Gsi8qVNTKL79+OoQVTAQgmYGGTOdwgp7NtZ/HmaZipLR+s7ZU1sx91huKj5WMGHrUBVlz /oFLAzD8jHWfrB/7bH/+Fbw9b7ySHx6KtZ0CMxy83YILVt/RfBNMjwqJrlFCqKxqfPI6jqcWzEt tCMey5kr9al4cMy77C3IZlTKvdNY8hHdBodhnH2tLYqI/i2GtxRjA/nC2dACDpoWkk+iETIAdO9 qflmCwkYfgzQAqNHgWdWD9jLaregk19UWCS4i3YVV4JlXS/J95OVavuTpHrgLhHQCXTTngEBmNy Wp7e3cALBs19bXF7PaUAhpwfhBA94iAnrK5JX4SmXvog8BpzHNFM1FdAZ X-Received: by 2002:a05:600c:348d:b0:48a:674d:e756 with SMTP id 5b1f17b1804b1-48a677401c7mr138299805e9.20.1777240066863; Sun, 26 Apr 2026 14:47:46 -0700 (PDT) X-Received: by 2002:a05:600c:348d:b0:48a:674d:e756 with SMTP id 5b1f17b1804b1-48a677401c7mr138299475e9.20.1777240066327; Sun, 26 Apr 2026 14:47:46 -0700 (PDT) Received: from redhat.com (IGLD-80-230-47-179.inter.net.il. [80.230.47.179]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-488fc10019bsm765742785e9.4.2026.04.26.14.47.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Apr 2026 14:47:45 -0700 (PDT) Date: Sun, 26 Apr 2026 17:47:43 -0400 From: "Michael S. Tsirkin" To: linux-kernel@vger.kernel.org Cc: Andrew Morton , David Hildenbrand , Vlastimil Babka , Brendan Jackman , Michal Hocko , Suren Baghdasaryan , Jason Wang , Andrea Arcangeli , Gregory Price , linux-mm@kvack.org, virtualization@lists.linux.dev, Lorenzo Stoakes , "Liam R. Howlett" , Mike Rapoport Subject: [PATCH RFC v4 04/22] mm: add folio_zero_user stub for configs without THP/HUGETLBFS Message-ID: <1c5deda275078ffb432af62ae293af1f696d29a7.1777223007.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. 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 5be3d8a8f806..541d36e5e420 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -4718,6 +4718,9 @@ static inline bool vma_is_special_huge(const struct vm_area_struct *vma) (vma->vm_flags & (VM_PFNMAP | VM_MIXEDMAP))); } +#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