From patchwork Tue Mar 26 17:10:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13604746 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 80609C6FD1F for ; Tue, 26 Mar 2024 17:11:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BA59F6B00A2; Tue, 26 Mar 2024 13:10:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9671D6B00A5; Tue, 26 Mar 2024 13:10:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 800686B00A4; Tue, 26 Mar 2024 13:10:55 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 47BA76B00A3 for ; Tue, 26 Mar 2024 13:10:55 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 11B68A09F0 for ; Tue, 26 Mar 2024 17:10:55 +0000 (UTC) X-FDA: 81939830070.22.1B26362 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf18.hostedemail.com (Postfix) with ESMTP id 5A1E71C0009 for ; Tue, 26 Mar 2024 17:10:53 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=ScIc0uVT; dmarc=none; spf=none (imf18.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1711473053; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=RMKKjvj0inVCJhorJ4shbO4waA45G/h+x3MvxIXNfzc=; b=I1oxfB8Et3ePqRCznk2u5N3Lpb08jl3h8tnfSmb7dc3YSbWnwmva8rahPH8Mp9pbohVhzj T8HVlipejdUVdgoQEIax4JSr+PQECC0v7RXyVaKI4nTXuXtUfjHfQKUh1DtmEAlsXWpyf5 f8YvbMaE+kd5Ji0NEbGoFf8lxjriQps= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=ScIc0uVT; dmarc=none; spf=none (imf18.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1711473053; a=rsa-sha256; cv=none; b=d/Hz03XISN4ntTVmkqcQMiC6fLsqXBlioBxkG/8d3LCXHTA8SKaWU79CzTGpR0RfFHku0k w/lrjkzAIuI1nGwMQPuowtR/JR7k3MvqkYB4KjmY5lTLWAy0i/UZfoxLXHC/ZhdsKuGfQd rY2TRTwjmFDL116f2BbfLw63lP+zccc= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=RMKKjvj0inVCJhorJ4shbO4waA45G/h+x3MvxIXNfzc=; b=ScIc0uVTqU6nBWoa/ushFmAet+ C53qGOdSfW9E7mbpJoXBpaSA7QplOtpecp+dvw0i25PfCwXOemYwZCeyLwKAnt/Aw73smpddln80c TNwX9EnYBnxjGlApS5cXIpkdlS1rvaQFCwa86tiH0wcKsaN9iX+gtySjuCxEYtteIYOAIHOhZIyND Qusx9FpDxB/iEzAyxs6pnKwpmiJb39DKYAh55LmazHrKxHk8WdgmSOXbBvotUVKWpJmfwVN9P7WUF brtjX1sg8a8mFAR8j3VR426YDqnI+rPec2ZKeKtzFN6bpewPmuEmmbnRUYF0x6LiKA/CdX58hF7gA nDn5XlqQ==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rpAK0-00000001isF-0nEZ; Tue, 26 Mar 2024 17:10:48 +0000 From: "Matthew Wilcox (Oracle)" To: Andrew Morton Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org Subject: [PATCH 05/10] mm: Make is_free_buddy_page() take a const argument Date: Tue, 26 Mar 2024 17:10:27 +0000 Message-ID: <20240326171045.410737-6-willy@infradead.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240326171045.410737-1-willy@infradead.org> References: <20240326171045.410737-1-willy@infradead.org> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 5A1E71C0009 X-Stat-Signature: soenwz4wsxah1jkatpoqy4eprezx9qun X-HE-Tag: 1711473053-257633 X-HE-Meta: U2FsdGVkX19ZwUMNM3Q4RcTvhPTXB7O3yHdB8czlGk1V5DELngvPRqtYfdWdIzcQs2s21w29h1VRHwQ8RmYN31j1as0LfnsFMdB3X+hj22QE+QzJS2eK2Jt+PEKEM1oauVvC0jJt620LXCaDSGvw9oq3a/aB8dskfzvRcsVST+OFYbYk4NzUuxTLw2/kmVMfHdsDBvh/q3cYKNicO1vlpQnhcx8lsl+lutDaUxnmork9meBKuJGLktU6yVn6ga6gvCVv63dqqWofzswcJsZuRdYk4fxju+nycHNtNPGuNl+XO2ZMb3cj018Fwi88WFClJn5lWwibV+WP5C0PsJbQryjIuSVahzQ/MR8tBr5igJ7ZZO0/TACOEULMWgtpHZAImUSRbZ+X2j4ir93FBAEcmu0GLnU1hqurrWD392leJlhdQ9hs30o94+akKDPQHBC7yCxF+5eIS3TAcpWBL3et+kWbA/tpfl8JUKwHMOJsqSsHfG3NvkDlWoK7or23AJpLkKrAcgnP8yNeMIzgre0dSfMMLTJwrXXU54vdQ1ltK3yONgtiACxKRWTzRBL+VEaYCBZV/mrqDUFT/ai9/mqq125dafmwOqk08O/tz34jXjaSI7jHRcIQK2OTvybopZtroG0746As5Cqvexqt0IgHRptd/lURZY758a/LOGQpphXaoNvtRFhRf3s33Vw9KlPK4IgGm2oYQLexIbatKC2be5QHRqI4V6x2SoUnb6qrYYhazmyn3JwbFJtwEJu1D5TrlLICq1bMIp+EvVJW0on0Sj1V6z8MRraPRzraACrzZ0GJRo6ljJ/S61BggC0R/Pzcer7DHN0p8OGf/gyoiXKdWsHNAgjDX21vm6XTi1twSMK3IRLW5doqYB7Dyj+NqnpivG4sXgt3m9B4Vov+262SczWxCeoGQJMv4q5BLwqEK3rYJJDwSFc9lf1EmNcvu0GfDYBQwFTrVeEd+GIaID1 V1lZ9ZbS FwAB0WKGVsCd7RHGRlpKrRXMK9tpMgBAog7cUZs6eNRN7l0Ht1c3RPAZeidZyuIbck1cRLYq6/c0NTj1rCIpyXbS02GHTeLGOt9ThMoaeJp215A2SZwrc4g/5zWSYh0up4FO/Zlb+9e8wH/ncADWo8nTORC6Tc+i9fj3MtLmW6u6ppAV2VPiEh/sX1Px8EHIr1Ab9nlcNOjx+GuxklCBk11qsNnVAu95e9U51 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: List-Subscribe: List-Unsubscribe: This function does not modify its argument; let the callers know that so they can make better optimisation decisions. Signed-off-by: Matthew Wilcox (Oracle) --- include/linux/page-flags.h | 2 +- mm/page_alloc.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index 0163d6da6283..eaecf544039f 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h @@ -1088,7 +1088,7 @@ static inline bool is_page_hwpoison(const struct page *page) return folio_test_hugetlb(folio) && PageHWPoison(&folio->page); } -extern bool is_free_buddy_page(struct page *page); +bool is_free_buddy_page(const struct page *page); PAGEFLAG(Isolated, isolated, PF_ANY); diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 370ea1711828..a00a2d7d8d9f 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -6786,16 +6786,16 @@ void __offline_isolated_pages(unsigned long start_pfn, unsigned long end_pfn) /* * This function returns a stable result only if called under zone lock. */ -bool is_free_buddy_page(struct page *page) +bool is_free_buddy_page(const struct page *page) { unsigned long pfn = page_to_pfn(page); unsigned int order; for (order = 0; order < NR_PAGE_ORDERS; order++) { - struct page *page_head = page - (pfn & ((1 << order) - 1)); + const struct page *head = page - (pfn & ((1 << order) - 1)); - if (PageBuddy(page_head) && - buddy_order_unsafe(page_head) >= order) + if (PageBuddy(head) && + buddy_order_unsafe(head) >= order) break; }