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: 180157 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:24d3:b0:fb:cd0c:d3e with SMTP id r19csp1065603dyi; Sun, 17 Dec 2023 22:46:16 -0800 (PST) X-Google-Smtp-Source: AGHT+IHrbImvQ0tVzRqadQMpxzPQUQ1fV3qZclZYhLONBJyZRTDEogcue2ojyYct6W3M3ripZf5v X-Received: by 2002:a05:620a:f0c:b0:77f:8c43:6b32 with SMTP id v12-20020a05620a0f0c00b0077f8c436b32mr14186794qkl.19.1702881976040; Sun, 17 Dec 2023 22:46:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702881976; cv=none; d=google.com; s=arc-20160816; b=fcA9ku8/cx4JC1vbZQLFn8hk7RrQ5rIh4ZIX8HmGzxIzuz7cqsZ+FpKfl0mEBjEeSR ZJtKienB332YMbORkdayMUEvrPF+MlgbA/+kMGU2+7dKeKPgiHE9ODRlC/0HYlJkMBXJ M1SAPgyb/w199zPzD2B3IOC/hBxivY1pthw3LHwInxIVOCSxMC+tScUpU/1Fkb6cVxcy 1oql5i2imsAHarP84Y34J5go9B27wXJU8V8vgoe1WZWZGhGJ2mm5HuMSaQDIZMZcM8z8 CRNUUGODaGUgX+Y9DBzZjrx4jdok9+7wvPlLhSDz6Wu7gPehPyDm353EtxKelHuGLUvU 13+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=S2f1TDEW63cD3jPt1NzhP/57iKUVALLGIHmiAutG68U=; fh=2vSDPmybdbFLizjyi+m3UstEO9s2E4YiFiwbQZuWlSI=; b=aLWyej/M9TeuJNbNAWgbHJ6athwsQ8jNGt3HCYfSjmLcxzekCS8M6keIAUqH/z6uPJ PZfYdIUToXO3IXoXyW4NC5wEhFdehCTSv79Yo2GlaqTPuk31XrbNhXs36cBnza82/YO0 7kxCVzZ1VM6k5qcMxF/3N/jOyqPDV9wauXBop+0aXC92zaU/zWNbQX8cqKu1LS7WJFmr eSQs1RMhszHCBZxXiel7KEUACw3mUvBdYYBcHYrE3Bb/MIPVzCtvW44uU//EGo27s/lr uoZPfv/3PstaUN4K3pHgpif1IOnpQgK9iin1STQ0Xb5ZUlLeD1GYaKVnUjl74TSOUlEJ AodQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-3055-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-3055-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id wa24-20020a05620a4d1800b0076f10188542si22045191qkn.751.2023.12.17.22.46.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Dec 2023 22:46:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-3055-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-3055-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-3055-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id CFBC61C22218 for ; Mon, 18 Dec 2023 06:46:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9B60FD269; Mon, 18 Dec 2023 06:45:42 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org Received: from out30-110.freemail.mail.aliyun.com (out30-110.freemail.mail.aliyun.com [115.124.30.110]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6F9BA7498; Mon, 18 Dec 2023 06:45:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785601171004078762 X-GMAIL-MSGID: 1785601171004078762 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) {