From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-173.mta0.migadu.com (out-173.mta0.migadu.com [91.218.175.173]) (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 A406B3603C3 for ; Wed, 13 May 2026 02:49:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778640547; cv=none; b=doFdwJ5bjSLDEvl5KFgN3u/Kq76ArkNbTAIglL61MD9FKORiiS6/MPBh3z51FO1MybMLOuZl0u3Gsd8y292Wpp5qTghjkaTwRznCe562DxksP4r6jHg3OHW/4uvs/1EEeHDTeb05K7ezpnDSDuri95vS4+FqPsAUwtq07AyNVwo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778640547; c=relaxed/simple; bh=vxAMKOCNJuDC8AC1RH2OSCg4qpYFPmYiqxhJtSswCMs=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=SCOlIoEbe3FvWWrK99oXLb+Y25QGNFSgaFWiQ9oo3VeU+BJtmiGG9jPEC9/vA8aLBt3CoecLeiUIFowOQfx+KstnLFi22ORyuZx9vmvDEtPq9L9PBMBioX1jr7ydBxzP5OtxFNSXa/uwfV3F15hAxuPNnNhiexiesMTQO1BX2jM= 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=aN51modi; arc=none smtp.client-ip=91.218.175.173 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="aN51modi" 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=1778640542; 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=ac+/09xni07WMR4KrujX3u+mPbI/ECBXE+1EPYxqsnM=; b=aN51modiINYEaGl+Id/b9+bp1r9lQEMHBEwSjWK1N6qX3ZxKpcg16PMRjDc2wcrvctw3Xj T3xfOBN5yGMOsc8CnOzfn8rXK8AUm6V+/KtmymliF+SpEBspSqMX3sAYVWS5/WrEg6uoGg L9Nqk/diP3bun0h8H4NPHMB7ymKRSy8= From: Ye Liu To: Miaohe Lin , Andrew Morton Cc: Ye Liu , Naoya Horiguchi , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [RESEND PATCH] mm/memory_failure: use bool for hugetlb indicator in try_memory_failure_hugetlb Date: Wed, 13 May 2026 10:48:52 +0800 Message-ID: <20260513024853.65566-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 Acked-by: Miaohe Lin --- 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 866c4428ac7e..f164fc5959f0 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