Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3606553ybb; Tue, 31 Mar 2020 08:29:44 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsdgUWsIfnfhq9EAhu2hfSj5zsdoN+4VRdtEWmANIf0oT+q9g/6xu1x/fPSadLx+SSppw4P X-Received: by 2002:aca:1c13:: with SMTP id c19mr2367621oic.178.1585668583962; Tue, 31 Mar 2020 08:29:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585668583; cv=none; d=google.com; s=arc-20160816; b=K5NoIeC9zEtdHWRl0hb8LgJbJ8ktwvgk3OyHivuTV9uC1LTgizYubgyewyAdcX7cb9 /cV5MSByCuPa9WQwFCcKYtv27/fobw9vC1RueU+LS5txHXhkYVNxrJwZ5zov0JzgQ0nC VQFclBl1izABALlzuYyuOO+gA6Lafzn428W1KGcwdTPxVv5bvMgiuA343rqa8p81glhE OymW0MjYoDBXm51svBvrW3ax8JdqPRYp6Cto2boC/JsHVvQAR0uFt5BvrH3vp/JwprUC +57f5iCmyjxIaRNYQL0pnrSwUWsHTLTWRMrrFHSyDP2r1ByLjTGaa3pC59YhhDHLtFpm vdbw== 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=wbjZ/8kYKp7eRMJMyV+34cf5N5B3hMsmVB1uhWILGRg=; b=Zf7CJTc6yE1NGZw7JbpiuSvB0dX534UcVqvF4kvaFzSQEghFsim6YydyYva6iB1bOl YXBDhGx6qjEGIQ/5HFp1YddAAER645tp483IS5OMX5o2kRo5v9A5at5CRMWpjjgJYKSH AdMQVBof6Mc9/osC6isI6D7umVZ2o7G/iapjYAXguoqfx+aHY8qyEy5T01zocyIVY3A1 WkY4+3FTqju2xEKIM+go2wZ7eb2BTzWQhIp/iI52QqpF4pIjC5RFgvI8L2fo6GJ0z6jV NYvyZ7l/b34FfMjFkx/afQ4wDB84HwTDBRSiRe/FpTuJ1v+osDW7zjcvOAx60Y+clzOY w0uA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=RxDqJ5Fc; 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 l131si7026012oih.10.2020.03.31.08.29.30; Tue, 31 Mar 2020 08:29:43 -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=RxDqJ5Fc; 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 S1731071AbgCaP2u (ORCPT + 99 others); Tue, 31 Mar 2020 11:28:50 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:46284 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727703AbgCaP2t (ORCPT ); Tue, 31 Mar 2020 11:28:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585668527; 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=wbjZ/8kYKp7eRMJMyV+34cf5N5B3hMsmVB1uhWILGRg=; b=RxDqJ5FcArVBv/cUieog7tlvQdhbn4pw7yXTI6jw9mgpmFCwpVLtEGKDsFDFi6ujcrUVKg ucOx1yHI4RqFTnaoIsfDbFJRzzjE8Dcy/ePO7vR6GLwLYZCVN0qLsQrIY7cxGMah+Mr1DM LASzxeDhtETYxrJaZSCg6gCVbpvBvnI= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-428-1cmEDf1oOx-ws3UXrj8qGg-1; Tue, 31 Mar 2020 11:28:46 -0400 X-MC-Unique: 1cmEDf1oOx-ws3UXrj8qGg-1 Received: by mail-wr1-f71.google.com with SMTP id h14so13106287wrr.12 for ; Tue, 31 Mar 2020 08:28:46 -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=wbjZ/8kYKp7eRMJMyV+34cf5N5B3hMsmVB1uhWILGRg=; b=eg62f04vGr0YMDuMG6tDZFdbVyqi+TCG7i805XCtxYsw98DJU8gK7f2Nv9rcH9mTew +7yXK84An4HR29p0dRswoAO/UAOtCiiZattXPfS5h+N9z9yxpCyYznEvVdFlIlcWBSpU abw2I6HldrElZ7PVuTY+/gIwrz7t0ygviSCGn1EPdNmOP8s+R5nUadCn0quQrKjwOM/z WWJpTJ6XOsby43CPvOTjNplYNxbi1MYB9tq8kpCqvRTy1pCUjmtQp9nkCNKe9mc+/kDp FJ4tltsCuJitNg++4IMur9HCUFLCOhloFFfDo4IYUUHz/Z0i1UqYyftxZcK4GAYns2dU Zt7Q== X-Gm-Message-State: ANhLgQ3qXcZCLj6WtghHpQou50hQXHKZeAwHliInCKLkUbqAQpTu/ZVx 1Z8rYbRyhWB44/4fewIk+V5oNcJJ06Y7nD1yHUuyXvY8/niTbTW3+KRSSIvBqz4byAStB2iTXg2 TaLtB3M6l/uunyuxqBayUks8+ X-Received: by 2002:a1c:c246:: with SMTP id s67mr4069846wmf.160.1585668525068; Tue, 31 Mar 2020 08:28:45 -0700 (PDT) X-Received: by 2002:a1c:c246:: with SMTP id s67mr4069822wmf.160.1585668524863; Tue, 31 Mar 2020 08:28:44 -0700 (PDT) Received: from redhat.com (bzq-79-176-51-222.red.bezeqint.net. [79.176.51.222]) by smtp.gmail.com with ESMTPSA id w7sm26825926wrr.60.2020.03.31.08.28.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Mar 2020 08:28:44 -0700 (PDT) Date: Tue, 31 Mar 2020 11:28:41 -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: <20200331112730-mutt-send-email-mst@kernel.org> References: <20200331091718-mutt-send-email-mst@kernel.org> <02a393ce-c4b4-ede9-7671-76fa4c19097a@redhat.com> <20200331093300-mutt-send-email-mst@kernel.org> <20200331100359-mutt-send-email-mst@kernel.org> <85f699d4-459a-a319-0a8f-96c87d345c49@redhat.com> <20200331101117-mutt-send-email-mst@kernel.org> <118bc13b-76b2-f5a1-6aca-65bd10a22f6c@redhat.com> <00dc8bad-05e5-6085-525c-ce9fded672cc@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <00dc8bad-05e5-6085-525c-ce9fded672cc@redhat.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 31, 2020 at 04:34:48PM +0200, David Hildenbrand wrote: > On 31.03.20 16:29, David Hildenbrand wrote: > > On 31.03.20 16:18, Michael S. Tsirkin wrote: > >> On Tue, Mar 31, 2020 at 04:09:59PM +0200, David Hildenbrand wrote: > >> > >> ... > >> > >>>>>>>>>>>>>> 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? > >> > >> .. > >> > >>> I expect the whole "steal huge pages from your guest" to be problematic, > >>> as I already mentioned to Alex. This needs a performance evaluation. > >>> > >>> This all smells like a lot of workload dependent fine-tuning. :) > >> > >> > >> So that's why I proposed the API above. > >> > >> The idea is that *if we are allocating a huge page anyway*, > >> rather than break it up let's send it whole to the device. > >> If we have smaller pages, return smaller pages. > >> > > > > Sorry, I still fail to see why you cannot do that with my version of > > balloon_pages_alloc(). But maybe I haven't understood the magic you > > expect to happen in alloc_page_range() :) > > > > It's just going via a different inflate queue once we have that page, as > > I stated in front of my draft patch "but with an > > optimized reporting interface". > > > >> That seems like it would always be an improvement, whatever the > >> workload. > >> > > > > Don't think so. Assume there are plenty of 4k pages lying around. It > > might actually be *bad* for guest performance if you take a huge page > > instead of all the leftover 4k pages that cannot be merged. Only at the > > point where you would want to break a bigger page up and report it in > > pieces, where it would definitely make no difference. > > I just understood what you mean :) and now it makes sense - it avoids > exactly that. Basically > > 1. Try to allocate order-0. No split necessary? return the page > 2. Try to allocate order-1. No split necessary? return the page > ... > > up to MAX_ORDER - 1. > > Yeah, I guess this will need a new kernel API. Exactly what I meant. And whever we fail and block for reclaim, we restart this. > > -- > Thanks, > > David / dhildenb