Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1545484ybb; Thu, 26 Mar 2020 02:50:42 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsib6yMdek2hkwc+i4mgmzB4lOa+KIq+nuTVjD7TvVvbyL+3fMUB20OmDdFmUu19FEHR21Z X-Received: by 2002:aca:130f:: with SMTP id e15mr1133316oii.160.1585216242572; Thu, 26 Mar 2020 02:50:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585216242; cv=none; d=google.com; s=arc-20160816; b=DdHLvg9khEm9tW7CimlmmBY5FtXSkpFZdtdO0QzFPEb78ZZLYNj8k4B95eI19G7sNs f64t9STx6ncLWgddivo8sIhxLvfVB5yfjVCbUj4JtftmVWB393rLHKIwbJxEkwx4XXoL y/+RKZDbLbCbUOg2e1+IGojugRJHI8Zpo05TbNY+OPtfAV074H6vlRB29U5jCR6Zu64h X9pD+kHsRhqTP9XFsuE3mqlbQZtNXOlAhbxdEGhGYJWUbl4ILinLa7s2TZXU5zHickfS lLTfkC37bn20Hb6BH+bqP+6On2CZshP/ZYl93q9FnyxR9ltGk/ZQjfmfsHdL4eyABYi0 oyXQ== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=NSdLnkX5cWkW77BXDTK3F4eLxqaTUjnvmwt+R66r9DM=; b=b9Z5c5dS88klawWuyilgW196RV3zAVo2ZYuwUyZdVUfT9yGMMJ34oT2/nrX5VbUe+C r/8zOTNc9/1BMMV3kQXNkB1IjQAN1rktYVdvU1r34Afx1CXl8mbkohsIXYhFOs6jyzQv 5jejjwko1C991zMKmwSthPJPjuaTRZIpee3h71RVEO56UnwDEB16tKEGu9eC0p5hzB/B FBm865sz1WDP5RF/oUyB3t/Hy4aOxQ3bv98Ra70Bp96AF8CUuUdnzCiVIzJJOdaj9R+I 590mwGyHPEXv14J+9v9YwngmFiu9xJXBhw5pN+9fZLU9SszUt8FPfzLEqL6QUbMp6sxy 7NWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=bGlLOWQe; 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 l63si893727oif.161.2020.03.26.02.50.30; Thu, 26 Mar 2020 02:50:42 -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=bGlLOWQe; 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 S1727929AbgCZJuA (ORCPT + 99 others); Thu, 26 Mar 2020 05:50:00 -0400 Received: from us-smtp-delivery-74.mimecast.com ([63.128.21.74]:38951 "EHLO us-smtp-delivery-74.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727729AbgCZJuA (ORCPT ); Thu, 26 Mar 2020 05:50:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585216198; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NSdLnkX5cWkW77BXDTK3F4eLxqaTUjnvmwt+R66r9DM=; b=bGlLOWQe9EZb3oJzmaeQ0fLrlo6SQ99DGosXW2MH96Q7FAuMNmn/LdwABUHPnz/U4YUqUo 5jTXUBROOmcngExvXPQ85npuZrJTVxMLsOJxKzvxaWD9xNkAsWuW9MFvYpJ+qcIBcyzM4f N4v/RH9DcIhAAevkYB3/7yWz4/y2rq4= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-54-opnybUZLPzO9Oc_VD5bFhg-1; Thu, 26 Mar 2020 05:49:57 -0400 X-MC-Unique: opnybUZLPzO9Oc_VD5bFhg-1 Received: by mail-wr1-f72.google.com with SMTP id d1so2756101wru.15 for ; Thu, 26 Mar 2020 02:49:56 -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:content-transfer-encoding :in-reply-to; bh=NSdLnkX5cWkW77BXDTK3F4eLxqaTUjnvmwt+R66r9DM=; b=j7DU6kYTmNFlf0zwruG1IicH4GZS6S6fTeKQHpN+ItDTqE4amcsnOIrjP/qicXcSoK NWWKSRxyoxum3gudxzwmyMqTpm0Cbr91nubZ55+uXA7XkY7rFnsEmYd1rxEEirwLhLwG XvQnKTEIVHZ2SB8qPryGKF5ErtA0SlFcUjYW2p0pfsqqMj5ESLj2t+bx9xzZmBWmufvA vg27STJaVjpahqzMzT1uO8BDFDW5ahMMgm0kR2BzETbXcdAg2ryignEFF6W9RXvYfoAL sM9e4l2eKQomxjSCk7j87Q7Mqa6/JbY9Ig6XNvg+allPCL2hV4LQVuBFVkxGMEDZMSLi hTmg== X-Gm-Message-State: ANhLgQ1ys1nsgAEgoH2eyGf7FAnrg1lm/OTQjag9oH6AlMY8njn7Sfye TDAihDZf+Npeh5j37yKDMtQ78s9Xw+EQGq9uV2y92j1FRvCr+GIZVqYnAj9VT4492C91kiUL1Dh Lp2/03BN+8JYS4vUa6gVCQGa+ X-Received: by 2002:a05:600c:54d:: with SMTP id k13mr2200275wmc.161.1585216195791; Thu, 26 Mar 2020 02:49:55 -0700 (PDT) X-Received: by 2002:a05:600c:54d:: with SMTP id k13mr2200244wmc.161.1585216195492; Thu, 26 Mar 2020 02:49:55 -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 9sm2667566wmm.6.2020.03.26.02.49.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Mar 2020 02:49:54 -0700 (PDT) Date: Thu, 26 Mar 2020 05:49:51 -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: <20200326054554-mutt-send-email-mst@kernel.org> References: <20200326031817-mutt-send-email-mst@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 26, 2020 at 08:54:04AM +0100, David Hildenbrand wrote: > > > > Am 26.03.2020 um 08:21 schrieb Michael S. Tsirkin : > > > > 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. > > > > Yes, but that‘s a pure optimization IMHO. > So I think we should do a trivial implementation first and then see what we gain from a new allocator API. Then we might also be able to justify it using real numbers. > Well how do you propose implement the necessary semantics? I think we are both agreed that alloc_page_range is more or less what's necessary anyway - so how would you approximate it on top of existing APIs? > > > >> -- > >> Thanks, > >> > >> David / dhildenb > >