From patchwork Mon Nov 4 01:54:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuai Xue X-Patchwork-Id: 13860786 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 18184D1119A for ; Mon, 4 Nov 2024 01:54:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 060A96B007B; Sun, 3 Nov 2024 20:54:54 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id F35C96B0082; Sun, 3 Nov 2024 20:54:53 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D595A6B0085; Sun, 3 Nov 2024 20:54:53 -0500 (EST) 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 ACF156B0082 for ; Sun, 3 Nov 2024 20:54:53 -0500 (EST) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 77EB0C080C for ; Mon, 4 Nov 2024 01:54:53 +0000 (UTC) X-FDA: 82746743100.10.0B8D5D9 Received: from out30-112.freemail.mail.aliyun.com (out30-112.freemail.mail.aliyun.com [115.124.30.112]) by imf15.hostedemail.com (Postfix) with ESMTP id 6565CA0011 for ; Mon, 4 Nov 2024 01:54:19 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=linux.alibaba.com header.s=default header.b=cR9B2KTw; dmarc=pass (policy=none) header.from=linux.alibaba.com; spf=pass (imf15.hostedemail.com: domain of xueshuai@linux.alibaba.com designates 115.124.30.112 as permitted sender) smtp.mailfrom=xueshuai@linux.alibaba.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1730685125; a=rsa-sha256; cv=none; b=NfCFCATR5/5Kakh2i68etZhfgwdxaZJ/LSfcSdCNlRynmEKp4SVlhl7s1SkjIfTumkntfg h0+hjdD/hkiA1vKcUieFwCJs1VejpGNlY3sgxvVRwQw742B244RwWwVUykNs9ZeTzhxkI3 WzosD7FS1kXwEMzwA6PCBP8PIHB0aeg= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=linux.alibaba.com header.s=default header.b=cR9B2KTw; dmarc=pass (policy=none) header.from=linux.alibaba.com; spf=pass (imf15.hostedemail.com: domain of xueshuai@linux.alibaba.com designates 115.124.30.112 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=1730685125; 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=Rg48g35Hldtixze25WV/zEV0Y3JqgND3qlpjxULA+Qm4i4mTKiFhc2Hh6K+ugQBV7cKzeh RqTOjj0HFsKjWeSwQ9ee6vG19D7fduwcelt6u6ZFxLTuzdgRIUmal01Bd0mp8WTO5hMea4 2JglXRqYa9aJv6nX8RY14xB09RwDH4A= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1730685288; h=From:To:Subject:Date:Message-ID:MIME-Version; bh=lVswVmzgt9DzjxQRJ6NTMkFlRkHIKa9zwgB+YGqU+A8=; b=cR9B2KTwpttc63YO1PbAAC7YdAMtL8UoV7VLZpx/rOy3NiHcR01EUA41vpVAccw5sVf7GgXzTHJwKl2qesEbr3wt79L2xrW0vl7DuvtQVHfNw3tWqOyF1N9V4/Zkg2oyV9fdr67L7qx6+V0eTC4nbcQlag8jfI8EXU+8l4HKHnU= Received: from localhost.localdomain(mailfrom:xueshuai@linux.alibaba.com fp:SMTPD_---0WIZg3ve_1730685285 cluster:ay36) by smtp.aliyun-inc.com; Mon, 04 Nov 2024 09:54:47 +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, 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 v16 2/3] mm: memory-failure: move return value documentation to function declaration Date: Mon, 4 Nov 2024 09:54:29 +0800 Message-ID: <20241104015430.98599-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: yyg35a6tz7p5icdgemauzed8whfoo71t X-Rspamd-Queue-Id: 6565CA0011 X-Rspamd-Server: rspam08 X-Rspam-User: X-HE-Tag: 1730685259-921877 X-HE-Meta: U2FsdGVkX1+RlhTbGRNNnO903uzmntJOgcNuO3ptpQfojiadzBZJDg5Vvgdwp7UDAQ20lg01JyVM1eCipo6zVIeRrVYk2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oi64jKS/t9dgz2uSMT6Gq5KF6eqX46F0jaSvqksxKKqZu+gX6DtObUAyMGBCtNpye8Vkx7iYXl6rt8zjHoyLM4MEqcL1dcPGomi8+/I5gA== 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 --- 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) {