From patchwork Mon Oct 28 08:11:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuai Xue X-Patchwork-Id: 13853143 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 750C7D13597 for ; Mon, 28 Oct 2024 08:12:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8E5416B008C; Mon, 28 Oct 2024 04:12:03 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 846AE6B0092; Mon, 28 Oct 2024 04:12:03 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6E6FE6B0093; Mon, 28 Oct 2024 04:12:03 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 4A24E6B008C for ; Mon, 28 Oct 2024 04:12:03 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 73E7EACAA2 for ; Mon, 28 Oct 2024 08:11:18 +0000 (UTC) X-FDA: 82722292170.21.67491C5 Received: from out30-130.freemail.mail.aliyun.com (out30-130.freemail.mail.aliyun.com [115.124.30.130]) by imf16.hostedemail.com (Postfix) with ESMTP id 128A918000B for ; Mon, 28 Oct 2024 08:11:37 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=linux.alibaba.com header.s=default header.b=JonD5A0G; spf=pass (imf16.hostedemail.com: domain of xueshuai@linux.alibaba.com designates 115.124.30.130 as permitted sender) smtp.mailfrom=xueshuai@linux.alibaba.com; dmarc=pass (policy=none) header.from=linux.alibaba.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1730103041; a=rsa-sha256; cv=none; b=MlGqC5HwhzE12L6ZUN/1JcO2a11lOc3whkor1edx2prUd472653fgy1ewfaKYD/xqXpjBp euY/9AmC2GV/xUEJxWYkEFQcDmW0pritsiv72silVDRiWws7fMXgRnpP+61MPqKCYkn66O DY811OYPORlEbZw9GQxHodfYcF8UGFw= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=linux.alibaba.com header.s=default header.b=JonD5A0G; spf=pass (imf16.hostedemail.com: domain of xueshuai@linux.alibaba.com designates 115.124.30.130 as permitted sender) smtp.mailfrom=xueshuai@linux.alibaba.com; dmarc=pass (policy=none) header.from=linux.alibaba.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1730103041; 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=lVswVmzgt9DzjxQRJ6NTMkFlRkHIKa9zwgB+YGqU+A8=; b=20auovoZNXFMjqs8+XhmBQjsvsOwD+i8GHCYANAo9xjw8ia+e6KGyRQaQyejyMU0KMqXpo hl3qK7q6pmK8qKxyGGWPFEkB5MZdPy4P+pfTRkV0OybjVDEbnf4SBRLSB24LMiohhVM0DJ sjk7FyBdY+SLu0sT5+bapO9KBMB1wWo= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1730103118; h=From:To:Subject:Date:Message-ID:MIME-Version; bh=lVswVmzgt9DzjxQRJ6NTMkFlRkHIKa9zwgB+YGqU+A8=; b=JonD5A0GltpFCNHYbfeUfyoDpwJNq9drqmwo9FVNdSj40CGhsT5rHYqRj4NucGVjuhwSniElaTi6flNShg6bIOUOGBgX9rj8rDNM2ClfHm9grU7fRDVbeOWBGLvqxmcpR/g6rI7JqyFw+4qLVWTkTed4KTStquaHfezv2i2xS+E= Received: from localhost.localdomain(mailfrom:xueshuai@linux.alibaba.com fp:SMTPD_---0WI0hO4z_1730103115 cluster:ay36) by smtp.aliyun-inc.com; Mon, 28 Oct 2024 16:11:57 +0800 From: Shuai Xue To: 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, 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@intel.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 v15 2/3] mm: memory-failure: move return value documentation to function declaration Date: Mon, 28 Oct 2024 16:11:41 +0800 Message-ID: <20241028081142.66028-3-xueshuai@linux.alibaba.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20221027042445.60108-1-xueshuai@linux.alibaba.com> References: <20221027042445.60108-1-xueshuai@linux.alibaba.com> MIME-Version: 1.0 X-Stat-Signature: d8mes1k4zi3wcmruent1xtcxia57zjxg X-Rspamd-Queue-Id: 128A918000B X-Rspam-User: X-Rspamd-Server: rspam10 X-HE-Tag: 1730103097-449142 X-HE-Meta: U2FsdGVkX1/euqKbhhZS2+5MAmI/id/bOYsgkAWBXHF91p/4ieqZbphqByZf07QA47iVXrU0oF5DS8mX3BypWgLyTmUNJE7GtFIqYJM/1JgJUhlyD0/o5FuMo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4iYKpl0imxzYhVrTMQMLjWGfMvbU8KyJINVw28D+I8RTKYtUnpaUaSAdwMVEfSPv3myb8EQ== 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 --- arch/x86/kernel/cpu/mce/core.c | 7 ------- mm/memory-failure.c | 9 ++++++--- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/arch/x86/kernel/cpu/mce/core.c b/arch/x86/kernel/cpu/mce/core.c index 2a938f429c4d..c90d8fcd246a 100644 --- a/arch/x86/kernel/cpu/mce/core.c +++ b/arch/x86/kernel/cpu/mce/core.c @@ -1373,13 +1373,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 96ce31e5a203..1c5098f32d48 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c @@ -2209,9 +2209,12 @@ 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, + * -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) {