From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qt1-f174.google.com (mail-qt1-f174.google.com [209.85.160.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0699128504F for ; Tue, 21 Apr 2026 02:21:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.174 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776738083; cv=none; b=Q9eUptS+y7AFanx+DGoqeUkbaOm4h/aUUCo2Pzf2Wj2/ZfZwjZfZuJ+sSpNVlSL/kHqMZPOwYizOg+KS5rI39IoXgZ3cPgoQRjEtMLAeRp8gkVboDCQXVgMzStr2znsedp6QPMAEsH6LPkKQ95+B+mf4RzA6+vrAhPlnX5TyrRU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776738083; c=relaxed/simple; bh=puw2Z06oXZwCZ5/QATkErGasEbCoKz+hvxu43KOvrCA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=FaMzaj8++CyVELifI4TDj9dgmdrOlN6I4HDXvQVr5sVImgQCZVAS8u2YQEuYSrdtKPqghz7DOd8TxEEdtBLGntn2cCKLztJQNGz+TylQMSPGNZRremg+NI4M9YVPIz9elaeZuc8ayLNVHTTx48+JiUUt0gtTCPMdm1XGqrlzPW4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=gourry.net; spf=pass smtp.mailfrom=gourry.net; dkim=pass (2048-bit key) header.d=gourry.net header.i=@gourry.net header.b=Q4y0eo4a; arc=none smtp.client-ip=209.85.160.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=gourry.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gourry.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gourry.net header.i=@gourry.net header.b="Q4y0eo4a" Received: by mail-qt1-f174.google.com with SMTP id d75a77b69052e-50fb1ad3734so3222601cf.1 for ; Mon, 20 Apr 2026 19:21:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gourry.net; s=google; t=1776738081; x=1777342881; 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=Ts4fktzEABhwW/8zC7If98qX/eLs2oXD1C9NL7CTV+M=; b=Q4y0eo4af1SOrttQyy1ozqXODbsysMBH2VUgwJBKznrNywi0bLFhP2dQ/IXe2M5hpB 9P62u32YrWPDUA/W+rZHIZDveSB62itJ/+ezsEhSZpf/96Xvt3gRAD/dgPdDibAsYd3g k4GqbhGBoKrYnlYVxV1T3ioTV0CSoxOCosacEbGtlD/Dqz19WSK4aRpXhpJtqChkuNL3 5YsYFmfZCMUhL/dlv/rImJof3Kl5jm7tCJ+MdBkouLBPEdNhimiZd9tXFevTr1SJWHKY 11jGSDfaIGvGW/CeliNQ/0WFX9My+eGounVJCPYi0oXEE0KhMruqoTRJ8VU5e9H0EbBj FMIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776738081; x=1777342881; 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=Ts4fktzEABhwW/8zC7If98qX/eLs2oXD1C9NL7CTV+M=; b=C79nsddE+iXRYxu09U8Pi/hn1Y0vDQvVH7XdHQSMx+Y6eIQO99J9lzACrmPYMphzx4 f2sb3S8mvLni23tSi4iFtYNHFm45oT0INdsKMGe3BBkGWaFNmuAjI2YDrUtP0mpGSCht SdAhZGHPlROqEuaQM3OoLusomcZKpYjIzUgpzmK2/Gf+YaYp3umk2ikf7fzfoEa9kI0e w6Unhju4quutce+aDQKhp3OkAMwE3dpeoElUYA7+Iaim3yJNDMJsXh5XQIiwyhiA1Fh9 hvaTGFg1LcGVgDF9JvPCI55JEGwjgG5fbQe4A21+bkfc4IzNskwdZaqagQ0APtuy1/ve kKBg== X-Gm-Message-State: AOJu0YyWcha6UQ5fZwUX6c6KGCAraNnqbyt9lXEK3cy6gHJY9ZEIdCps v7hSG5WKxTmIGPld7ZNHUXCZTD4jmouEQfBWgLKGNdbv/j5jWa4zsVi48CDQJ8o9dpI= X-Gm-Gg: AeBDievV4RPSbidAuQv6xOOM7uAE5gGPb1o2fTEMAzdV9WVyIGl+Z0yeHcuSy9ZtNYJ KpwmvbPc1s9zKH2PY+Pu4p99GGL+gmFc26hzgo1Kt9zapC47Hh4Dpe+7Qb7yZKWXzYwocxwSKVa UYbXdQexHxn4WT3CXkuYZIG7BaRjaL4f/jYdb09wbgnZdRz/FbN/eXF/Rv/XWlrSpiKyT5NrzJr 1J5BSJPsPdmrk/Kjsga096fWYGmOk+4JenhIn26zle1ImsJTNx8yIFMcF2i3IXVjK84gwJ1tNrr FK6RmN4mTUEqOZRnOxEyPeZb6YrVh81yhXMCPi9xTTnQXlOnF4JNbDv9yctksbXjK/nyLojcvHp JEQ+5vnYJ0U5mKaom+DZ73ZyyTA8asVrz0b/CMzTn2qZ7JFTfp9BGH0m9T/JLD0UAVp8GLCWDIQ tEmCpgV94eht2OGhH62xJaab2Q8635xgUMA9nNIbU6oz9LEjwlwV1NH7RxkeERQbzHngxh30ue5 Nh+E5WrVgcJHoNc/fOBsN4= X-Received: by 2002:a05:622a:8356:b0:509:2231:977a with SMTP id d75a77b69052e-50e3676f1fbmr145985271cf.30.1776738080875; Mon, 20 Apr 2026 19:21:20 -0700 (PDT) Received: from gourry-fedora-PF4VCD3F (pool-108-51-163-112.washdc.fios.verizon.net. [108.51.163.112]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-50e39495192sm99043001cf.27.2026.04.20.19.21.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Apr 2026 19:21:20 -0700 (PDT) Date: Mon, 20 Apr 2026 22:21:18 -0400 From: Gregory Price To: "Michael S. Tsirkin" Cc: linux-kernel@vger.kernel.org, Andrew Morton , David Hildenbrand , Vlastimil Babka , Brendan Jackman , Michal Hocko , Suren Baghdasaryan , Jason Wang , Andrea Arcangeli , linux-mm@kvack.org, virtualization@lists.linux.dev Subject: Re: [PATCH RFC v2 00/18] mm/virtio: skip redundant zeroing of host-zeroed reported pages 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: On Mon, Apr 20, 2026 at 08:51:13AM -0400, Michael S. Tsirkin wrote: > > When a guest reports free pages to the hypervisor via virtio-balloon's > free page reporting, the host typically zeros those pages when reclaiming > their backing memory (e.g., via MADV_DONTNEED on anonymous mappings). > When the guest later reallocates those pages, the kernel zeros them > again -- redundantly. > It took me a second to really wrap my head around what you were saying here, but if i'm following correctly: 1) Guest steals a page, reports the free page to the host 2) Host returns that page to the buddy 3) Guest wants the page back -> vmexit, alloc() a) host gets a page from the buddy via fault path b) this memory is "user memory" so host zeroes the page 4) Guest repeats step 3, re-zeoring the page So you're adding a step that does: 1) page_reporting_drain() in guest sets PG_zeroed if host_zeroes_pages=true 2) on allocation, if PG_zeroed is set, don't zero In theory this seems ok. PG_zeroed being a buddy-only flag is nice. In practice there are obvious concerns about an explicit flag that would allow a kernel (in this case the guest) to skip zeroing a page destined for userland mappings - but i'm also paranoid. In concept this seems reasonable, in implementation I have concerns about the pghint_t type being added. Will respond inline in David's reply thread on that though where you already have notes. ~Gregory