From patchwork Tue Jan 7 08:17:34 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuai Xue X-Patchwork-Id: 13928413 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 4627AE77198 for ; Tue, 7 Jan 2025 08:17:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C6C4A8D0005; Tue, 7 Jan 2025 03:17:52 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id BF64A8D0001; Tue, 7 Jan 2025 03:17:52 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A206F8D0005; Tue, 7 Jan 2025 03:17:52 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 3D2988D0001 for ; Tue, 7 Jan 2025 03:17:52 -0500 (EST) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id D6C401407A7 for ; Tue, 7 Jan 2025 08:17:51 +0000 (UTC) X-FDA: 82979952342.14.257A10A Received: from out30-130.freemail.mail.aliyun.com (out30-130.freemail.mail.aliyun.com [115.124.30.130]) by imf03.hostedemail.com (Postfix) with ESMTP id C065D20007 for ; Tue, 7 Jan 2025 08:17:49 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=linux.alibaba.com header.s=default header.b="bAJZH/1r"; dmarc=pass (policy=none) header.from=linux.alibaba.com; spf=pass (imf03.hostedemail.com: domain of xueshuai@linux.alibaba.com designates 115.124.30.130 as permitted sender) smtp.mailfrom=xueshuai@linux.alibaba.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1736237870; a=rsa-sha256; cv=none; b=Skn1FxU7q/gOg0JUXnDt94viHSkCoXqjtlkVJpnW3OqWZRitVFr82EEPJ0eMEqqbGL+Yw+ jXaVF/G277FAr/faIU/IMMJ3jATXCIq321SMNq+QmxJQG87AV11ei1ZqAr07T6zM+Azvx1 0hRzDYOxNaZIxodg5MbviwKo/WNTDws= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=linux.alibaba.com header.s=default header.b="bAJZH/1r"; dmarc=pass (policy=none) header.from=linux.alibaba.com; spf=pass (imf03.hostedemail.com: domain of xueshuai@linux.alibaba.com designates 115.124.30.130 as permitted sender) smtp.mailfrom=xueshuai@linux.alibaba.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1736237870; 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=fuOOqQ61+VArG3go1uLMFptm6dU/o8SC/xzK+2tkgc4=; b=jfUjf8D913Rccw15ZDnsi6HDNMiulUiCSIvGz11dV/PdSmmydM8K1uKeOuGPGswJPdoewa mE0l9R2ZV7NcQaBWUjPS7OatSlkY/BRVo3vCM0+3znUN7gU2jFTmNUwrgnJi5dO6+TWlq3 RmNHUQq6RiPBg537rqv62a8RmkZZZ/Q= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1736237866; h=From:To:Subject:Date:Message-ID:MIME-Version; bh=fuOOqQ61+VArG3go1uLMFptm6dU/o8SC/xzK+2tkgc4=; b=bAJZH/1rJZWXvaQGt9u7MOF82uMU5bkbFA1Owjj6xgil7dxuSDLFU4viv+NwDf7WfGz5AP09tRGBI7IbXDwYnRgZ5dB/b5YtY03m7EZozmaRXdR4x8xrWErkmwC+H0Igq64GmmcKC6uSmvCBbZpH572CxUdALAAA88VnOD5oYgI= Received: from localhost.localdomain(mailfrom:xueshuai@linux.alibaba.com fp:SMTPD_---0WNA-B4H_1736237862 cluster:ay36) by smtp.aliyun-inc.com; Tue, 07 Jan 2025 16:17:43 +0800 From: Shuai Xue To: yazen.ghannam@amd.com, mark.rutland@arm.com, catalin.marinas@arm.com, mingo@redhat.com, robin.murphy@arm.com, Jonathan.Cameron@Huawei.com, bp@alien8.de, rafael@kernel.org, linux-arm-kernel@lists.infradead.org, wangkefeng.wang@huawei.com, tanxiaofei@huawei.com, mawupeng1@huawei.com, tony.luck@intel.com, linmiaohe@huawei.com, naoya.horiguchi@nec.com, james.morse@arm.com, tongtiangen@huawei.com, gregkh@linuxfoundation.org, will@kernel.org, jarkko@kernel.org Cc: linux-acpi@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, akpm@linux-foundation.org, linux-edac@vger.kernel.org, x86@kernel.org, xueshuai@linux.alibaba.com, justin.he@arm.com, ardb@kernel.org, ying.huang@linux.alibaba.com, ashish.kalra@amd.com, baolin.wang@linux.alibaba.com, tglx@linutronix.de, dave.hansen@linux.intel.com, lenb@kernel.org, hpa@zytor.com, robert.moore@intel.com, lvying6@huawei.com, xiexiuqi@huawei.com, zhuo.song@linux.alibaba.com Subject: [PATCH v18 2/3] mm: memory-failure: move return value documentation to function declaration Date: Tue, 7 Jan 2025 16:17:34 +0800 Message-ID: <20250107081735.16159-3-xueshuai@linux.alibaba.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20250107081735.16159-1-xueshuai@linux.alibaba.com> References: <20250107081735.16159-1-xueshuai@linux.alibaba.com> MIME-Version: 1.0 X-Stat-Signature: 5oncxbogr3rtezhsui4n1xtpkdoay7x7 X-Rspam-User: X-Rspamd-Queue-Id: C065D20007 X-Rspamd-Server: rspam08 X-HE-Tag: 1736237869-508877 X-HE-Meta: U2FsdGVkX18m5z7foYAj1ugKO8KRe6gEvVMQtkPH0zcZgk9BQbX3nk7JUitGcArLjjiIpThffh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+T6c3TqDYsSG+uVxdK45NrUuPLU7CYtT39FdeUMdKSFWmLY4VdHhG38tkschXraiRZsgJ8/JFq2ibXN3K+vv8u0860W57Rn6dGMvhzuakM08OrGz61m/suC8r9yPeuDF9YgPn9BIuYHY+eAj 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: Part of return value comments for memory_failure() were originally documented at the call site. Move those comments to the function declaration to improve code readability and to provide developers with immediate access to function usage and return information. Signed-off-by: Shuai Xue Reviewed-by: Jarkko Sakkinen Reviewed-by: Jonathan Cameron Reviewed-by: Yazen Ghannam Reviewed-by: Jane Chu --- arch/x86/kernel/cpu/mce/core.c | 7 ------- mm/memory-failure.c | 10 +++++++--- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/arch/x86/kernel/cpu/mce/core.c b/arch/x86/kernel/cpu/mce/core.c index 7fb5556a0b53..d1dd7f892514 100644 --- a/arch/x86/kernel/cpu/mce/core.c +++ b/arch/x86/kernel/cpu/mce/core.c @@ -1398,13 +1398,6 @@ static void kill_me_maybe(struct callback_head *cb) return; } - /* - * -EHWPOISON from memory_failure() means that it already sent SIGBUS - * to the current process with the proper error info, - * -EOPNOTSUPP means hwpoison_filter() filtered the error event, - * - * In both cases, no further processing is required. - */ if (ret == -EHWPOISON || ret == -EOPNOTSUPP) return; diff --git a/mm/memory-failure.c b/mm/memory-failure.c index a7b8ccd29b6f..14c316d7d38d 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c @@ -2211,9 +2211,13 @@ static void kill_procs_now(struct page *p, unsigned long pfn, int flags, * Must run in process context (e.g. a work queue) with interrupts * enabled and no spinlocks held. * - * Return: 0 for successfully handled the memory error, - * -EOPNOTSUPP for hwpoison_filter() filtered the error event, - * < 0(except -EOPNOTSUPP) on failure. + * Return: + * 0 - success, + * -ENXIO - memory not managed by the kernel + * -EOPNOTSUPP - hwpoison_filter() filtered the error event, + * -EHWPOISON - the page was already poisoned, potentially + * kill process, + * other negative values - failure. */ int memory_failure(unsigned long pfn, int flags) {