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 5338F4A2E02 for ; Tue, 9 Jun 2026 16:33:49 +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=1781022830; cv=none; b=N64IMZSDiRvZePI/PiYyEBwKLgS4nJQEJFmL1LfsYWjX+7bleyRCYuHhTHxYqm8wiE81WQbJUHzsmDQZdnRnVlzihhD7O0gtyz6GRTIaimmr0VTsY394Q5904iaRuWeYDKQj5gs65XDJoKPUJSCh+lpkW5Rt2uZXywT3a5YdDM4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781022830; c=relaxed/simple; bh=NloWP0DgFYPxfd4/ZN34pw1e1BU92zhB3G4CbO7zbF8=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition; b=dP4Sipp3MuDQaGRH9n3fojrpH04UDqIQQKxDcuvq7llt2Ma84/SHvMz1nSndHU2JssbhkJ3wHmqYZRLJuXAgwkkp89Ue8Dc06utVhyPQ1OvukmxGoDvt+D4P8qTQoVfYzQub/Niru64pN5LbTyjY0ODfxY2y15Bw11DA8F025jQ= 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=EXF4iRue; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=oJdT5Rra; 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="EXF4iRue"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="oJdT5Rra" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1781022828; 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; bh=q+EhFDHbTReAtsWK27ra3gAEOi8VOH3eapVDV1keuxA=; b=EXF4iRueGlk6OfCcjcuuVSzzKM/wXO6l2uxQDWRY+NkFc4p2d/Y3g6ByYxfxxYrSVC+hVH Pb0GPI6L0EpUtsuIE/fLzqTZJxrVf2Uhx2ApgED5dXn3VwGa5gKUpSGbLIOFHumG9WP1Xu b+rP5m4HX9HYp36+MZcP/ohIetqcuX0= 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-343-MEinkctUMKu7Gk74J0ahgw-1; Tue, 09 Jun 2026 12:33:46 -0400 X-MC-Unique: MEinkctUMKu7Gk74J0ahgw-1 X-Mimecast-MFC-AGG-ID: MEinkctUMKu7Gk74J0ahgw_1781022825 Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-46010392f89so5265492f8f.2 for ; Tue, 09 Jun 2026 09:33:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1781022825; x=1781627625; darn=vger.kernel.org; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=q+EhFDHbTReAtsWK27ra3gAEOi8VOH3eapVDV1keuxA=; b=oJdT5Rra5p4Xp67dSgEjesn4ryu9NTvBfC0oSVD/7ItZG3cxT04fLehN4thJSV13iv QGYu8idoQprNCjID4ViTw5WbSJ0cx4ujkMo1W0Sz5qEBoOKQg47fRGEMp27SroutBFZE zqu4ZH2ZGJPoRi0Dx3kmV/z9ehofqcpau8BJwnMDhuKA0TPExuMwRIKezuv61Z4/s6vn XvHz2FaD3o0tzydMFHOUzfWWnyocajQYBCDTQCn9gArcbAwuK1MUI5qi9NKTtehspUqN +JA418jPUMsWPu1JYGWr1vq01O0JtNSkrLNH8NqfG8drJbHBUvt2GSVsntkVX8F/Jirg 0Xpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781022825; x=1781627625; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=q+EhFDHbTReAtsWK27ra3gAEOi8VOH3eapVDV1keuxA=; b=YOlvVoMOtpPm+oRmozdKCT+cu0coh3cK09qiFDhOiZXoCaVo1OVLlhqRbLAKudLBEz +upMR49mifI+rBF07YjWQqy0pskqf4XaQel9N4QHRAhUvBLZOAtSnUteUPkStp1nw9tm ozGQtVh2NT87JGFpQIewUGfrSNBsQtGdNvgwjdQQT1quqO0+ole2+8i6sVImgxPSl7vk 4kUy6ShuGD/ZAafYW0uo80TPyJugnlkzAsrI4u0pPASBgNt+ytyxzXBGnlMqcCqoJoUf 3kG7wJFQdrjAPY4EQH81Zzgx0GbjE+9UEXsBYtkNb52FpoP882/21ksF3488kuE8C8aF E3UA== X-Gm-Message-State: AOJu0YwkbgjtzbmfNhBj2cB9b1x3fgDNyHU4SKK6jTj22DnbXaRCH/M7 /JN9SHMKr3mZh8YEZ8F/XgDocWMY6JnD3nXn6mCDX6Xy3ofCcAbvKLrmUYRsc8/273o41SPZnLr N5ai9gDl7UIwyAlJLLOmuitkDl+uur6cj1ci8wibWcbkIdbuf2OiDi6dOQSqLUGCa89WzG5kdLm beN6r8Gw66qYhbfbPJHxMe+KVKeFp9bqFtv1koDeKRFD0= X-Gm-Gg: Acq92OEnFDoFLJyfDkHsRIX9E6Gdc5AFaz4EOE4iRw5mR+M7BupOfAe2Pc87HMsn+ds A1lILIb2Esez29P62WxrONQ3RnF7x0rmlJjWEJ2hmE1TAOybJ2jm6Vk58KeHNV9CX4eWWvYCgd1 nimfFlaiLd8QHjrRhE/f5Hf3oetl1G+QmKTebmShn4mEUP0J49UX0MBJtnLDsclxHD+cFrOpLg7 qZ3EVfQXQ9QGwPA7iNxXqOabqVMNW884cP8RDCpEKN3fcsP6QgX1bdr5F2LPEntgZW++QLfeU8Y /m+BIR6K3qu+NnetP7Cf1QsdTVlc5m0LD8bT7JlzXkPZXcqyI2PN7MYeiTqqNBBC95AT2bEvN/5 gDO83GQ6yBVBeVDVyhPJO5uC4GoxUuy9548pFxMLRkm0HedrBJb4SYA== X-Received: by 2002:a05:6000:43c5:10b0:45e:dacb:8885 with SMTP id ffacd0b85a97d-46030766a2dmr24707342f8f.35.1781022824759; Tue, 09 Jun 2026 09:33:44 -0700 (PDT) X-Received: by 2002:a05:6000:43c5:10b0:45e:dacb:8885 with SMTP id ffacd0b85a97d-46030766a2dmr24707250f8f.35.1781022824267; Tue, 09 Jun 2026 09:33:44 -0700 (PDT) Received: from redhat.com (IGLD-80-230-85-71.inter.net.il. [80.230.85.71]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-46028a6dce6sm56543737f8f.30.2026.06.09.09.33.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jun 2026 09:33:43 -0700 (PDT) Date: Tue, 9 Jun 2026 12:33:39 -0400 From: "Michael S. Tsirkin" To: linux-kernel@vger.kernel.org Cc: Miaohe Lin , "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 , Naoya Horiguchi , Alexander Duyck Subject: [PATCH splitout] virtio_balloon: disable indirect descriptors Message-ID: <7160278ae1fc4f06dec966867d307033989d029c.1781022765.git.mst@redhat.com> 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 X-Mailer: git-send-email 2.51.2.2891.g4157995a80.dirty X-Mutt-Fcc: =sent The page reporting callback submits an sg list to the reporting virtqueue. With VIRTIO_RING_F_INDIRECT_DESC negotiated and total_sg > 1 (which it typically is), virtqueue_add reports it to the host by allocating an indirect descriptor via kmalloc(GFP_KERNEL). This is not pretty: the reporting worker isolates potentially hundreds of MB of free pages from the buddy allocator (reported pages are at least pageblock_order, and the sg can contain up to PAGE_REPORTING_CAPACITY entries of varying orders). As the result, at least in theory, the kmalloc might trigger OOM when we have in fact a ton of free memory. Clear VIRTIO_RING_F_INDIRECT_DESC, to avoid using indirect descriptors. Fixes: b0c504f15471 ("virtio-balloon: add support for providing free page reports to host") Signed-off-by: Michael S. Tsirkin Assisted-by: Claude:claude-opus-4-6 --- drivers/virtio/virtio_balloon.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c index 53b4a3984e7d..6698edb61474 100644 --- a/drivers/virtio/virtio_balloon.c +++ b/drivers/virtio/virtio_balloon.c @@ -7,6 +7,7 @@ */ #include +#include #include #include #include @@ -1175,6 +1176,11 @@ static int virtballoon_validate(struct virtio_device *vdev) else if (!virtio_has_feature(vdev, VIRTIO_BALLOON_F_PAGE_POISON)) __virtio_clear_bit(vdev, VIRTIO_BALLOON_F_REPORTING); + /* + * Disable indirect descriptors to avoid memory allocation in + * virtqueue_add during page reporting. + */ + __virtio_clear_bit(vdev, VIRTIO_RING_F_INDIRECT_DESC); __virtio_clear_bit(vdev, VIRTIO_F_ACCESS_PLATFORM); return 0; } -- MST