From patchwork Thu Aug 11 23:16:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zi Yan X-Patchwork-Id: 12941802 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 AC03AC25B06 for ; Thu, 11 Aug 2022 23:16:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EAD4D8E0006; Thu, 11 Aug 2022 19:16:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E5D5F8E0007; Thu, 11 Aug 2022 19:16:50 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C62668E0006; Thu, 11 Aug 2022 19:16:50 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 8E6398E0007 for ; Thu, 11 Aug 2022 19:16:50 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 6F2E91A191C for ; Thu, 11 Aug 2022 23:16:50 +0000 (UTC) X-FDA: 79788873780.02.8494496 Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) by imf08.hostedemail.com (Postfix) with ESMTP id 2849F16019E for ; Thu, 11 Aug 2022 23:16:50 +0000 (UTC) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id D0E195C015C; Thu, 11 Aug 2022 19:16:49 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Thu, 11 Aug 2022 19:16:49 -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=fm1; t=1660259809; x= 1660346209; bh=581oZMKShZxT8Zn0zMTVJFcTkBUcW/2CxVH64DF0VuQ=; b=m rs6vrbJsfqGYoj2XllLGP6k0bBKIeQAXZq+8slnkzIt6qYpHeZEAveoCBv29EsKe 6cwbZk4Lcaq3J4lyIHnjJOHF3tIEz6ytuFkazkLYiuCOb/ShDAehH+rou8pa0eqA rO1EHofDIIfRYsiCf7nnlVs2AN1L6tXN7XbdBa1mohCuFWbUDR0OX/c2q+h2C7A9 DutPxAftBizB0uxlz1ZKes3fNpkhnsawhOQtZpzHYNIFanJuCZUW1XJPy3JSORhL i3rTSpkGLHxZLzHqWBPLR/2MLpZjkU4DlXipWLclUGG5WKh8RQR46oieP9NhYIq7 /JLKstTjHUtZHGsMqsz/g== 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=fm1; t=1660259809; x=1660346209; bh=5 81oZMKShZxT8Zn0zMTVJFcTkBUcW/2CxVH64DF0VuQ=; b=ruWSPI7GHkiJJtZH4 YQ14GNsFKLV1B/p+GrExipeGWDt6nU2munMqzAgANctH2saJFTmNv+9qqn7n7DRt yj6/To9gMxrkV6xAJ69EAAT6jmg0K5pmfCQ0K586DPJzvlm+L9FqVrCZx53bAWsq c3aqjGn3ohc3m6CEqcpX58nm/VDaLGNPIqB8oiiBZv/dAXN72VB2xHZNlx01Qy+1 3XWWBPjN0Vi1ngMF8aQt/cNzx+0St6g4Vdf+ELktsz9B8RSVhTZoeVWGSh3C+0Fv GWuClr51TgAOisHwT8JmBIhqAQ2faVVgaZxHUQRKjv5hA6tkXTYRDs4KWOedF9k5 KHQBQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrvdeghedgudelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhhrggfgsedtqhertdertddtnecuhfhrohhmpegkihcu jggrnhcuoeiiihdrhigrnhesshgvnhhtrdgtohhmqeenucggtffrrghtthgvrhhnpeegge ehudfgudduvdelheehteegledtteeiveeuhfffveekhfevueefieeijeegvdenucevlhhu shhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpeiiihdrhigrnhessh gvnhhtrdgtohhm X-ME-Proxy: Feedback-ID: iccd040f4:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 11 Aug 2022 19:16:49 -0400 (EDT) From: Zi Yan To: linux-mm@kvack.org Cc: David Hildenbrand , Matthew Wilcox , Vlastimil Babka , "Kirill A . Shutemov" , Mike Kravetz , John Hubbard , Yang Shi , David Rientjes , James Houghton , Mike Rapoport , linux-kernel@vger.kernel.org Subject: [RFC PATCH v2 07/12] virtio: virtio_balloon: use pageblock_order instead of MAX_ORDER Date: Thu, 11 Aug 2022 19:16:38 -0400 Message-Id: <20220811231643.1012912-8-zi.yan@sent.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220811231643.1012912-1-zi.yan@sent.com> References: <20220811231643.1012912-1-zi.yan@sent.com> Reply-To: Zi Yan MIME-Version: 1.0 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1660259810; a=rsa-sha256; cv=none; b=2ARd96ga9lO8pkXELjXGn9NVM0dx9DChcwQRezcyQd1GARsLLowIcEm4mYMgeNVk028Go8 HUzPJVs4dyYCdJdY3iNyxcXgpOC63QyT4muv24ea1JVuFx5vMT2MMIDtXJHnFeAwWyY+2I ME0u7uagiYhHmEyKwhqdtSp5tSelQ+U= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=sent.com header.s=fm1 header.b="m rs6vrb"; dkim=pass header.d=messagingengine.com header.s=fm1 header.b=ruWSPI7G; spf=pass (imf08.hostedemail.com: domain of zi.yan@sent.com designates 66.111.4.28 as permitted sender) smtp.mailfrom=zi.yan@sent.com; dmarc=pass (policy=none) header.from=sent.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1660259810; 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=aoUnxrKVb3aejKGLELTMktYQeUXTjqZhYCcnlzxh/zle9haC0g6WUO/o2kYgTepj+whFKl ddQLTMYDJS1bwIM8CyK/oFaZls7uYDspLDP69p1IaIRpisSNVqfsRaDQbrwYXM4wOMJGtL H8fVaLR+u0ts4gUAhdmQHTGfG4/+GNs= X-Stat-Signature: sacx13ks3pyd1nkr5xj8oj4w194efqiw X-Rspamd-Queue-Id: 2849F16019E X-Rspam-User: X-Rspamd-Server: rspam03 Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=sent.com header.s=fm1 header.b="m rs6vrb"; dkim=pass header.d=messagingengine.com header.s=fm1 header.b=ruWSPI7G; spf=pass (imf08.hostedemail.com: domain of zi.yan@sent.com designates 66.111.4.28 as permitted sender) smtp.mailfrom=zi.yan@sent.com; dmarc=pass (policy=none) header.from=sent.com X-HE-Tag: 1660259810-17532 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))