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 59C4C3A6EFF for ; Tue, 21 Apr 2026 22:02:21 +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=1776808942; cv=none; b=UheTO8khjg1N3TgXBFy525gl/aApQUyV4Cwu01EUwoQr1+Q6vyah2mQkzLlWyTvGH0eeWc2vguHNuuvqSC0lPaTZU+3bBjFSLDlGOVGcKK6BiFS0JzYcRxx7DDwoQzUh6hZTohwWzuRJ8Dw2RXp28Qd1YrQEikv/Xk2ykOA80ko= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776808942; c=relaxed/simple; bh=w7yku+W4GfSSG96SUrLMIOzLwQD5fzXNoQPFKEr+ev4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=a+6iq14lLNaIdAbQbfWh7iTkpxi3BWMuBy2bZwcEfCmqDIvNuz6/HQe3pVgIMXehZncBuKIsyc7rfOTETCFKwUTop+46jcUo1rTJ8a0q+VIFdgNqw0ULg3JzmpDn7NQ00k2lx1iLo6ogL/WtSZrusBv0hfKyp3MrjiSqPEdlFlc= 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=Zqiczn97; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=RQfSvFlP; 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="Zqiczn97"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="RQfSvFlP" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1776808940; 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=WzL0/LIharUBH04VP2SJLM2VLBD1UEvntqvv4vY+Hyg=; b=Zqiczn971++LrWtiCmygieeZ/SUPSlLXlPpJFuP4Uu8yO2Ed6+TeLdxe4dRMAIMaA6MawU q8NRef4ZRzbV3p5Pv96N4XT8HUy96YtAdXUKYkQ7Iwbe7o0nKPgSgKUHfep+zLaz0g0end ffxvbg7U6Op3FX9ggqWuzpeg5Vxl4Qc= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-593-sAKF-XWdPhGaGufFUlwipg-1; Tue, 21 Apr 2026 18:02:19 -0400 X-MC-Unique: sAKF-XWdPhGaGufFUlwipg-1 X-Mimecast-MFC-AGG-ID: sAKF-XWdPhGaGufFUlwipg_1776808938 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-48378df3469so31092765e9.1 for ; Tue, 21 Apr 2026 15:02:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1776808938; x=1777413738; 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=WzL0/LIharUBH04VP2SJLM2VLBD1UEvntqvv4vY+Hyg=; b=RQfSvFlP3feCj0yrooCJAzrwyjfK/FUw/BFoNyfcdYIL7pvqvPaFgQVFIozsazaprh lgFJ9lSceUNrG+LT4SAVM9UcwVxqgQYnN54tOygxHuIPt60oPLZoLNd3ftu2QITUy9pN oAyZvzf7ZcBblhDbnvfzwXnt1M+xOd1Bt+aUlU2bLLoiObDPDCKiClnyG9a/aruWYqnj 0pvWUuvBir2C+7RSggTCKAUqOIODFN/T0SbK1UgG0XB0XUloAXt17hdxlvkAYYU3ucSf gJ91YtpEvIbK83Pfzb9CfyqT6f8K605/1SkRx1EAQqKG/xR1LWXHJmmVQDhg5u1nczB3 Qffw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776808938; x=1777413738; 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=WzL0/LIharUBH04VP2SJLM2VLBD1UEvntqvv4vY+Hyg=; b=rID2YD7geuffGSEPvVEVrpo7B6mO3SWhhS/yBRI23OP6A/0TLdx1Jx9Gg8sUoEoATs aLbimkUllY/YoW80jhzW2GrA9aC4d/WBkNWoXaKTWGAkG83ajGA+kRFR2k5ucyJTVvaf bzIQ+SLmx7Aenj+DW6/lrCWbS6ZtkFG4tvTuZ0hFNIHBSNVIJ3ZWoHYaOtokwRbZVHke EgGCIB7DURMz5QlxLpOzmRzHnvgwC07+ZpUcvmgEcEx58R9U9Y7eB9nHYBDYOKRab648 O00jJfZf1woo7yKzxMcq9BRwL8yvvQQA2b/1a7mvI2jPH0z3kWHKqC8CGPpvrAYvmmXB vCvg== X-Gm-Message-State: AOJu0YwtmCGI3BrR5+5pvjbI2fELH0Sz78j6w8P/c6jSYqukctIJsp3s blyZS93gzjojpVSxY1cAIf09r7Jivh+6wlEbeLqpRuHjH4nRiQe5ML6Y3z6YhL5JR4p1UN9+Cpi aUhqeuCuZ+jfiHhurVbYSJkrFdmjWq4UEmLjKSCyxCRqHjqDqywSJ1QA1KMKVX3GJXwawQ1/OY6 8x4tK8CfOxXXVjw72Xgf0JTexChrREUGzCjH+GubsyQV0= X-Gm-Gg: AeBDieu+yLT3bfBDAVt0z+nyoiancUQdVsKABUF5DZEk7EXk9h6Y2c/+yWUQXPEbpj6 14w9W0C+nuT9NfHBHFVEYnBcjBcz8O6TPgcp4+ks7cPQo4d+KWthwh/Mo7I3SU7hD84nwA4Iq0z Z/994twYsES+IjX/gXej+ylz53dAUXQ+X6AOR2D2d/+1O89qewkI0TcvhEyIavfm5idNmMn12Je jliEH8lOlVFrCwTJvjfK57bD2tIbqKSNg6FAuMPKoOGf5zCQxfLI8jq/c8kWWVea0HkllcLnDQq fM0iFfKNHrc4Iv7y2uC/Cs9Hw1w6kT5uWbAhrwA4BMexoRFw9fwJ5zG5rtRoGLqwE1eX7LgTdIy yqHZo39+UeHWg/rRNRTbWQcnlyi+GGnoKqOQwOgXcJ5c/mJaIttUFVw== X-Received: by 2002:a05:600c:b96:b0:48a:5339:a46 with SMTP id 5b1f17b1804b1-48a53390f6cmr90666205e9.9.1776808937705; Tue, 21 Apr 2026 15:02:17 -0700 (PDT) X-Received: by 2002:a05:600c:b96:b0:48a:5339:a46 with SMTP id 5b1f17b1804b1-48a53390f6cmr90665755e9.9.1776808937145; Tue, 21 Apr 2026 15:02:17 -0700 (PDT) Received: from redhat.com (IGLD-80-230-25-21.inter.net.il. [80.230.25.21]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-488fc0b4c85sm383193925e9.0.2026.04.21.15.02.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Apr 2026 15:02:16 -0700 (PDT) Date: Tue, 21 Apr 2026 18:02:14 -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, Xuan Zhuo , Eugenio =?utf-8?B?UMOpcmV6?= Subject: [PATCH RFC v3 19/19] virtio_balloon: mark deflated pages as zeroed Message-ID: 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 When host_zeroes_pages is set, the host has zeroed the balloon pages on reclaim. Use put_page_zeroed() during deflation so the freed pages are marked as zeroed in the buddy allocator, allowing the next allocation to skip redundant zeroing. put_page_zeroed() is best-effort: if the balloon is the sole holder (the common case), the zeroed hint reaches the buddy allocator via free_frozen_pages_zeroed(). If someone else holds a reference, the hint is silently lost. Once balloon pages are converted to frozen pages (no refcount), this can switch to free_frozen_pages_zeroed() directly. Signed-off-by: Michael S. Tsirkin Assisted-by: Claude:claude-opus-4-6 --- drivers/virtio/virtio_balloon.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c index 165b123caa64..3058d48fc8de 100644 --- a/drivers/virtio/virtio_balloon.c +++ b/drivers/virtio/virtio_balloon.c @@ -299,7 +299,10 @@ static void release_pages_balloon(struct virtio_balloon *vb, list_for_each_entry_safe(page, next, pages, lru) { list_del(&page->lru); - put_page(page); /* balloon reference */ + if (host_zeroes_pages && !page_poisoning_enabled_static()) + put_page_zeroed(page); + else + put_page(page); /* balloon reference */ } } -- MST