From patchwork Thu Sep 22 01:12:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zi Yan X-Patchwork-Id: 12984358 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 32D69C32771 for ; Thu, 22 Sep 2022 01:13:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 70A3E8000C; Wed, 21 Sep 2022 21:13:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 66E0080007; Wed, 21 Sep 2022 21:13:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3D3068000C; Wed, 21 Sep 2022 21:13:01 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 1F37E80007 for ; Wed, 21 Sep 2022 21:13:01 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id D66D0121342 for ; Thu, 22 Sep 2022 01:13:00 +0000 (UTC) X-FDA: 79937947320.27.D6F7230 Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) by imf04.hostedemail.com (Postfix) with ESMTP id 874EF40007 for ; Thu, 22 Sep 2022 01:13:00 +0000 (UTC) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 3734A5C00C9; Wed, 21 Sep 2022 21:13:00 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Wed, 21 Sep 2022 21:13:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sent.com; h=cc :cc:content-transfer-encoding:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to :reply-to:sender:subject:subject:to:to; s=fm2; t=1663809180; x= 1663895580; bh=581oZMKShZxT8Zn0zMTVJFcTkBUcW/2CxVH64DF0VuQ=; b=5 /v8yeDpgRIOk7r62sNn9dlusfwrrbRWOJNYqTILsa8dzvtX22ug3mrD8CWKL4rgz g6JHE6jJy64E6Mwma+5D7cRrJNjxZgKZAOI2QJgc7MFfZ77aStnTVeb+PlMlFcKG sHfqg2LF0CVSBhH5lqxe2A4ooWPtO6inrhjS9DvvgeXa7zs+pZ33pGQPemR4AclV TFgeASNL3mR76hXjBXcpIFLYODhLF5WxIVJJqYs54sG8LyUDoDJ/425SKa+dAAxE ov1cAZTbVCWXZcWHMDPe4gGsShDhvwQ1hD5hH29vs/G6CLpu0o20AWeiE7bB3UOr E907F5GCUUqGCUoYRdKNg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:reply-to:sender :subject:subject:to:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm2; t=1663809180; x=1663895580; bh=5 81oZMKShZxT8Zn0zMTVJFcTkBUcW/2CxVH64DF0VuQ=; b=hBmOfHdvykBjpUqXA Piz4qtLt5nV6dD8qGBG15J8U9CHEFAADbsYLT+DhUoYq13DGxR1n/tD6P6PvtYO3 n2wOFiYvlk98dHTviwGdjm1lJzTqAzeOV1sTDVlr6js1/TghE0b1xNB0DQKcJDJ8 pLOKUibjfNa6/pEkGByvcbsf6cpCQJgie00iWkoPvxSqTtBiA7O41Es2mQWf27un 1+m0KhwqvwjR6z/k7r+1KKLU+9lGgE16aHfl531vb8ft1TNO08DqRLWbQl51MqIl IyfKNBcjfprOCZiUOtNTt5RkxL7UF2iG9Jt5vBVpkZ3QOzblovuQU1cQD4WDmoA4 utk8w== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrfeefvddggeefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhhrggfgsedtqhertdertddtnecuhfhrohhmpegkihcu jggrnhcuoeiiihdrhigrnhesshgvnhhtrdgtohhmqeenucggtffrrghtthgvrhhnpeegge ehudfgudduvdelheehteegledtteeiveeuhfffveekhfevueefieeijeegvdenucevlhhu shhtvghrufhiiigvpedunecurfgrrhgrmhepmhgrihhlfhhrohhmpeiiihdrhigrnhessh gvnhhtrdgtohhm X-ME-Proxy: Feedback-ID: iccd040f4:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 21 Sep 2022 21:12:59 -0400 (EDT) From: Zi Yan To: linux-mm@kvack.org Cc: Zi Yan , David Hildenbrand , Matthew Wilcox , Vlastimil Babka , "Kirill A . Shutemov" , Mike Kravetz , John Hubbard , Yang Shi , David Rientjes , James Houghton , Mike Rapoport , Muchun Song , Andrew Morton , linux-kernel@vger.kernel.org Subject: [PATCH v1 06/12] virtio: virtio_balloon: use pageblock_order instead of MAX_ORDER Date: Wed, 21 Sep 2022 21:12:46 -0400 Message-Id: <20220922011252.2266780-7-zi.yan@sent.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220922011252.2266780-1-zi.yan@sent.com> References: <20220922011252.2266780-1-zi.yan@sent.com> Reply-To: Zi Yan MIME-Version: 1.0 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1663809180; h=from:from:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=581oZMKShZxT8Zn0zMTVJFcTkBUcW/2CxVH64DF0VuQ=; b=spMbONBdy9xsNP/VLtqdB0cJFew0WUN0gMu/tmS/v99j5dNkxvFhMTN7y4VQuD6IcruJny DKLDtf5trpQ4wWvkT7S9NJC5+jBsbJxluh47z33pJPkhTnwSAgEQ3+WccCUm0RhT+bo08r MWb+5VTGpZLZ8lcPJ0pLLoJ3OeMvFes= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=sent.com header.s=fm2 header.b="5 /v8yeD"; dkim=pass header.d=messagingengine.com header.s=fm2 header.b=hBmOfHdv; spf=pass (imf04.hostedemail.com: domain of zi.yan@sent.com designates 66.111.4.26 as permitted sender) smtp.mailfrom=zi.yan@sent.com; dmarc=pass (policy=none) header.from=sent.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1663809180; a=rsa-sha256; cv=none; b=RYXVzeDpZtJ17mOV2KfN4UNOu79CtIb6Lsbl6wqyhXQt3TUsJWyMnddPT8SiK0l1FaA+Vr Hst6dQtNIE3ZK/aoVdjRd2KqwWZOfE3B8OHXGT+9xx+ifbtzudnX6OT38tPYTGNp+6Ysmq cOQ2yIAZsnkpgWEpvrFudVUD7opA1o4= Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=sent.com header.s=fm2 header.b="5 /v8yeD"; dkim=pass header.d=messagingengine.com header.s=fm2 header.b=hBmOfHdv; spf=pass (imf04.hostedemail.com: domain of zi.yan@sent.com designates 66.111.4.26 as permitted sender) smtp.mailfrom=zi.yan@sent.com; dmarc=pass (policy=none) header.from=sent.com X-Stat-Signature: hdn1549pff5oc7rr7detjfcmb13xhxch X-Rspamd-Queue-Id: 874EF40007 X-Rspam-User: X-Rspamd-Server: rspam12 X-HE-Tag: 1663809180-690378 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: From: Zi Yan virtio_balloon used MAX_ORDER to report free page blocks to host, as MAX_ORDER becomes modifiable in later commits, the reported free size might be too big. pageblock_order is either 1/2 of or the same as MAX_ORDER currently. Use pageblock_order instead to make virtio_balloon have a constant free page block report size when MAX_ORDER is changed in the later commits. Signed-off-by: Zi Yan Cc: "Michael S. Tsirkin" Cc: David Hildenbrand Cc: Jason Wang Cc: virtualization@lists.linux-foundation.org Cc: linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org --- drivers/virtio/virtio_balloon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c index 5b15936a5214..51447737538b 100644 --- a/drivers/virtio/virtio_balloon.c +++ b/drivers/virtio/virtio_balloon.c @@ -33,7 +33,7 @@ #define VIRTIO_BALLOON_FREE_PAGE_ALLOC_FLAG (__GFP_NORETRY | __GFP_NOWARN | \ __GFP_NOMEMALLOC) /* The order of free page blocks to report to host */ -#define VIRTIO_BALLOON_HINT_BLOCK_ORDER MAX_ORDER +#define VIRTIO_BALLOON_HINT_BLOCK_ORDER pageblock_order /* The size of a free page block in bytes */ #define VIRTIO_BALLOON_HINT_BLOCK_BYTES \ (1 << (VIRTIO_BALLOON_HINT_BLOCK_ORDER + PAGE_SHIFT))