From patchwork Mon Dec 2 03:05: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: 13889892 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 352C8D49797 for ; Mon, 2 Dec 2024 03:05:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EFB3B6B0082; Sun, 1 Dec 2024 22:05:49 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C7F516B0088; Sun, 1 Dec 2024 22:05:49 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 972506B0082; Sun, 1 Dec 2024 22:05:49 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 6D8E96B0085 for ; Sun, 1 Dec 2024 22:05:49 -0500 (EST) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 1021E1C8688 for ; Mon, 2 Dec 2024 03:05:49 +0000 (UTC) X-FDA: 82848528840.26.39DB242 Received: from out30-113.freemail.mail.aliyun.com (out30-113.freemail.mail.aliyun.com [115.124.30.113]) by imf24.hostedemail.com (Postfix) with ESMTP id 7EDE4180009 for ; Mon, 2 Dec 2024 03:05:45 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=linux.alibaba.com header.s=default header.b=xS9gey5y; dmarc=pass (policy=none) header.from=linux.alibaba.com; spf=pass (imf24.hostedemail.com: domain of xueshuai@linux.alibaba.com designates 115.124.30.113 as permitted sender) smtp.mailfrom=xueshuai@linux.alibaba.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1733108736; a=rsa-sha256; cv=none; b=8G+9ipzuoGgDJ/XSvWhH5gQd1Act//3Kh2MLuflFMQr6wUmkf+x8Fx/AaqpLDvYdQhB8OO 1/Un+83L69xtP82aDJ3azBL3lXmzvP+5QgJT9zgetuEzL9FZDEUc2kxROqCSaf26vIxpyh rdou/j6Nsi+kinQKOBcFZJC5i5NfkUA= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=linux.alibaba.com header.s=default header.b=xS9gey5y; dmarc=pass (policy=none) header.from=linux.alibaba.com; spf=pass (imf24.hostedemail.com: domain of xueshuai@linux.alibaba.com designates 115.124.30.113 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=1733108736; 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=ItS4BFOg0AeuOHeL7r95uyYQr4QuXPc/Wv3KswiaGW0=; b=5QLj8C4RTCIqWnn841Cl8wNEB0vihGFQNqHI9S2vJuixfL2nnGyXB4CXBrc0keuZQewU45 unEKlUeIcakpevFAQlwZX8TMlNVmHW8q3VP6im4sgEuUolZprRPCGsNS7VmdI19hj8JiIO r9NsA4omtTa85mKX43tFho8VS4bFsyM= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1733108744; h=From:To:Subject:Date:Message-ID:MIME-Version; bh=ItS4BFOg0AeuOHeL7r95uyYQr4QuXPc/Wv3KswiaGW0=; b=xS9gey5y+c5M23bwGx5ECro7l1lZiNAe8B19nCfjRX2za0qsAw/KMkc++fxDqL4k3zwGfGp8XK32S+4ElhM1+PWmY3gxcSQor1nXXQSywNkxBAOuuh9AzOm5ywygBj6T2+p+BHLL3Zxuw9AmKq5osZ8bi3/1inwEoLk16v15LTk= Received: from localhost.localdomain(mailfrom:xueshuai@linux.alibaba.com fp:SMTPD_---0WKbh0Wj_1733108741 cluster:ay36) by smtp.aliyun-inc.com; Mon, 02 Dec 2024 11:05:42 +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, linux-arm-kernel@lists.infradead.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 v17 2/3] mm: memory-failure: move return value documentation to function declaration Date: Mon, 2 Dec 2024 11:05:26 +0800 Message-ID: <20241202030527.20586-3-xueshuai@linux.alibaba.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20241202030527.20586-1-xueshuai@linux.alibaba.com> References: <20241202030527.20586-1-xueshuai@linux.alibaba.com> MIME-Version: 1.0 X-Stat-Signature: 1xd4954gmwx1ttqs15he4qx5typbbi7k X-Rspam-User: X-Rspamd-Queue-Id: 7EDE4180009 X-Rspamd-Server: rspam08 X-HE-Tag: 1733108745-895955 X-HE-Meta: U2FsdGVkX18V7jkWWLfu+y2AMUCl7Rkeu9CeWlKOadOpJbG83h4ilpQXy8tHkcSsVoh4I5X4it2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LfD0cL4SLepLmhDYz48+flBUtetSSN9XfD20bxEQ/kJj9rfWdGclCJhARmwkhmBHFxaWwYsdlUOg0eDZdFeMMN15dazb/BInCy4/vITw3ZkFPiu7Lp4= 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 | 10 +++++++--- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/arch/x86/kernel/cpu/mce/core.c b/arch/x86/kernel/cpu/mce/core.c index 7fb5556a0b53..d1dd7f892514 100644 --- a/arch/x86/kernel/cpu/mce/core.c +++ b/arch/x86/kernel/cpu/mce/core.c @@ -1398,13 +1398,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 a7b8ccd29b6f..14c316d7d38d 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c @@ -2211,9 +2211,13 @@ 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, + * -ENXIO - memory not managed by the kernel + * -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) {