From patchwork Fri Sep 20 04:30:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuai Xue X-Patchwork-Id: 13808127 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 E2242CF58CB for ; Fri, 20 Sep 2024 04:30:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 61F766B0085; Fri, 20 Sep 2024 00:30:53 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 582CD6B0088; Fri, 20 Sep 2024 00:30:53 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 453046B0089; Fri, 20 Sep 2024 00:30:53 -0400 (EDT) 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 22DBD6B0085 for ; Fri, 20 Sep 2024 00:30:53 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id A2393ABA1F for ; Fri, 20 Sep 2024 04:30:52 +0000 (UTC) X-FDA: 82583841144.28.285019B Received: from out30-133.freemail.mail.aliyun.com (out30-133.freemail.mail.aliyun.com [115.124.30.133]) by imf04.hostedemail.com (Postfix) with ESMTP id 9BC554000D for ; Fri, 20 Sep 2024 04:30:50 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=linux.alibaba.com header.s=default header.b=GHV9QGZs; spf=pass (imf04.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=1726806537; 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=7h8gaF9zDWFNoQ5tWBkmtBaX4mIC5RXSNKP1hLfyyMg=; b=vJx78fypJvQMCa2cTemNVPl/z/gI6tDnCY54+BjGvd9606Tei/uGo93zc/MOxT/LAniJEp Vpy3AUlYUUwolAWRMVIwj697V3/q/8AVB64MxAgvIhqm26cT/suAZ/zA0WeyrrzjsfakXn YJNdti5dUPTfOu3t3H34I4OenTgx+yE= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1726806537; a=rsa-sha256; cv=none; b=jPByhT53idVlwnOec6+/vC1WHm/LL77hKESgZmTyZAMMdeNTSs7OKR9kjHQ4iojZS7lWhW NBxhlNoxxiBil59ptE/uefLLn2oayBtDj6qkLN4PPLIO4xHyFhYjStDBauN+kVR2qYGXZP lCEHJ34dltupfPJPtO5G/1LwOiMdQ80= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=linux.alibaba.com header.s=default header.b=GHV9QGZs; spf=pass (imf04.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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1726806647; h=From:To:Subject:Date:Message-ID:MIME-Version; bh=7h8gaF9zDWFNoQ5tWBkmtBaX4mIC5RXSNKP1hLfyyMg=; b=GHV9QGZsBOwoIAfDyuwXFc9slssQSgfh6Amypm59xNciiFoIsOAKt/nNpyC1VvuCoNovXEgQCe29NiqKSleYH2KtronhfLcJvA6tYb6LGQYeTGwNg5kU6xnIkAcJ6PN0rxFUTvas/8w25qQ+GItLpwW3j4kjOz3mqtS0vLj3Lvo= Received: from localhost.localdomain(mailfrom:xueshuai@linux.alibaba.com fp:SMTPD_---0WFJd0JO_1726806642) by smtp.aliyun-inc.com; Fri, 20 Sep 2024 12:30:44 +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 v13 2/3] mm: memory-failure: move return value documentation to function declaration Date: Fri, 20 Sep 2024 12:30:26 +0800 Message-ID: <20240920043027.21907-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-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 9BC554000D X-Stat-Signature: nz965yanegyt3hk4jx4yz5kks8hbdm3g X-HE-Tag: 1726806650-212958 X-HE-Meta: U2FsdGVkX186KSNDR+e3+2XyNMbqSGNfVN0RiHrAKo31v+rJ711/qJZxLyaWYcaL40BJpLUiBs8LvMxzHr/8wuEtca9OsIFtCgIRwVlrj7TSLrs2L33GZyYrb01s++T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6pjvfzDNPJs33O2X 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 --- 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 7066fc84f351..7984e0d99d09 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c @@ -2199,9 +2199,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) {