From mboxrd@z Thu Jan 1 00:00:00 1970 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 0897AC19F2E for ; Thu, 27 Feb 2025 12:36:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8BAFB6B0088; Thu, 27 Feb 2025 07:36:31 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 86A246B0089; Thu, 27 Feb 2025 07:36:31 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 759176B008A; Thu, 27 Feb 2025 07:36:31 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 59E436B0088 for ; Thu, 27 Feb 2025 07:36:31 -0500 (EST) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id A9AF6506A0 for ; Thu, 27 Feb 2025 12:36:30 +0000 (UTC) X-FDA: 83165672940.04.DA1EFEF Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf03.hostedemail.com (Postfix) with ESMTP id C541120056 for ; Thu, 27 Feb 2025 12:36:28 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=none; spf=pass (imf03.hostedemail.com: domain of cmarinas@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=cmarinas@kernel.org; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=arm.com (policy=none) ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1740659789; a=rsa-sha256; cv=none; b=Z2pUuBa5/r/kIa3MWefFW1duG7HIXcbZehIfXEIX/VcnBi2c+o5eoO7r5BP7kkOAyT/MZT YPXWga2Z9rpbuOzFe5igAX8o6cSYyojwo6ZMrjUR6UK1NICIat9f1zjgSRKpxRBhFAbe5S h4qRPClNd09tqcql7he69eLCTCI7lTM= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=none; spf=pass (imf03.hostedemail.com: domain of cmarinas@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=cmarinas@kernel.org; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=arm.com (policy=none) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1740659789; 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-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3D27/czJ9tTae692WszgtvNJJBNH99Ngz/ZrVGIZii8=; b=bxnBFybA9a0erZ5rMHMbXc8hdrJGdyJoqbdaBdc3TgfnlkySxLAhOLszj1A2nC6RoWnEKr t5c6fhnY3obct/3M8caae0x27eoM3jDreggNib1XyiomIe61O4FO0mttLpu8y+yK3TAMOP n22kbWjac9atK/BFwp+JhjQwszmWgYw= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id D54B25C28D8; Thu, 27 Feb 2025 12:30:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3D25AC4CEE9; Thu, 27 Feb 2025 12:31:20 +0000 (UTC) Date: Thu, 27 Feb 2025 12:31:17 +0000 From: Catalin Marinas To: Shuai Xue Cc: yazen.ghannam@amd.com, mark.rutland@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, 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, justin.he@arm.com, ardb@kernel.org, ying.huang@linux.alibaba.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: Re: [PATCH v18 2/3] mm: memory-failure: move return value documentation to function declaration Message-ID: References: <20250107081735.16159-1-xueshuai@linux.alibaba.com> <20250107081735.16159-3-xueshuai@linux.alibaba.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20250107081735.16159-3-xueshuai@linux.alibaba.com> X-Stat-Signature: wq8tir8ppdmhtr9rg56fgyezyu594ygp X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: C541120056 X-Rspam-User: X-HE-Tag: 1740659788-884944 X-HE-Meta: U2FsdGVkX187qkYZk2ZEWNuYjzx9U0EpdCaQWp+7uDfXCdQXUxUOBIDJv3HJuunf7pdghtwynXIczUYYhMVq4FK0Mw9sySecWxlTb2pmk8iIhNiDPKXw7uk59uuZTGkKN29TgtHQ4Gmp/a7Y0blpbeIVuEvto4E2k0SbooMMqroqP4/fHSqnq1rW/ETG5x+uu7467wJJ2ugVCUq145n5J8FVLwCYVzqztDoTKLSuB2O2l5G8Ta6keokwGMKJlya6N0UtcaM+r+rDdFphrmEGYkU21h42yQbhqc4oLF7RP0QAKNUsTvQVU+/dsxFhryBcOSObW5dLnPlqhDKYuvI7dvi1vb2at7mWsZZfFZIHaVuVR2CiXNxxJfVSzMlpWcYadQVb6GuLrUWW2s/J1axRex5yrChDd//tgKAe1S6S6bV/IyImqbCjRgy3mY8QSEP6MYoLjzzXbuX/nuV9A5ayHlv3uO3Ug/TEobxSIgo/L1vI7CZGMefKSQ++0Xpc0sx5FZwBCDmOIZV7BxxyBQu6l5fH9kWA0lhHUCtlohmLKwhcioYpRlajPO5B+fd1qmxdk751cmIx9PE4W4XLelqJpgHRHgSwkBuAyVcmf32rO0O/hEwWOj+ifuaeBIiy1vs9dVh3oJN4ot4LvEszjpasXw5NCLA3L94Iv0o1U7n4kcHnsQMSxLPSpgzHcAGbIJMwwOBHGjClFkECl5xnYGVp9WIYIH8Usoe7eEn8eSoW4lliKSEomAMIoQqR3mYUyrALofKKe4cR2Fue96LqPiRXGUPzTHn9+M0PNbfJpM752OEur34UYnHFurDJPUjMHzS+sFTBIN5NUC+zyIkvo2Vdf6JNoW/LFbvA3u7FRIsKDW+xuOM9mO2Et0NJReuyEB3UQWFj9BguWhk3Gvz+9RWfAvpUHsR8QbYQd22NxZMq+NqFjZ9oQQ2CXIk7R0RiTFOHYcbUwe4qSpQqsNT4tCg VzT+fsVB YNK/4ASx4KdiDPmAQ43W2ng0vCtdWmWe4tAE+s39DGyEtTThe7LhGxrW0e4F0L5OclU8cCOgNehSL2bP4G2HMuEs/ZW3weBKOLFseLfmYiJVFLDDGmhRxYZ+1dZqmF6R2oPmauFpuxswfAgPBJOJrNx2IeHCJUd6vXH5OQ1dkHDsDYA5vQeZ+kw7zT19uzAvk86sYfmgd90qaH4zQlzLM5np9mTP/Eao2jwQYyaH2oYXORe5xl4OSiRuk8QIvcWtblwLR/t46e6frYQ07FoqEcdfObHhrcYoDvQNPYPbNay3myKS62f+kbIFFVRX4EEynwvr0ZJM+H6p4ddSOADjnXLXja3I7PxuCrlkma2XJYsKHMDpCH3zQtQAU42EaMTQIk/9v5XPLqSrkrh7zihp8Fac/P3zINpVAzny3WbuVp8l+O8lluotZ1fceN48h7px/6pLtsH+90q3IntvWZmlNZ82qiA== 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: (going through patches in my inbox) On Tue, Jan 07, 2025 at 04:17:34PM +0800, Shuai Xue wrote: > 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 s/declaration/definition/ > 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 > Reviewed-by: Jane Chu > --- > 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) > { Why not keep the comment in both places? One is about the x86 decisions, the other is about what memory_failure() can return. -- Catalin