From patchwork Sun Feb 4 08:01:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuai Xue X-Patchwork-Id: 13544549 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 05F0EC48286 for ; Sun, 4 Feb 2024 08:02:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8B0866B007D; Sun, 4 Feb 2024 03:02:13 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 7E7F66B007E; Sun, 4 Feb 2024 03:02:13 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6890E6B0080; Sun, 4 Feb 2024 03:02:13 -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 5336A6B007D for ; Sun, 4 Feb 2024 03:02:13 -0500 (EST) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 1DCBCA03B8 for ; Sun, 4 Feb 2024 08:02:13 +0000 (UTC) X-FDA: 81753378546.15.8BE91C9 Received: from out30-113.freemail.mail.aliyun.com (out30-113.freemail.mail.aliyun.com [115.124.30.113]) by imf15.hostedemail.com (Postfix) with ESMTP id D1EB6A000D for ; Sun, 4 Feb 2024 08:02:10 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=linux.alibaba.com header.s=default header.b=bkmsws26; spf=pass (imf15.hostedemail.com: domain of xueshuai@linux.alibaba.com designates 115.124.30.113 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=1707033731; a=rsa-sha256; cv=none; b=Wju+6aGXIM9gUKvoHGSSCDkuWCWIN4SLYlAUp3QXHinld0vMiKt2ghZwBYUT51pxgepAbB 4JhGDUD3vRNhs9bdb+ZN+4npOTmZuY4H7a4s0M7egfEw+CVL7q9fz59396IU9ZGDhgsQUy 73M+vfH3Tu2Igk6YTK25Ln/IKnQPOIg= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=linux.alibaba.com header.s=default header.b=bkmsws26; spf=pass (imf15.hostedemail.com: domain of xueshuai@linux.alibaba.com designates 115.124.30.113 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=1707033731; 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=fnJBG1HYaP2ae74e0hOy/sgtFi6pdPcie6U/1Z9TVEk=; b=HALqnEWzW3ygIf4tRAAK6ufCixWMZfgZ7l3yFWE/6mYjv6isVlubUtSDV+IIYPh57euGdg ZFFv2Rz/7gH14F1kJEPFWdKrnFtJj7hyUy+p4btpSWxCDdFxi4YPpwi7IPPZNLTE+MW3jp AnjyAI+zAQV8ovsDTBM7FEGjXN0WHs4= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1707033726; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=fnJBG1HYaP2ae74e0hOy/sgtFi6pdPcie6U/1Z9TVEk=; b=bkmsws26ArSV/RZhkt5sbdHnDIXsyN8YPbPWarsll6HIMVpc51fpLzrrODA77kcdkVgk7MDHep3b6ZaI/hNJ3zJjZ8ZYsBhuL0HKZ5j3Dffmv3hVbScuXVO16ARRRk56hK1h7kNqY4+bHq6r7oi1dqngDVNQOaJpshjPCvtVTSM= X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R201e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045168;MF=xueshuai@linux.alibaba.com;NM=1;PH=DS;RN=33;SR=0;TI=SMTPD_---0W0003Lp_1707033722; Received: from localhost.localdomain(mailfrom:xueshuai@linux.alibaba.com fp:SMTPD_---0W0003Lp_1707033722) by smtp.aliyun-inc.com; Sun, 04 Feb 2024 16:02:05 +0800 From: Shuai Xue To: 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, 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, mingo@redhat.com, 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 v11 2/3] mm: memory-failure: move return value documentation to function declaration Date: Sun, 4 Feb 2024 16:01:43 +0800 Message-Id: <20240204080144.7977-3-xueshuai@linux.alibaba.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221027042445.60108-1-xueshuai@linux.alibaba.com> References: <20221027042445.60108-1-xueshuai@linux.alibaba.com> MIME-Version: 1.0 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: D1EB6A000D X-Stat-Signature: ag57gyud3mhq1k47crxmtfy1sagfwxxz X-Rspam-User: X-HE-Tag: 1707033730-263075 X-HE-Meta: U2FsdGV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Zcb5qqOCpYSADl7E/JZMmuDhBncxs4zVLT3uAM/ImYtgc4MHNtsb52qbZUDjXQwkjlP6OjRnDToTAL/D0t0ngMQHOkuIfgRjfT7kCtlXsVzGQO7+glMla3A 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 --- arch/x86/kernel/cpu/mce/core.c | 9 +-------- mm/memory-failure.c | 9 ++++++--- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/arch/x86/kernel/cpu/mce/core.c b/arch/x86/kernel/cpu/mce/core.c index bc39252bc54f..822b21eb48ad 100644 --- a/arch/x86/kernel/cpu/mce/core.c +++ b/arch/x86/kernel/cpu/mce/core.c @@ -1365,17 +1365,10 @@ 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; - pr_err("Memory error not recovered"); + pr_err("Sending SIGBUS to current task due to memory error not recovered"); kill_me_now(cb); } diff --git a/mm/memory-failure.c b/mm/memory-failure.c index 636280d04008..d33729c48eff 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c @@ -2175,9 +2175,12 @@ static int memory_failure_dev_pagemap(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 values: + * 0 - success + * -EOPNOTSUPP - hwpoison_filter() filtered the error event. + * -EHWPOISON - sent SIGBUS to the current process with the proper + * error info by kill_accessing_process(). + * other negative values - failure */ int memory_failure(unsigned long pfn, int flags) {