From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8D7C6C49EA2 for ; Tue, 22 Jun 2021 17:44:58 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 1CAE561166 for ; Tue, 22 Jun 2021 17:44:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1CAE561166 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 0AA6C6B005D; Tue, 22 Jun 2021 13:44:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 05A7B6B006C; Tue, 22 Jun 2021 13:44:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E17F66B006E; Tue, 22 Jun 2021 13:44:56 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0136.hostedemail.com [216.40.44.136]) by kanga.kvack.org (Postfix) with ESMTP id A325E6B005D for ; Tue, 22 Jun 2021 13:44:56 -0400 (EDT) Received: from smtpin14.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id E3FB51E07E for ; Tue, 22 Jun 2021 17:44:56 +0000 (UTC) X-FDA: 78282085392.14.2E19168 Received: from mail-ed1-f42.google.com (mail-ed1-f42.google.com [209.85.208.42]) by imf14.hostedemail.com (Postfix) with ESMTP id 8CFECC0201D8 for ; Tue, 22 Jun 2021 17:44:56 +0000 (UTC) Received: by mail-ed1-f42.google.com with SMTP id m14so8138459edp.9 for ; Tue, 22 Jun 2021 10:44:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=3XXF94DDFWzdwVcn/7oxDB2/Bw1J6uuLNcT9rS+xq2M=; b=MXDbZlU3kteAt+kVzLYvjd/HdK9jiJxTsdScavGGyjiHrMB+Ha7/OSyJam8zpHVISH R9/sVFXhHBX1Rk3YnF3lYTNbDvImG6g7JcHgtuyHcSbxQjmLz5VR5cehF23Ly+vem0gU SjmddOaTttBluEZ8vfQZ9rPZQjz1nSKcnFhESJ7an4vI3njQnv9BzStoF8c2HAlF0ENo dyfBAiWeltvymfT98NHaY/GKRJ4GhrQgaaKjngvwU7Qi/1R3sVToy/zLqmdILNdYZs0B 0wUibEUBvI472dnfq4vWMFNoR79V/yHEpHlmSq0e3Vup3nLhF9eIYGtgpY7eKgFqGWa/ OfaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=3XXF94DDFWzdwVcn/7oxDB2/Bw1J6uuLNcT9rS+xq2M=; b=oISTC8G/9pLhwiP2Uy2M1YwRbAmuotJpeypkbxaAJBJg61/HQOMR1wlzAUzdckMlhH q9piXNMh/BdwFycUPCQ2Jg9yXZyJLUFhNF+Mo1c/oy8DGLcRoEJRF5K4oCvXqGamYLvb m6uHkEokHZK3XIIN2PzMs1k9JSXv/BBpaNk9kDfdQ4hGFyFbUK1NiA6H9klu/M7pp4bq IUTZbtYRJjHl65dY/ZrQAT8vwaxyLkTqh1LptNTFy+YxS2IpAxVGHugALaaa6p5LTzg6 WtddB1jy6uMX+WCqmnrH7GLAq5QojOuEvA4FNklhFsAYHoU2nbs4Y3opQ0cd3iVBn8Cc Q1oQ== X-Gm-Message-State: AOAM5305zS8LeVqisa27uV9pCL0MFORtLTm1ylyovauR9F2kQT1HaeEH ypXWMxn/O6lgT2W6aVJOg0x45Ijetp7UskfiyCQ= X-Google-Smtp-Source: ABdhPJyf0j3dSKDSFU2vAKs1VtWJXKZvhaePvPLJxKB8ONe0F+iiIKMsqrTafhk52ilUL/41TEBzxti3EXhFrjTLrVc= X-Received: by 2002:aa7:c7c6:: with SMTP id o6mr6747950eds.228.1624383895153; Tue, 22 Jun 2021 10:44:55 -0700 (PDT) MIME-Version: 1.0 References: <20210622074926.333223-1-gshan@redhat.com> <20210622074926.333223-4-gshan@redhat.com> In-Reply-To: <20210622074926.333223-4-gshan@redhat.com> From: Alexander Duyck Date: Tue, 22 Jun 2021 10:44:44 -0700 Message-ID: Subject: Re: [PATCH v2 3/3] virtio_balloon: Specify page reporting order if needed To: Gavin Shan Cc: linux-mm , LKML , David Hildenbrand , "Michael S. Tsirkin" , Andrew Morton , Anshuman Khandual , Catalin Marinas , Will Deacon , shan.gavin@gmail.com Content-Type: text/plain; charset="UTF-8" Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=MXDbZlU3; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf14.hostedemail.com: domain of alexanderduyck@gmail.com designates 209.85.208.42 as permitted sender) smtp.mailfrom=alexanderduyck@gmail.com X-Rspamd-Server: rspam02 X-Stat-Signature: ippsh96foysk1oa8qiw4ag6sngjdjosh X-Rspamd-Queue-Id: 8CFECC0201D8 X-HE-Tag: 1624383896-478236 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Mon, Jun 21, 2021 at 10:49 PM Gavin Shan wrote: > > The page reporting won't be triggered if the freeing page can't come > up with a free area, whose size is equal or bigger than the threshold > (page reporting order). The default page reporting order, equal to > @pageblock_order, is too huge on some architectures to trigger page > reporting. One example is ARM64 when 64KB base page size is used. > > PAGE_SIZE: 64KB > pageblock_order: 13 (512MB) > MAX_ORDER: 14 > > This specifies the page reporting order to 5 (2MB) for this specific > case so that page reporting can be triggered. > > Cc: Michael S. Tsirkin > Cc: David Hildenbrand > Cc: virtualization@lists.linux-foundation.org > Signed-off-by: Gavin Shan > --- > drivers/virtio/virtio_balloon.c | 17 +++++++++++++++++ > 1 file changed, 17 insertions(+) > > diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c > index 510e9318854d..fd419780cc23 100644 > --- a/drivers/virtio/virtio_balloon.c > +++ b/drivers/virtio/virtio_balloon.c > @@ -993,6 +993,23 @@ static int virtballoon_probe(struct virtio_device *vdev) > goto out_unregister_oom; > } > > + /* > + * The default page reporting order is @pageblock_order, which > + * corresponds to 512MB in size on ARM64 when 64KB base page > + * size is used. The page reporting won't be triggered if the > + * freeing page can't come up with a free area like that huge. > + * So we specify the page reporting order to 5, corresponding > + * to 2MB. It helps to avoid THP splitting if 4KB base page > + * size is used by host. > + * > + * Ideallh, the page reporting order is selected based on the "Ideally" > + * host's base page size. However, it needs more work to report > + * that value. The hardcoded order would be fine currently. > + */ > +#if defined(CONFIG_ARM64) && defined(CONFIG_ARM64_64K_PAGES) > + vb->pr_dev_info.order = 5; > +#endif > + > err = page_reporting_register(&vb->pr_dev_info); > if (err) > goto out_unregister_oom; This works for now. However my preference would be to look into seeing if we can add a value that the host can report that would override the value you selected here. Then in situations where the host has a smaller THP page size then the guest it can report the preferred reporting order via the virtio_balloon interface and have greater flexibility. Reviewed-by: Alexander Duyck