From patchwork Mon Dec 18 06:45:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuai Xue X-Patchwork-Id: 13496264 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 C385DC35274 for ; Mon, 18 Dec 2023 06:45:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5B4F98D0006; Mon, 18 Dec 2023 01:45:42 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 516C68D0001; Mon, 18 Dec 2023 01:45:42 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3B93B8D0006; Mon, 18 Dec 2023 01:45:42 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 2E9B68D0001 for ; Mon, 18 Dec 2023 01:45:42 -0500 (EST) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 0E978A08A8 for ; Mon, 18 Dec 2023 06:45:42 +0000 (UTC) X-FDA: 81579003324.22.85B2673 Received: from out30-130.freemail.mail.aliyun.com (out30-130.freemail.mail.aliyun.com [115.124.30.130]) by imf05.hostedemail.com (Postfix) with ESMTP id EDB7F100015 for ; Mon, 18 Dec 2023 06:45:38 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=none; spf=pass (imf05.hostedemail.com: domain of xueshuai@linux.alibaba.com designates 115.124.30.130 as permitted sender) smtp.mailfrom=xueshuai@linux.alibaba.com; dmarc=pass (policy=none) header.from=alibaba.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1702881939; 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; bh=S2f1TDEW63cD3jPt1NzhP/57iKUVALLGIHmiAutG68U=; b=C01zfCKlIBqHHByLRkx/zVAAlfBK/hiwCXDsDDVUEUbOPe2SoFeUbjvxMk97t8VrwjKT9e Vaz8OcRSHZF1liywh7mKCUQ4Dg6i6uUGNHPbUK9yEndiI1X1Bx+vnw8AJjjsjrujPYcwaS eVsoGGFczNINX+OdR3yPEJbWOHYTW9s= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=none; spf=pass (imf05.hostedemail.com: domain of xueshuai@linux.alibaba.com designates 115.124.30.130 as permitted sender) smtp.mailfrom=xueshuai@linux.alibaba.com; dmarc=pass (policy=none) header.from=alibaba.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1702881939; a=rsa-sha256; cv=none; b=akaJsZ/hM6YsAyS7QpDZ5Ne3T7yMbFF3d1DZPvNUxfgid+kxl2/5JYHVLTXw8WOe8lZMEH RQnpf7hnnn0Cv/I+MchpldF+pZxRN2KL7urat0WGFChiFcEHcz/wXXyOX70BpqYb243XiK Ck7iq1GMXEMViVvkFRI6shzG3NNHjx8= X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R101e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045192;MF=xueshuai@linux.alibaba.com;NM=1;PH=DS;RN=35;SR=0;TI=SMTPD_---0VygHb.J_1702881931; Received: from localhost.localdomain(mailfrom:xueshuai@linux.alibaba.com fp:SMTPD_---0VygHb.J_1702881931) by smtp.aliyun-inc.com; Mon, 18 Dec 2023 14:45:33 +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, acpica-devel@lists.linuxfoundation.org, stable@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 v10 3/4] mm: memory-failure: move memory_failure() return value documentation to function declaration Date: Mon, 18 Dec 2023 14:45:20 +0800 Message-Id: <20231218064521.37324-4-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-Queue-Id: EDB7F100015 X-Rspam-User: X-Stat-Signature: awz7bnwn4rm538t8emr1k9f5ser3umg3 X-Rspamd-Server: rspam01 X-HE-Tag: 1702881938-626746 X-HE-Meta: U2FsdGVkX19al9v3JoaRIURfkjOrRp1pllJ5d24+kCdOOB75b078N0RsJEQob/IVwu9fYZBEowHE6CPsGyhs8goa9RhjBQsNRXLZtfOwZdar/HYjvYktvpFd+o6AmZWGJtaOJTv5yRQYpWnzI9z7B1x+4ZEze7IhzAqSTRl4ZUjwUOvghSGicGv+I1WLtCz3ALaiB/PjUJIC1J9sQ5tuuZNVLDt/TJ7ja4MWlu83JpZ7kqu+jC3yR3R8QlndY2PdCw9CqhNrnbLEhYKz5qbsxnsZcDpK+DEzr/vsCVeu5wMl9lH1SUkbWvGDN1b/KBNyvpPAE6PvTxgrrhDTg9rjHKZRkr6trwyxnh4RdYM72frgjHk/Tj63Ujfm6zXWfsMbvIAUp4C9ymrHZjWPq4a3v6C9lmyHgZoRbe5mNALueshNkdxUm9iYYQpFs9tFu5hkoRnv2c0SaIo4qhIhz9M3WpuKyKUlSSMt8OZOnWgMIwf6CZC65CBkCp6dCjbaW5ZUUNeOsOuTlEIjfawjk4fXTKGsO+wWZr6y+/Fv5h9Cp2zfyJL/gj37d7Lq2H2MoGGf4LY3REj2kBQWNzEdoESc9fQ10s/kPKK5BZNuMulueZWq7wQSe+Q0GyVPnLGwY7GdUvvhY2RsiK5Xhx6i/ItKGC8oVw0ZdjmENVZMafUyzVoLvp4FjgJGpXsBG56wDXHEH+sUTuVNuAiTxL6/LfpFa6cbO/9NOC7shyI0AjtjUtcUXjGQ4p4TAcQYlLY464LnhdNU5omiFU/OHCsUTxnkYIu0ddVXhp3J5srqTGRPAcvkEDU9+VL50ruZoAIzzqK+d4CEzyu5BAkS2TWZbwOY6qJLz24hBcO6UpXaJMP6wlE= 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 7b397370b4d6..43e542f06ad5 100644 --- a/arch/x86/kernel/cpu/mce/core.c +++ b/arch/x86/kernel/cpu/mce/core.c @@ -1324,17 +1324,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 660c21859118..bd3dcafdfa4a 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c @@ -2164,9 +2164,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) {