From patchwork Mon Oct 14 08:42:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuai Xue X-Patchwork-Id: 13834333 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 B5610CFC503 for ; Mon, 14 Oct 2024 08:43:09 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 460DD6B0092; Mon, 14 Oct 2024 04:43:09 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3C4796B0093; Mon, 14 Oct 2024 04:43:09 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 213AC6B0095; Mon, 14 Oct 2024 04:43:09 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id E93C26B0092 for ; Mon, 14 Oct 2024 04:43:08 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 74905160992 for ; Mon, 14 Oct 2024 08:43:00 +0000 (UTC) X-FDA: 82671567930.15.DAC6461 Received: from out30-133.freemail.mail.aliyun.com (out30-133.freemail.mail.aliyun.com [115.124.30.133]) by imf22.hostedemail.com (Postfix) with ESMTP id BD6D1C0013 for ; Mon, 14 Oct 2024 08:42:59 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=linux.alibaba.com header.s=default header.b=hcihePe1; spf=pass (imf22.hostedemail.com: domain of xueshuai@linux.alibaba.com designates 115.124.30.133 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=1728895340; 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=gi2Mk7pPvTjLfm2Z0QyVj0/hlMnQaCSItYm0DF+izdc=; b=EerIOo03rgbyGD+QNZa3mG9wQ3CALFqdL4m7ZMZqnyO5TKknJhE2rkTsanJbTLum7t2Von SCJFFMkVAMXLZySN67OUErSFZmXcgYuOnKoLhxPk3kQY02Ku624JA9ZGXpl8nBi/Frt87v 1Y6+OQU+1KP9xZ8rFDhFytvty5s5Kw4= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=linux.alibaba.com header.s=default header.b=hcihePe1; spf=pass (imf22.hostedemail.com: domain of xueshuai@linux.alibaba.com designates 115.124.30.133 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=1728895340; a=rsa-sha256; cv=none; b=fZLficOS+w6RJO7QMoO9USTUkd2emWzgO8x1dXykkxzr+/2xYiixlObX/pm7VZbVltZCNf AF2i7Xdi1XbB1REUA1YbRXxxHEJWBNSo9TeIOXTnXO9jbkce1yOORRKsXgHiuRGz8fsb3p JFFZOmJSIE9tCieoqfdK+REMEi7OOdM= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1728895382; h=From:To:Subject:Date:Message-ID:MIME-Version; bh=gi2Mk7pPvTjLfm2Z0QyVj0/hlMnQaCSItYm0DF+izdc=; b=hcihePe1KHMOl3YUR+qosOry7tUX18mjxPzGLml0r3RoBp8QxO0ZKdJ9wlPqDeSoPnnx/MqD0mRAbrEoQBgfiF7LdrDeiobE8k81zOxZYMOGTg552Y062sY7Vv3/YW3y3ypHsUzgQEbvDRW6IDVI3dlU/o/Zi5HKeZMf5y3xnXM= Received: from localhost.localdomain(mailfrom:xueshuai@linux.alibaba.com fp:SMTPD_---0WH3mwU6_1728895378 cluster:ay36) by smtp.aliyun-inc.com; Mon, 14 Oct 2024 16:43:00 +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 v14 2/3] mm: memory-failure: move return value documentation to function declaration Date: Mon, 14 Oct 2024 16:42:39 +0800 Message-ID: <20241014084240.18614-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-Rspam-User: X-Stat-Signature: fp8bytsjr6roprw4non9gmyqssq8dhuh X-Rspamd-Queue-Id: BD6D1C0013 X-Rspamd-Server: rspam11 X-HE-Tag: 1728895379-159657 X-HE-Meta: U2FsdGVkX19073asg654hhca5ca/UFkxlQqomUrOo1kKYg8vb1Kozor+c+zPbtrFYNdQ+rhREZKCPCFtuGAWe0+OraDbCY+ipfiRBRvlQwbip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hT6sQXPLV0rmUwOBSYeP29SkTnb3gkfQCJH5GOCrMamsC 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) {