From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-188.mta0.migadu.com (out-188.mta0.migadu.com [91.218.175.188]) (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 5934E2472AF for ; Tue, 7 Apr 2026 02:07:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.188 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775527647; cv=none; b=arQ1UDflMNuH55QNNKqtfw8WYjkoCMqypMlOugxidB8HGBzmFkm1MsPJBaOkOvWg7x+kFGt1dq31dxVIvzasDNA/I21K9y6XiZvunEFl6qU9/FrnSNg542jRqv52EISnuZpl4JQXAlNL0+pw9ezx0wC8OUIieWyl0uv++hgdw4A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775527647; c=relaxed/simple; bh=Pjhk6LUKHjsHHuB6fH4UiZEHo0JdV0iYHOr9mLAUb70=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jkXYL2sD6QtZy6GL322wGR6Q0bTQqr15bD43b1/m0khJ51Uj7KGh4lzOq23Hp/4SiiUl880CGcj/fSBAd6lEVp2sNJKP25FjF+/kMaTHllIwxfGv8f/jjK4s2ld/eeqJbQPLn3N5aFs3q0nXQvwp9DqAoimenQg7hUC9s1/+09o= 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=tpv/V9Oh; arc=none smtp.client-ip=91.218.175.188 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="tpv/V9Oh" 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=1775527643; 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=zRD8drmtpvaW7u3AYnxWKE0WjDJmYymOaFuTOH+P7/E=; b=tpv/V9OhtXG+sz+yP/JXKIRCAbpUWZiZgB7x8rqWKeZAHQ6gfzAkkT6WJ+sPC6ptxvLvfk oXuMjV/AaBjJGbQaTJ5Opr3UBxDrUzl4fmd+HgXyqBgeRbYm5q6d99xwrt/bkIHLcuO31A Eu/AUJB7q0+MPlYsjjRXkOizm7OQhWw= From: Ye Liu To: Miaohe Lin , Andrew Morton Cc: Ye Liu , Naoya Horiguchi , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] mm/memory_failure: use bool for hugetlb indicator in try_memory_failure_hugetlb Date: Tue, 7 Apr 2026 10:07:12 +0800 Message-ID: <20260407020715.2269255-2-ye.liu@linux.dev> In-Reply-To: <20260407020715.2269255-1-ye.liu@linux.dev> References: <20260407020715.2269255-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: 8bit X-Migadu-Flow: FLOW_OUT From: Ye Liu The hugetlb indicator in try_memory_failure_hugetlb is a Boolean flag, but was declared and assigned as int/0/1. Convert to `bool` and `true`/`false` for clarity and type safety. - try_memory_failure_hugetlb(unsigned long pfn, int flags, bool *hugetlb) - testcase path in memory_failure(): bool hugetlb = false - clear semantic conversion in MF_HUGETLB_NON_HUGEPAGE - preserve behavior (no functional change) Signed-off-by: Ye Liu --- mm/memory-failure.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mm/memory-failure.c b/mm/memory-failure.c index ee42d4361309..d25adb390c3e 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c @@ -2032,7 +2032,7 @@ int __get_huge_page_for_hwpoison(unsigned long pfn, int flags, * -EHWPOISON - folio or exact page already poisoned * -EFAULT - kill_accessing_process finds current->mm null */ -static int try_memory_failure_hugetlb(unsigned long pfn, int flags, int *hugetlb) +static int try_memory_failure_hugetlb(unsigned long pfn, int flags, bool *hugetlb) { int res, rv; struct page *p = pfn_to_page(pfn); @@ -2040,12 +2040,12 @@ static int try_memory_failure_hugetlb(unsigned long pfn, int flags, int *hugetlb unsigned long page_flags; bool migratable_cleared = false; - *hugetlb = 1; + *hugetlb = true; retry: res = get_huge_page_for_hwpoison(pfn, flags, &migratable_cleared); switch (res) { case MF_HUGETLB_NON_HUGEPAGE: /* fallback to normal page handling */ - *hugetlb = 0; + *hugetlb = false; return 0; case MF_HUGETLB_RETRY: if (!(flags & MF_NO_RETRY)) { @@ -2107,7 +2107,7 @@ static int try_memory_failure_hugetlb(unsigned long pfn, int flags, int *hugetlb } #else -static inline int try_memory_failure_hugetlb(unsigned long pfn, int flags, int *hugetlb) +static inline int try_memory_failure_hugetlb(unsigned long pfn, int flags, bool *hugetlb) { return 0; } @@ -2347,7 +2347,7 @@ int memory_failure(unsigned long pfn, int flags) int res = 0; unsigned long page_flags; bool retry = true; - int hugetlb = 0; + bool hugetlb = false; if (!sysctl_memory_failure_recovery) panic("Memory failure on page %lx", pfn); -- 2.43.0