Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1439871ybb; Thu, 26 Mar 2020 00:21:56 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtmDA3Qfbz5PTJOcECWmEgbI4cjba+1zAnX1lqxUVdEviQJmqoGti9lZ2f4pghZ3zzFv/BA X-Received: by 2002:a9d:5607:: with SMTP id e7mr5540060oti.196.1585207315960; Thu, 26 Mar 2020 00:21:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585207315; cv=none; d=google.com; s=arc-20160816; b=Pfui+ITYIaOKynmTAWazJnm6gndo/tVnFK6M2Fas/hcWvSCZrvHhchHYXqSfGNXiCp dtfGkfZn5Mk5e+ftiThLCDe7QX6SZd5Aejw39Vj3JX4W7skn+cP82UDrWOLY9lmkZ61/ NNcIyEqkZHklgpdH6ODzL86K/W14ObeD54jTJekhNwCrCIu3UDQ5NTD9elv05dtyG4MR XRVDSElGKXlS7so8C6qrP+m0ksvhUQ2wRz2MH73vBfgD35/teQEpCUf4mjF65lmkhFOn snBpr6ckj0e+XRrBB01ckjFns92ZY25zH0VTrK67+/sK7w4qS4WhBd5OPHl8TKLv5TiP zk/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=4XWknPyKkYAfbqizFNt1Gd0mfkxXVUcGvQWw0e8F7fs=; b=mF2e61YKN7PkYXG8h+QDKNET+LvrpCxd0o3ZqLgVKbS2WIEuytIcdPG2V1yKFwQeuc J2TbgTFLowNAsgL7yB/AOrN+TEWINwJSCIzLSdBhlr6vAcUSMS42LVr4AUfpCcYkNAvs EgDS/tjJjWT28rSzCl+mSpkaSGlIrrE3FYEIk7bR5Rv3cu78s5hv7GHOg5ujQxrQvvGL aouZV2XWn8fnELdiVIbk4vDn0dznUbWK9sXHMKK+W5UaBTzVd/8rNx0K5jAxxBnTbCFz JrXhKZjnotOpKzjicat3mVMHwXi8zk2LCGmQovTU06c+P/IBUJ7r6xNQWGBoSrWgbq9g 3Dhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="C/cK0evN"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p187si646369oop.28.2020.03.26.00.21.43; Thu, 26 Mar 2020 00:21:55 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="C/cK0evN"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726332AbgCZHVX (ORCPT + 99 others); Thu, 26 Mar 2020 03:21:23 -0400 Received: from us-smtp-delivery-74.mimecast.com ([216.205.24.74]:32264 "EHLO us-smtp-delivery-74.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726014AbgCZHVX (ORCPT ); Thu, 26 Mar 2020 03:21:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585207282; 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=4XWknPyKkYAfbqizFNt1Gd0mfkxXVUcGvQWw0e8F7fs=; b=C/cK0evNah8jy7t+Ntri4P6a1gWGIQ8Tj3ChEa1QLjMg3cJOmpXNUdelWaaL5tm1whFHCQ 0ia6ZzSeB2yAbaNXsBo5whEfqfWMtYZehxjaYV5KjVDWwQeCPL3LKfvhfpg3zw0NbGpjbe 270oBdvO9uFa2WOOlcw7MaMa2Pnewt0= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-171-tv-zZGRjMw2zAx86MhVdlg-1; Thu, 26 Mar 2020 03:20:39 -0400 X-MC-Unique: tv-zZGRjMw2zAx86MhVdlg-1 Received: by mail-wr1-f70.google.com with SMTP id t25so225919wrb.16 for ; Thu, 26 Mar 2020 00:20:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=4XWknPyKkYAfbqizFNt1Gd0mfkxXVUcGvQWw0e8F7fs=; b=eNx0rAsyHcgKcFVPtSiLc8PjnRtvYc5tQ1QUEoAAQ8qyv4FI1y5kmzPs8x+2xtskfj Ko4rlUbLxTNwFVxDKXFRku37raEXdxaaIkyo7VXUT4i5VuysqTEWNCzHhpD3Wm/FJ5aP hYSr4KsMAVzqveSEojDAHpyNE9X95Aggf9hOEl1ImO2odffegorrJKXW5xUIuO59vYHg VdA6aGWdUUHAmOt83XMmCWbIUXf+dvXaKDFXRrJuOKK9deTnFDJU7PRnq3nexDUHy5Zz TAeVWmPyk5Tpb5pV62jls6oKm7YIQn4HjfanxTFVBHIsfiLXafFRti2Z4DW5SVfAUGrN OWBQ== X-Gm-Message-State: ANhLgQ2Xp9khmfMfdTtol+lBGnuFGNwQ7fsL0EJ7h12awJhzKp5k45Z7 K508hANbzMvYQyazh17sLfaCth43gYUTXfW7mGaInkWbpEcMrYSsuE8YQmTBP47+t0UmeMrnDoI oTx8Q8KWeghVZAuBqX/RQkIDO X-Received: by 2002:adf:a348:: with SMTP id d8mr7659492wrb.83.1585207238150; Thu, 26 Mar 2020 00:20:38 -0700 (PDT) X-Received: by 2002:adf:a348:: with SMTP id d8mr7659463wrb.83.1585207237880; Thu, 26 Mar 2020 00:20:37 -0700 (PDT) Received: from redhat.com (bzq-79-182-20-254.red.bezeqint.net. [79.182.20.254]) by smtp.gmail.com with ESMTPSA id r3sm2300372wrm.35.2020.03.26.00.20.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Mar 2020 00:20:37 -0700 (PDT) Date: Thu, 26 Mar 2020 03:20:34 -0400 From: "Michael S. Tsirkin" To: David Hildenbrand Cc: Hui Zhu , jasowang@redhat.com, akpm@linux-foundation.org, pagupta@redhat.com, mojha@codeaurora.org, namit@vmware.com, virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org, qemu-devel@nongnu.org, Hui Zhu , Alexander Duyck Subject: Re: [RFC for Linux] virtio_balloon: Add VIRTIO_BALLOON_F_THP_ORDER to handle THP spilt issue Message-ID: <20200326031817-mutt-send-email-mst@kernel.org> References: <1583999395-9131-1-git-send-email-teawater@gmail.com> <3e1373f4-6ade-c651-ddde-6f04e78382f9@redhat.com> <20200312043859-mutt-send-email-mst@kernel.org> <45756694-560d-0276-d39e-cc2fd1c4e3a7@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <45756694-560d-0276-d39e-cc2fd1c4e3a7@redhat.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 12, 2020 at 09:51:25AM +0100, David Hildenbrand wrote: > On 12.03.20 09:47, Michael S. Tsirkin wrote: > > On Thu, Mar 12, 2020 at 09:37:32AM +0100, David Hildenbrand wrote: > >> 2. You are essentially stealing THPs in the guest. So the fastest > >> mapping (THP in guest and host) is gone. The guest won't be able to make > >> use of THP where it previously was able to. I can imagine this implies a > >> performance degradation for some workloads. This needs a proper > >> performance evaluation. > > > > I think the problem is more with the alloc_pages API. > > That gives you exactly the given order, and if there's > > a larger chunk available, it will split it up. > > > > But for balloon - I suspect lots of other users, > > we do not want to stress the system but if a large > > chunk is available anyway, then we could handle > > that more optimally by getting it all in one go. > > > > > > So if we want to address this, IMHO this calls for a new API. > > Along the lines of > > > > struct page *alloc_page_range(gfp_t gfp, unsigned int min_order, > > unsigned int max_order, unsigned int *order) > > > > the idea would then be to return at a number of pages in the given > > range. > > > > What do you think? Want to try implementing that? > > You can just start with the highest order and decrement the order until > your allocation succeeds using alloc_pages(), which would be enough for > a first version. At least I don't see the immediate need for a new > kernel API. OK I remember now. The problem is with reclaim. Unless reclaim is completely disabled, any of these calls can sleep. After it wakes up, we would like to get the larger order that has become available meanwhile. > -- > Thanks, > > David / dhildenb