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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3F997C3DA7A for ; Mon, 2 Jan 2023 11:55:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9BDCF8E0002; Mon, 2 Jan 2023 06:55:20 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 96DA18E0001; Mon, 2 Jan 2023 06:55:20 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 80F898E0002; Mon, 2 Jan 2023 06:55:20 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 6FE858E0001 for ; Mon, 2 Jan 2023 06:55:20 -0500 (EST) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 37263A563A for ; Mon, 2 Jan 2023 11:55:20 +0000 (UTC) X-FDA: 80309703600.15.5840286 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf20.hostedemail.com (Postfix) with ESMTP id 0374B1C0003 for ; Mon, 2 Jan 2023 11:55:17 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=MqPHmPKK; spf=pass (imf20.hostedemail.com: domain of david@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1672660518; a=rsa-sha256; cv=none; b=rooh36tc3MjhKfrTFXqNM1PGILwz6KcDckDsECFmHFv9jlDH1MI/41wnsOeHai1Qk9ZO6q cn/4I9BpiHb6OEhlYtmWATKjeaFcHRBWDLQwdhkbsWkMdVho7Vb5Z9VPYR3ik5XnZXC+VE +0hjZHSNOQh25G1jxXiX4jOdLtMATL8= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=MqPHmPKK; spf=pass (imf20.hostedemail.com: domain of david@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1672660518; h=from:from:sender: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:dkim-signature; bh=Eaac0zUTFuoCsKmnVZyZkkTalHPLFZnYU3aunXSpmFU=; b=SRlk5D77mEEGKxLd8Fwfx8FoafphKQRP63matiXMu2l7GdNsxmBD6nq5XPZshvokSHOlZS 9/y2XEmIFqoiQPqeTuxzAxAH7l/d/mmnWlYihR50K509IuPSyhePkxzcgbX3Lf596bHuhz 5opwkGu1C0e9za3WwObmXpoFyB2vTKk= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1672660517; 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=Eaac0zUTFuoCsKmnVZyZkkTalHPLFZnYU3aunXSpmFU=; b=MqPHmPKK5BZ0e1pZmUXX4bugeSttZh8WYJIjuVVfJf87CG2usETeKp2qedKFZTG2HqEz6L 4pGDHLt7vFFQ0jUq/gKGb185RQzVbEMVa+GsjFlZKoTh3vpJS1LgVDdMPS7xbp1DJ3JgoX xB5kkQjEuhmrRX/+Z7CwRqtTETdO7hI= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-540-rSp6W0GTMISKGPZSTeyJPQ-1; Mon, 02 Jan 2023 06:55:16 -0500 X-MC-Unique: rSp6W0GTMISKGPZSTeyJPQ-1 Received: by mail-wm1-f70.google.com with SMTP id t24-20020a1c7718000000b003d1fd0b866fso6262868wmi.3 for ; Mon, 02 Jan 2023 03:55:15 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:subject:organization:from :content-language:references:cc:to:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Eaac0zUTFuoCsKmnVZyZkkTalHPLFZnYU3aunXSpmFU=; b=Y98GL0FjJAlVwnZfQvB8/cN+pNLOk1Rlcunycztx8G44VDaV5dcSCxhJLjlOSaSde1 iyBp7vyzNBcgIudspNB8U+S/+EjNatczhPdg4/APVThWH8pWts16pCvs82CP1AiNJmf/ M5ttWCWg+RHPsWTCpE1/6cA1d0o8L2jBaIzi/dgNMDYiHyvhwQEPy/ey+9FXdIV8EDk+ l2k0QXw02ii0EwGZWozyZHDzeKjAkrcsg9DY/arC2Vu406sSJwkyU5SKVTMxu4DNoAT2 NyCYra4r6d6tCygLKtqZKwv/DjS7IDBAVOUDFKpatqqaASly1D+w5oxRnjGCB8DUO/v2 OfQg== X-Gm-Message-State: AFqh2kp9sMNApWBF3wOSaH53ZEEYc1w0LvMK08tbxXBhDp+x0VsEHcVl ACzOyXt4WEpnTWdYh6penXxkcnDzMvAWwMozeXZTv7DkAWxAf7i5s9eC2CDhA2nqwsUiwzzr8Ip h/ZQ+VVuWD5w= X-Received: by 2002:a05:600c:21c1:b0:3d3:45c6:b641 with SMTP id x1-20020a05600c21c100b003d345c6b641mr29176984wmj.22.1672660514912; Mon, 02 Jan 2023 03:55:14 -0800 (PST) X-Google-Smtp-Source: AMrXdXsDuiuqHRAe9GS9nG47HPQ0j1PQIPn7y+bhjAPJ5nptWGKJbmyvUyS9SjWvkI8qPZ9ZsVyNeg== X-Received: by 2002:a05:600c:21c1:b0:3d3:45c6:b641 with SMTP id x1-20020a05600c21c100b003d345c6b641mr29176970wmj.22.1672660514646; Mon, 02 Jan 2023 03:55:14 -0800 (PST) Received: from ?IPV6:2003:cb:c703:500:9382:2e5a:fea:8889? (p200300cbc703050093822e5a0fea8889.dip0.t-ipconnect.de. [2003:cb:c703:500:9382:2e5a:fea:8889]) by smtp.gmail.com with ESMTPSA id z10-20020a05600c0a0a00b003d96efd09b7sm39870584wmp.19.2023.01.02.03.55.13 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 02 Jan 2023 03:55:14 -0800 (PST) Message-ID: <874fd614-23da-c9b6-95f5-41b544b8df18@redhat.com> Date: Mon, 2 Jan 2023 12:55:13 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0 To: Soichiro Ueda , mst@redhat.com, jasowang@redhat.com, akpm@linux-foundation.org Cc: virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, kalutes@google.com, mhiramat@kernel.org, cwd@google.com References: <20221223093527.12424-1-the.latticeheart@gmail.com> <444735fd-7076-7bd3-dc5e-7135a7f3a95c@gmail.com> From: David Hildenbrand Organization: Red Hat Subject: Re: [PATCH] virtio_balloon: high order allocation In-Reply-To: <444735fd-7076-7bd3-dc5e-7135a7f3a95c@gmail.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Rspam-User: X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 0374B1C0003 X-Stat-Signature: cpg75shunostu3bu1xhh83zsysxb6iba X-HE-Tag: 1672660517-959878 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m7cpufFt/qYvWk+syr/cHiELYlD+kUcIqjRJDgSbrZyZWP9Y/LFrKKQX1n6wClqk5VPTyo1+1MVNg7ZC3g5WfBjpMlwk+JCAx9hr3if2+46aELp7VIxLRLdgKTJmw8nIxnmYh7sL7GdPgSJ4qUFDoyLUx/0qSoeThs1CVT7hRc8uQQj2KBkzO5kync= 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 29.12.22 06:31, Soichiro Ueda wrote: > Hi David. > >> How does this affect page migration / balloon compaction etc? > > I guess this patch doesn't affect balloon compaction. When allocating > pages using alloc_pages(), it skips compaction by masking out > __GFP_RECLAIM if the order is larger than 0. > > As for page migration, in the current implementation it migrate a > 0-order page to another 0-order page. With this patch, it may migrate a > high-order page to another same-order page. > > But I noticed that the migrated high-order page is handled as 0-order > page in virtballoon_migratepage(). > > >     balloon_page_insert(vb_dev_info, newpage); > Yes, I think suspected that it's broken. We also might want to handle OOM accordingly by splitting the page and retrying migration. Almost nothing should stop a balloon page from getting migrated. One thing to try is allocating a higher-order page and immediately splitting it into base pages, and enqueuing base pages only. Only inflation would be faster, because you could only deflate base pages. > We should put the newpage into a page list of the corresponding order, > like this. > >     balloon_page_enqueue(vb_dev_info, newpage, order); > > I'll fix it in the v2 patch. Note that I have some more concerns: * We might end up stealing all higher-order pages from the guest instead of eating all of the "small" leftover pieces first. This might be undesirable. We discussed this in the past in the context of hugepage ballooning [not able to locate the abandoned patches quickly]. * PG_offline won't work as expected anymore and result in kdump reading inflated memory, which is undesirable. One workaround would be setting PG_offline on all base pages, but this needs some more thought. * How are we handling a scenario where we are requested to deflate e.g., a single 4096 KiB page but we only have higher-order pages allocated? I suspect you would over-deflate right now, which is undesirable. -- Thanks, David / dhildenb