From nobody Wed Dec 17 08:51:02 2025 Received: from out-182.mta0.migadu.com (out-182.mta0.migadu.com [91.218.175.182]) (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 43F6B70820 for ; Fri, 21 Mar 2025 01:07:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742519257; cv=none; b=Fj7OuEVoQdZ7Gnbh8K7k+EcjTJYN7DIgAxLKOJjtFqBEVfaXSXp49wjiiUlITr7cYWLqX+RjW8Tvl/q5C5GRhShobtHviDik87UlShvYl+ug6zl0v4+mobTnTXEDf5A9J05kIQBhFVFOCgjGihaylQ8kJefX7reHc5Jo8Q0XG0w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742519257; c=relaxed/simple; bh=VRRD680Q0kY20yZCwa56JFW69JF1rSXwfZpD+Pr+sQI=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=SxUu9ac7ILxKd9nxKnxDcAessPm0oeywxQBNxqmqtHPs53zmXg7WH2/H/6gGIagCA5oF5vAnXGAo9pSCF0oe9gp7OOIlRAKVIGurLMap53dxCyBLht6hcPd/RwZGykCX0IReNgPVroZrlbOlZASElLpKdgI/QWzwj8W1f1bJSy4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=X4NCCT0m; arc=none smtp.client-ip=91.218.175.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="X4NCCT0m" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1742519252; 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; bh=oKv6kzy1r+Z2q8HbnIAwNuqiBX6WfkJJspdk8MGx/EI=; b=X4NCCT0m8yVvPld4nR2v3PrMAh/pWqGGO2LAre9fM6HvqDvhs10jYFX4g5rYhzo31QE3vo Y0MGnqlrirEqMC0XiBcQmpdT6hRm1LBy2P+jmk/i7fnsP7zXcyUifvAs7LzIBarOsSa17w GRhtc+Aof101ORw++Q4QTnlxZm7RE/E= From: Ye Liu To: akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Ye Liu Subject: [PATCH] mm/page_alloc: Simplify free_page_is_bad by removing free_page_is_bad_report Date: Fri, 21 Mar 2025 09:07:10 +0800 Message-Id: <20250321010710.548105-1-ye.liu@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" From: Ye Liu This patch refactors the free_page_is_bad function by directly calling bad_page() instead of using the intermediary function free_page_is_bad_report(). The removal of free_page_is_bad_report() reduces unnecessary indirection, making the code cleaner and easier to read. The functionality remains the same, as free_page_is_bad_report() was merely a wrapper for the bad_page() call. The patch also improves maintainability by reducing the function call depth. Signed-off-by: Ye Liu Reviewed-by: Anshuman Khandual --- mm/page_alloc.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 61d6a3b1b286..2842da893eea 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -933,19 +933,14 @@ static const char *page_bad_reason(struct page *page,= unsigned long flags) return bad_reason; } =20 -static void free_page_is_bad_report(struct page *page) -{ - bad_page(page, - page_bad_reason(page, PAGE_FLAGS_CHECK_AT_FREE)); -} - static inline bool free_page_is_bad(struct page *page) { if (likely(page_expected_state(page, PAGE_FLAGS_CHECK_AT_FREE))) return false; =20 /* Something has gone sideways, find it */ - free_page_is_bad_report(page); + bad_page(page, + page_bad_reason(page, PAGE_FLAGS_CHECK_AT_FREE)); return true; } =20 --=20 2.25.1