Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CF4182F4315 for ; Fri, 4 Jul 2025 10:26:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751624815; cv=none; b=F/2D+f58OL5JrZxJQIRq1qpYlvfXhqUMb5ekDdh6n4ORbfwFVWfFxmAT/tywFF8PsIWOC8rYiK7MIV9JNlXPKlBzffpBS7f1D/nbCwzKdSGXzVtdIblJT0lS3bXeAtYZZfzAFWtCFmCnItisroNB27glL0KkThtxT+bRWGU9Gbg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751624815; c=relaxed/simple; bh=EzLnGXHkuZsrbU+9yZ2bD2FaU0ugKSCfE5X54vg+vxA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JrVWixXRdUBRFU2fDr/LMMM8kas9+nrKGpmyIukYzUm1OqiHhcN9JEE77/Ax2y4B4gm3+fbyDRK6KVZ+17VLamJIXfYNWd9gqP1g5tD+IYt11iHsb7fuIs4H48FH9pnQVZmez9TVCURvFvFfobcGEfQQqAXWmFhzR4vgYuemg1I= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=P014qAOk; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="P014qAOk" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1751624813; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DAmNizoml8pi0FWiSRf1K1mTve+PnYDWvVyOK7ajbGc=; b=P014qAOkJlUfYr04lPdthrKeMr++R8BP4fJdDt1RxB2mTfI5FRS+S2ix3mZYRTibPl3alJ RDKX22vTjwXsQ2y545mFgxNv5lyINTrb0Nm75370OR1Dgh3FoERLVABHsDRsKPTou9mcqj O8NnTFgmHKzMhtyUguTRD9dNpVym45k= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-686-8i4p9lRfPnmR8PFAuzLc5Q-1; Fri, 04 Jul 2025 06:26:51 -0400 X-MC-Unique: 8i4p9lRfPnmR8PFAuzLc5Q-1 X-Mimecast-MFC-AGG-ID: 8i4p9lRfPnmR8PFAuzLc5Q_1751624810 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-3a523ce0bb2so367458f8f.0 for ; Fri, 04 Jul 2025 03:26:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751624810; x=1752229610; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DAmNizoml8pi0FWiSRf1K1mTve+PnYDWvVyOK7ajbGc=; b=PnPVkIY7vEbJ2/XwlqbBMZgHh0fRMgt0e23RNT2KuuI0N0J7hRHsnT2l5JlHRyaV6b +5Zhu/FrqVAHyhs09pxt9LVoLyklZKUZTs0d3jMlFYD5b93NaMKaHxnruCvOESoWYV1l 99/o2WUwCJfARuS014fQCO6PNMXzBSIo2kx+368z4LVYmXLPhdzHPkGCccaLR1rcyTZr pSWuBTOqZgOigVO/axNZIL/f532wRG+rEi9dH42FREZfBy/0o5j8eZiSTO1TMVirTLeo nPcGXnnxedIpMRIbHSjl69ZxAWN+JqOjJbiY65mwI5EyZ9Pk6FiHEJ4pk9R4l+sb/72Y rrTw== X-Forwarded-Encrypted: i=1; AJvYcCVfh982zAEBpXZBLErr2+fOqYgfq8r0HeTrrLpJXqgtEBp1tUQFGYgRhUVnoKZ7vd3AcKxJxMn8dtk=@vger.kernel.org X-Gm-Message-State: AOJu0YyGStfN/dmh23qGF5DH9iZ/20XjzxjtXsNajcYKlnua/2yzUUk8 dx9fxuyp+nxSsZc0j43VZrWZcltKJ9+XGZUvErnqwgf4qMu/ukwM1wIBFb0MfuDXjj85OtYEYcE X2TGIaln3pMHJrAdcD1YXtF2oZykfe5EDvxeS6j5YJLZg4jQJ5WdzKNYA5TrHtw== X-Gm-Gg: ASbGnct1RfPoGfq6jbTWJwhaSTnz9sTTtww6vGoSFePzo6PtN838HTy2tG5u94iO0nQ u7jDFLVn9cA7NcxLMDnENdNUiwYU86SHOyVM7aWM/cm3VadUlrGbdO+ZVulOg3oEQGTcH01Q1hq I/YwVbxmQn+RlFRdePmJC33wKFARSDg1Wl5CBOAa26m3zqtjGpIT6NjpmGBxYZVIAOQNhtv29+9 lSP8Z7wDRIGUPexGf0R45DgjN/tlt5IKj4jDCKIXfDrJ8Yl7DM6+MeT+xkoc5G9nB4dVagmSAav 9uXmx4DLJ5tAVi66yrHC7nP1qsiWPqJvYDbLN+x622W0bvQfxgCrwf9Ly2sDLeP1TiA7LGaC+dW U7p4RLw== X-Received: by 2002:a05:6000:2906:b0:3a6:e2d5:f14c with SMTP id ffacd0b85a97d-3b4970294bamr1229491f8f.30.1751624810311; Fri, 04 Jul 2025 03:26:50 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGU9MKO4L2eImwXLAzlEGTAbbgXQLTQHWpn061Frnhroy+xSoAIVNW9jaIe3vRaTd6Fz7itPA== X-Received: by 2002:a05:6000:2906:b0:3a6:e2d5:f14c with SMTP id ffacd0b85a97d-3b4970294bamr1229434f8f.30.1751624809815; Fri, 04 Jul 2025 03:26:49 -0700 (PDT) Received: from localhost (p200300d82f2c5500098823f9faa07232.dip0.t-ipconnect.de. [2003:d8:2f2c:5500:988:23f9:faa0:7232]) by smtp.gmail.com with UTF8SMTPSA id ffacd0b85a97d-3b47030bc5asm2113887f8f.20.2025.07.04.03.26.47 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 04 Jul 2025 03:26:49 -0700 (PDT) From: David Hildenbrand To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, linux-doc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, virtualization@lists.linux.dev, linux-fsdevel@vger.kernel.org, David Hildenbrand , Andrew Morton , Jonathan Corbet , Madhavan Srinivasan , Michael Ellerman , Nicholas Piggin , Christophe Leroy , Jerrin Shaji George , Arnd Bergmann , Greg Kroah-Hartman , "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , =?UTF-8?q?Eugenio=20P=C3=A9rez?= , Alexander Viro , Christian Brauner , Jan Kara , Zi Yan , Matthew Brost , Joshua Hahn , Rakie Kim , Byungchul Park , Gregory Price , Ying Huang , Alistair Popple , Lorenzo Stoakes , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , "Matthew Wilcox (Oracle)" , Minchan Kim , Sergey Senozhatsky , Brendan Jackman , Johannes Weiner , Jason Gunthorpe , John Hubbard , Peter Xu , Xu Xin , Chengming Zhou , Miaohe Lin , Naoya Horiguchi , Oscar Salvador , Rik van Riel , Harry Yoo , Qi Zheng , Shakeel Butt Subject: [PATCH v2 29/29] mm/balloon_compaction: provide single balloon_page_insert() and balloon_mapping_gfp_mask() Date: Fri, 4 Jul 2025 12:25:23 +0200 Message-ID: <20250704102524.326966-30-david@redhat.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250704102524.326966-1-david@redhat.com> References: <20250704102524.326966-1-david@redhat.com> Precedence: bulk X-Mailing-List: linux-doc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Let's just special-case based on IS_ENABLED(CONFIG_BALLOON_COMPACTION) like we did for balloon_page_finalize(). Reviewed-by: Lorenzo Stoakes Signed-off-by: David Hildenbrand --- include/linux/balloon_compaction.h | 42 +++++++++++------------------- 1 file changed, 15 insertions(+), 27 deletions(-) diff --git a/include/linux/balloon_compaction.h b/include/linux/balloon_compaction.h index 2fecfead91d26..7cfe48769239e 100644 --- a/include/linux/balloon_compaction.h +++ b/include/linux/balloon_compaction.h @@ -77,6 +77,15 @@ static inline void balloon_devinfo_init(struct balloon_dev_info *balloon) #ifdef CONFIG_BALLOON_COMPACTION extern const struct movable_operations balloon_mops; +/* + * balloon_page_device - get the b_dev_info descriptor for the balloon device + * that enqueues the given page. + */ +static inline struct balloon_dev_info *balloon_page_device(struct page *page) +{ + return (struct balloon_dev_info *)page_private(page); +} +#endif /* CONFIG_BALLOON_COMPACTION */ /* * balloon_page_insert - insert a page into the balloon's page list and make @@ -91,41 +100,20 @@ static inline void balloon_page_insert(struct balloon_dev_info *balloon, struct page *page) { __SetPageOffline(page); - SetPageMovableOps(page); - set_page_private(page, (unsigned long)balloon); - list_add(&page->lru, &balloon->pages); -} - -/* - * balloon_page_device - get the b_dev_info descriptor for the balloon device - * that enqueues the given page. - */ -static inline struct balloon_dev_info *balloon_page_device(struct page *page) -{ - return (struct balloon_dev_info *)page_private(page); -} - -static inline gfp_t balloon_mapping_gfp_mask(void) -{ - return GFP_HIGHUSER_MOVABLE; -} - -#else /* !CONFIG_BALLOON_COMPACTION */ - -static inline void balloon_page_insert(struct balloon_dev_info *balloon, - struct page *page) -{ - __SetPageOffline(page); + if (IS_ENABLED(CONFIG_BALLOON_COMPACTION)) { + SetPageMovableOps(page); + set_page_private(page, (unsigned long)balloon); + } list_add(&page->lru, &balloon->pages); } static inline gfp_t balloon_mapping_gfp_mask(void) { + if (IS_ENABLED(CONFIG_BALLOON_COMPACTION)) + return GFP_HIGHUSER_MOVABLE; return GFP_HIGHUSER; } -#endif /* CONFIG_BALLOON_COMPACTION */ - /* * balloon_page_finalize - prepare a balloon page that was removed from the * balloon list for release to the page allocator -- 2.49.0