From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from canpmsgout02.his.huawei.com (canpmsgout02.his.huawei.com [113.46.200.217]) (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 AAAF720DD51 for ; Thu, 14 May 2026 02:34:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=113.46.200.217 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778726075; cv=none; b=hWjW77Bh67FNQnqEp7jozFbeusI95J3wkzhDiYidMjTuhy1uNcUCq9QNPsA+vRaFt0HOA2B7FaNr1ZpKjySh/YkSGbk6INH4RSAcBMqHp7DS+/cjRhRBUlyJ4iPS01v4a7A6T7B7aRui7HvWjfpky+2QUBmz+xo0z/2kLf45Uak= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778726075; c=relaxed/simple; bh=tMYVqVuYeHbrg/rcK9opB5yNGXpi/BDihrJM5xsXmTI=; h=Subject:To:CC:References:From:Message-ID:Date:MIME-Version: In-Reply-To:Content-Type; b=aTR37EIu0fKUbrDGPXDp231ml+aWOL4CUXmji/pjA6wNOpusAsHmp3fujjGueecBNxRnJ/drFiVmNtpBF9mYDhSDRkUvz9I99an0OxBfNlJiWcTqTzVJdsuSl5rymrd8au9NAQZMQy0X5Pk6uXcg+gZjHn4+nxuH//6CrBDHJTo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b=PvRk2BIN; arc=none smtp.client-ip=113.46.200.217 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b="PvRk2BIN" dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=boc/tXm2SaLDDUgOlirebYOcZ1PigGu0D7lf30tmB0s=; b=PvRk2BINp9atYeg2WEmXPi+ds83uDczKFcS1KT3SFbhVxVviESY7jkHKoSxeo6VO4/7TQvjNk KJbriMyOU2DR78iaTHo9aolNg9J6vL0CbzBPsXXnw/n9MZmIFYUDmhYWXWLUaCjEvhqIVwb/RtW RMeGoBNtcxN+u3qpaoAbiA4= Received: from mail.maildlp.com (unknown [172.19.163.104]) by canpmsgout02.his.huawei.com (SkyGuard) with ESMTPS id 4gGDk30W26zcbP4; Thu, 14 May 2026 10:27:07 +0800 (CST) Received: from dggemv706-chm.china.huawei.com (unknown [10.3.19.33]) by mail.maildlp.com (Postfix) with ESMTPS id AC4114048F; Thu, 14 May 2026 10:34:29 +0800 (CST) Received: from kwepemq500010.china.huawei.com (7.202.194.235) by dggemv706-chm.china.huawei.com (10.3.19.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Thu, 14 May 2026 10:34:29 +0800 Received: from [10.173.124.160] (10.173.124.160) by kwepemq500010.china.huawei.com (7.202.194.235) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Thu, 14 May 2026 10:34:28 +0800 Subject: Re: [RESEND PATCH] mm/memory_failure: use bool for hugetlb indicator in try_memory_failure_hugetlb To: Oscar Salvador , Ye Liu CC: Andrew Morton , Ye Liu , Naoya Horiguchi , , References: <20260513024853.65566-1-ye.liu@linux.dev> From: Miaohe Lin Message-ID: Date: Thu, 14 May 2026 10:34:28 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-ClientProxiedBy: kwepems500002.china.huawei.com (7.221.188.17) To kwepemq500010.china.huawei.com (7.202.194.235) On 2026/5/13 16:38, Oscar Salvador wrote: > On Wed, May 13, 2026 at 02:50:56PM +0800, Ye Liu wrote: >>> -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) >>> { >>> return 0; >>> } >>> @@ -2386,8 +2385,11 @@ int memory_failure(unsigned long pfn, int flags) >>> } >>> >>> try_again: >>> - res = try_memory_failure_hugetlb(pfn, flags, &hugetlb); >>> - if (hugetlb) >>> + res = try_memory_failure_hugetlb(pfn, flags); >>> + /* >>> + * -ENOENT means the page we found is not hugetlb, so proceed with normal page handling >>> + */ >>> + if (res != -ENOENT) >>> goto unlock_mutex; >>> >>> if (TestSetPageHWPoison(p)) { >>> >>> >> >> >> Hi Oscar, >> >> Good point. Using -ENOENT to distinguish "not a hugetlb page" from >> "hugetlb handled" is indeed cleaner than carrying an extra output >> parameter. >> >> One thing to note: the #else stub when CONFIG_HUGETLB_PAGE is not set >> currently does: >> >> return 0; >> >> which with your change would mean "hugetlb handled, skip normal path" >> instead of the intended "not hugetlb, proceed with normal handling". >> It should be changed to: >> >> return -ENOENT; > > Right, let us see if Miaohe sees any issue with that approach. This should work for me. Thanks both.