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 BFD123B0ACB for ; Mon, 8 Jun 2026 08:37:18 +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=1780907845; cv=none; b=Uxt1gb89dEF3qAlD+Jdtjn1iLWvaX6pL7o9UoJ8rsrAC6bwWNhUdBluxewkKzZpaCSNl2CGEB6G4UWTFt7ydpU3oU9Zf1H7Q9v4esPzQbigmFFM6dfmamID4e4JO3JHyG2KBYUTw52CV6nQU66iTPswVWoGsDev49bs3T7G4T3g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780907845; c=relaxed/simple; bh=K42PFe6eLQ++q/LDnGpg3rhqNCEgPv/tPyRqfoqSjPs=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=IEM+2u92mX8hHaOWVjQfuNStST1IqrQcUbKB9f5xWJQcCTzU3mxVe4D7Old1lICCP340s459bHbElPSKtLHUDb1eErdHcoSi3NOZOxnYcQQP3V8JjOxvNXPga5Tysf3HMGmLwrP7gHiRYNFDF16TIgL2o63yEP7kPdORkqAtM34= 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=bOgDZ6Zx; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=VHD+ZOa5; 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="bOgDZ6Zx"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="VHD+ZOa5" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1780907837; 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=A0GMQhTq7ZqaOlkJiK0dDinX7wgaWZxvF9PWDzI1B0I=; b=bOgDZ6Zx4YFrUWxzFrYh5VPJ00N3aWv4rVKmUiVQMbWQp7xThGiX1dMp0NQU8h14CkOvD1 gxaIIX3/ZQgEgQpoPhXwhZoyuZo0BDcpxAhL66RdE33AQ35V4iFRq8wMIl+DJHM7EZxY05 8G7Xh+a/WDr6wK3bXFTH+BIeVgRsFgU= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-36-1zHhiuknMLG0Fw9MR5DVHQ-1; Mon, 08 Jun 2026 04:37:11 -0400 X-MC-Unique: 1zHhiuknMLG0Fw9MR5DVHQ-1 X-Mimecast-MFC-AGG-ID: 1zHhiuknMLG0Fw9MR5DVHQ_1780907830 Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-4601daf4c65so2320105f8f.2 for ; Mon, 08 Jun 2026 01:37:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1780907830; x=1781512630; 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=A0GMQhTq7ZqaOlkJiK0dDinX7wgaWZxvF9PWDzI1B0I=; b=VHD+ZOa5esc2ZRFWZK4M01mdEjB8UGO7MvRGf+WVkr+mxwMtU/nZApmO/g5iphJlwh Xc8RHEUNn/tdRhjZk6d8p7r4vaKFRgJv2jb2pYYvfDkhkMEuRODEr2FZkGGMoFlri7kG csP8p2JFmwtffcJganEx62H4xt0keYl0CNU86fIydeusm6UqO0JOfGBU1CXwLCk31wYz k+NVb4ErQaTxPnaMWisWubBEEuiQX55qDvUgHcX3hCfDtcOIrwZ4V+fjoa5QsCStsqFO tzu1mGewn3UB2xNp8K6o0Qg0rQkFwzsKDy9O/0oJn8rC++iDG8oDUipLZgj5LaclvZmt ZsCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780907830; x=1781512630; 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=A0GMQhTq7ZqaOlkJiK0dDinX7wgaWZxvF9PWDzI1B0I=; b=gCTT70or6+UG3Oft8O1HVUV5ZHcSwCFj2TO1K3r1IwM9szv2SbVdJtEabCw7elO3Ry hhIhsWFDSLQ6OJdOYclnADmQAsTZNlvagk9rKFFC65IvygBTU9W53EI+1HhmKbXeRWy9 sCW+hZ+6rF30/V/qAFk010xCXqdU7i3hfzjakHL15RI4EVimXkb5jQ4PIqSB0nOrDYAz Fr4mIF8mJ/4hYRkzKlbqQDIf7/BUHqRkNO2cEgeDTc/x+gM8YwOEczMPbZLCs9Qed9Qf zhK2RNtJufvSXyUH1z7FKrABPXP+RZaJA5/3qDHo/GaUQbAqzn7ZFoeQVwoLbT98YXfA N4AQ== X-Gm-Message-State: AOJu0YzBq4J8WesVa5DpPRNfrg0LABD7leFaEkq2fDCQ3Hi5W6k7BzXP u/O9KjcuwpIh+Y5wKfJQbixEmmCn2eLsaRP/nwyo3hxHfGA6614QKn6vmF6Vc+hN48p8fmHHxla pAeyjeS2EyTz8eW/mJyJ/RVC0tpdWUKqAMTg/94yaieJNfqdiRn0/o08a61PrSyX+oypUOsrmiH W502m9W/oNAA5bFpNA6BM1GLHYtpFqeIqyQQ+kTDjEUcM= X-Gm-Gg: Acq92OHcy0kxI6siaw/Dm+u1n/7FNNNMr9LwCY/9RdSmU9w/PieIy1UBMO9FmglzpZD fqtdTjazBM95+34Zm59jNu0g69ym2jcfmKxcxA79sWGSj2PI4ocMdnrbl9mlrFyRjxjm+guaJTX dfUW1byXhg75sOynVUEUqp69BfMGaV09Et6Wy9FFm2J50H/W1QA2++qBmh1zyzjyuybtPPZguzP As8jY3VyZYzgMQcBPSjGxlYDxGIESk/uVeA/wquBYF8zrlYBnJImtFjLd/N9A0JoMcLm7+SeFyO nZ674BCad3vHnm3oUq17xXNafAELb5Qb8/LHjyVffTHck8EhrKdY8mSm9GbbwhpN04OGwpf2mci 7UzufAEo+uV4P1szW2zjI8gE= X-Received: by 2002:a05:6000:137a:b0:43c:fdd:ea96 with SMTP id ffacd0b85a97d-46030648ba8mr16182381f8f.26.1780907828703; Mon, 08 Jun 2026 01:37:08 -0700 (PDT) X-Received: by 2002:a05:6000:137a:b0:43c:fdd:ea96 with SMTP id ffacd0b85a97d-46030648ba8mr16182281f8f.26.1780907827908; Mon, 08 Jun 2026 01:37:07 -0700 (PDT) Received: from redhat.com ([31.152.37.159]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4601f2f5612sm48449848f8f.15.2026.06.08.01.36.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jun 2026 01:37:07 -0700 (PDT) Date: Mon, 8 Jun 2026 04:36:51 -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 Subject: [PATCH v10 13/37] mm: use __GFP_ZERO in vma_alloc_zeroed_movable_folio Message-ID: <862a59e98104db76ee3998460bfc55e937c218c4.1780906288.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.51.2.2891.g4157995a80.dirty X-Mutt-Fcc: =sent Now that post_alloc_hook() handles cache-friendly user page zeroing via folio_zero_user(), convert vma_alloc_zeroed_movable_folio() to pass __GFP_ZERO instead of zeroing at the callsite. Note: before this series, replacing clear_user_highpage() with __GFP_ZERO was unsafe on cache-aliasing architectures because __GFP_ZERO uses clear_page() without a dcache flush. With this series, it is safe if the caller passes a valid user address (not USER_ADDR_NONE) to vma_alloc_folio() etc., which delivers it to post_alloc_hook() for the dcache flush via folio_zero_user(). It is only unsafe if USER_ADDR_NONE is passed. Signed-off-by: Michael S. Tsirkin Assisted-by: Claude:claude-opus-4-6 --- include/linux/highmem.h | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/include/linux/highmem.h b/include/linux/highmem.h index d7aac9de1c8a..8b0afaabbc6e 100644 --- a/include/linux/highmem.h +++ b/include/linux/highmem.h @@ -320,13 +320,8 @@ static inline struct folio *vma_alloc_zeroed_movable_folio(struct vm_area_struct *vma, unsigned long vaddr) { - struct folio *folio; - - folio = vma_alloc_folio(GFP_HIGHUSER_MOVABLE, 0, vma, vaddr); - if (folio && user_alloc_needs_zeroing()) - clear_user_highpage(&folio->page, vaddr); - - return folio; + return vma_alloc_folio(GFP_HIGHUSER_MOVABLE | __GFP_ZERO, + 0, vma, vaddr); } #endif -- MST